Skip to content

Commit

Permalink
Merge pull request #3 from Shopify/jade/workflows
Browse files Browse the repository at this point in the history
Enable code coverage
  • Loading branch information
chrispappas authored May 11, 2022
2 parents a41b1e7 + 2d82b03 commit 044e6cb
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
go-version: ${{ matrix.version }}

test:
permissions:
contents: read
issues: write
pull-requests: write
needs: ["deps"]
strategy:
matrix:
Expand All @@ -31,23 +35,27 @@ jobs:
uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.version }}
- name: Main branch coverage
uses: actions/cache@v3
if: matrix.version == '1.18.1'
with:
path: |
main.lcov
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-refs/heads/main-
- name: Test and Bench
run: go test -v -bench=. ./...

build:
needs: ["deps"]
strategy:
matrix:
version: ['1.18.0', '1.18.1']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: ./.github/actions/setup-go
run: go test -v -coverprofile coverage.out -bench -race ./...
- uses: jandelgado/[email protected]
if: matrix.version == '1.18.1'
- name: Store main branch lcov
if: github.ref == 'refs/heads/main' && matrix.version == '1.18.1'
run: cp coverage.lcov main.lcov
- name: Code Coverage Report
uses: osmind-development-org/[email protected]
if: matrix.version == '1.18.1' && github.event_name == 'pull_request'
with:
go-version: ${{ matrix.version }}

- name: Build and Run
run: |
go build
go run ./main.go
lcov-file: ./coverage.lcov
lcov-base: ./main.lcov
delete-old-comments: true
github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 044e6cb

Please sign in to comment.