test #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test on push | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
test_and_coverage: | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
size: ['64b', '32b'] | |
golang: ['1.18', '1.22'] | |
exclude: | |
- os: windows-latest | |
size: '32b' | |
- os: macos-latest | |
size: '32b' | |
runs-on: ${{matrix.os}} | |
env: | |
DBGSYNCLOG: trace | |
DBGSYNCON: true | |
steps: | |
- name: Matrix is ${{matrix.os}} / ${{matrix.size}} - Go is ${{matrix.golang}} | |
run: date | |
- name: Set up Go ${{matrix.golang}} | |
uses: actions/setup-go@v5 | |
if: ${{ matrix.size == '64b' }} | |
with: | |
go-version: ${{matrix.golang}} | |
check-latest: false | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup Alpine Linux ${{matrix.size}} | |
uses: jirutka/setup-alpine@v1 | |
if: ${{ matrix.size == '32b' }} | |
with: | |
arch: x86 | |
packages: > | |
make | |
git | |
gcc | |
musl-dev | |
- name: Install specific Go version on Alpine Linux | |
if: ${{ matrix.size == '32b' && matrix.os == 'ubuntu-latest'}} | |
run: | | |
GO_VERSION=${{ matrix.golang }} | |
wget https://golang.org/dl/go$GO_VERSION.linux-386.tar.gz | |
tar -C /usr/local -xzf go$GO_VERSION.linux-386.tar.gz | |
rm go$GO_VERSION.linux-386.tar.gz | |
export PATH=$PATH:/usr/local/go/bin | |
shell: alpine.sh {0} | |
- name: getconf x86 | |
if: ${{ matrix.size == '32b' }} | |
run: | | |
getconf LONG_BIT | |
go version | |
shell: alpine.sh {0} | |
- name: getconf x64 | |
run: | | |
getconf LONG_BIT | |
go version | |
- name: Test without coverage (Windows, MacOS) | |
if: ${{matrix.os == 'macos-latest' || matrix.os == 'windows-latest'}} | |
run: make test | |
- name: Test without coverage (Ubuntu x86) | |
if: ${{matrix.os == 'ubuntu-latest' && matrix.size == '32b'}} | |
run: make test | |
shell: alpine.sh {0} | |
- name: Test with coverage | |
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}} | |
run: make coverage | |
- name: SonarCloud scan | |
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}} | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.organization=dedis | |
-Dsonar.projectKey=dedis_kyber | |
-Dsonar.go.tests.reportPaths=report.json | |
-Dsonar.go.coverage.reportPaths=profile.cov | |
-Dsonar.pullrequest.key=${{ github.event.number }} | |
-Dsonar.pullrequest.branch=${{ github.head_ref }} | |
-Dsonar.pullrequest.base=${{ github.event.pull_request.base }} | |
-Dsonar.c.file.suffixes=- | |
-Dsonar.cpp.file.suffixes=- | |
-Dsonar.objc.file.suffixes=- | |
- name: Send coverage | |
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}} | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: profile.cov |