Merge pull request #8 from YaoApp/create-pull-request/patch-p0enjn5 #25
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Tests on ${{ matrix.go-version }} ${{ matrix.platform }} | |
strategy: | |
matrix: | |
go-version: [1.18.10, 1.19.5] | |
platform: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Go Test | |
env: | |
CGO_CXXFLAGS: "-Werror" | |
run: go test -v -coverprofile c.out ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
env: | |
OS: ${{ matrix.platform }} | |
GO: ${{ matrix.go-version }} | |
with: | |
files: ./c.out | |
env_vars: OS,GO | |
- name: Add GOPATH to GITHUB_ENV | |
run: echo "GOPATH=$(go env GOPATH)" >>"$GITHUB_ENV" | |
- name: Scan and upload FOSSA data (Linux/Mac) | |
if: env.FOSSA_API_KEY != '' && github.ref == 'refs/heads/master' | |
run: | | |
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash | |
fossa analyze | |
env: | |
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} |