Skip to content

Commit

Permalink
chore(ci): add code coverage support
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Apr 4, 2024
1 parent d610bb2 commit a989344
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
precision: 2
range: "60...80"
round: down
43 changes: 25 additions & 18 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,46 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.5.4
with:
fetch-depth: 0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
cache-dependency-path: './go.sum'
check-latest: true
go-version: '>=1.21.1'
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
cache-dependency-path: "./go.sum"
check-latest: true
go-version: ">=1.22.2"

- name: Build
run: go build -v ./...
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
- name: Test
run: go test -cover -v ./...

- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run govulncheck
run: govulncheck ./...
- name: Run govulncheck
run: govulncheck ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: openfga/go-sdk

create-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [test]

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.5.4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803
- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1
with:
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
env:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/semgrep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
image: returntocorp/semgrep
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
- run: semgrep ci --no-suppress-errors
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- run: semgrep ci --no-suppress-errors
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
1 change: 1 addition & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.codecov.yml
.fossa.yml
.github/CODEOWNERS
.github/ISSUE_TEMPLATE/bug_report.yaml
Expand Down

0 comments on commit a989344

Please sign in to comment.