Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests.yml #2

Open
wants to merge 1 commit into
base: trunk-latest-sync
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,52 @@ on:
branches:
- develop
pull_request:
branches:
- develop

jobs:
test:
name: Test
name: Test on Go ${{ matrix.go-version }}
runs-on: ubuntu-latest

strategy:
matrix:
go-version: [1.20, 1.21, 1.22]

steps:
- name: Checkout sources
id: checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
id: setup-go
uses: actions/setup-go@v4
with:
go-version: ^1.22
id: go
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
id: cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-

- name: Checkout sources
uses: actions/checkout@v2
- name: Install dependencies
id: install-dependencies
run: go mod download

- name: Run unit tests and generate the coverage report
run: make test-coverage
id: test
run: go test -coverprofile=coverage-${{ matrix.go-version }}.out -json > TestResults-${{ matrix.go-version }}.json

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
id: upload-coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.out
files: coverage-${{ matrix.go-version }}.out
verbose: false
flags: unittests
flags: unittests-${{ matrix.go-version }}
Loading