Logic screw- #50
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: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Tests on ${{ matrix.os }} ${{ matrix.arch }} with Go ${{ matrix.go-version }} | |
strategy: | |
matrix: | |
os: [darwin, linux] | |
arch: [x86_64] | |
go-version: | |
# Check the earliest and two trailing versions, to keep | |
# maintainance of this file reasonable. | |
- 1.17 | |
- oldstable | |
- stable | |
include: | |
- os: linux | |
platform: ubuntu-latest | |
- os: darwin | |
platform: macos-latest | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Add GOPATH to GITHUB_ENV | |
run: echo "GOPATH=$(go env GOPATH)" >>"$GITHUB_ENV" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Tests With Coverage | |
run: go test -v -coverprofile coverage.out ./... | |
env: | |
CGO_CXXFLAGS: "-Werror" | |
- name: Upload Coverage To Codecov | |
uses: codecov/codecov-action@v3 | |
if: env._CODECOV_TOKEN != '' | |
env: | |
_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }} | |
OS: ${{ matrix.os }} | |
ARCH: ${{ matrix.arch }} | |
PLATFORM: ${{ matrix.platform }} | |
GO: ${{ matrix.go-version }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.out | |
flags: unittests | |
fail_ci_if_error: true | |
env_vars: OS,ARCH,PLATFORM,GO | |
- name: Scan and Upload FOSSA Data | |
if: env.FOSSA_API_KEY != '' && github.ref == 'refs/heads/master' | |
run: | | |
curl https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash | |
fossa analyze | |
env: | |
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} |