Skip to content

Commit

Permalink
Merge pull request #1 from fgrosse/ci
Browse files Browse the repository at this point in the history
Add GitHub Action to run unit tests and test the action
  • Loading branch information
fgrosse authored Mar 16, 2024
2 parents 9b88be1 + d6a9f72 commit bb517fe
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- 'main'

jobs:
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22

- name: Test
run: go test -cover -coverprofile=coverage.txt -mod=readonly ./...

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt

code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: unit_tests
steps:
- uses: fgrosse/go-coverage-report@${{ github.ref }}
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"

0 comments on commit bb517fe

Please sign in to comment.