From e603ba0863d0a7dfa2bff95c734649181062645c Mon Sep 17 00:00:00 2001 From: Evan Sims Date: Wed, 3 Apr 2024 21:07:07 -0500 Subject: [PATCH] chore(ci): add code coverage support --- .codecov.yml | 4 ++++ .github/workflows/main.yaml | 43 +++++++++++++++++++++---------------- .openapi-generator/FILES | 1 + 3 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..0385c10 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,4 @@ +coverage: + precision: 2 + range: "60...80" + round: down diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index dd09e75..8b6002b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -10,27 +10,34 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.5.4 - with: - fetch-depth: 0 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + 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.21.1" - - 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 @@ -38,11 +45,11 @@ jobs: needs: [test] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.5.4 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 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: diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bff5b34..8a869a1 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.codecov.yml .fossa.yml .github/CODEOWNERS .github/ISSUE_TEMPLATE/bug_report.yaml