2020-04-09 12:01:40 +01:00
|
|
|
name: CI
|
2020-03-26 21:43:52 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
2021-05-31 09:40:47 +01:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-02-06 13:15:05 +00:00
|
|
|
version: [{go: '1.19.5', golangci: 'v1.50.1'}, {go: '1.20', golangci: 'latest'}]
|
2020-03-30 11:59:02 +01:00
|
|
|
runs-on: ubuntu-latest
|
2020-03-26 21:43:52 +00:00
|
|
|
env:
|
2020-03-30 11:52:42 +01:00
|
|
|
GO111MODULE: on
|
2020-03-26 21:43:52 +00:00
|
|
|
steps:
|
2023-02-06 13:15:05 +00:00
|
|
|
- name: Setup go ${{ matrix.version.go }}
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-03-30 12:15:21 +01:00
|
|
|
with:
|
2023-02-06 13:15:05 +00:00
|
|
|
go-version: ${{ matrix.version.go }}
|
2020-03-30 12:15:21 +01:00
|
|
|
- name: Checkout Source
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-28 19:23:59 +01:00
|
|
|
- uses: actions/cache@v3
|
2020-03-30 12:15:21 +01:00
|
|
|
with:
|
2021-05-31 09:40:47 +01:00
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2022-03-14 13:19:29 +00:00
|
|
|
- name: lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
|
|
|
with:
|
2023-02-06 13:15:05 +00:00
|
|
|
version: ${{ matrix.version.golangci }}
|
2020-03-30 12:15:21 +01:00
|
|
|
- name: Run Tests
|
2021-05-31 09:40:47 +01:00
|
|
|
run: make test
|
2020-03-26 21:43:52 +00:00
|
|
|
coverage:
|
2021-05-31 09:40:47 +01:00
|
|
|
needs: [test]
|
2020-03-26 21:43:52 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2020-03-30 11:52:42 +01:00
|
|
|
GO111MODULE: on
|
2020-03-26 21:43:52 +00:00
|
|
|
steps:
|
2021-05-31 09:40:47 +01:00
|
|
|
- name: Setup go
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/setup-go@v3
|
2021-05-31 09:40:47 +01:00
|
|
|
with:
|
2023-02-06 13:15:05 +00:00
|
|
|
go-version: '1.20'
|
2020-03-26 21:43:52 +00:00
|
|
|
- name: Checkout Source
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-28 19:23:59 +01:00
|
|
|
- uses: actions/cache@v3
|
2020-03-30 12:06:29 +01:00
|
|
|
with:
|
2021-05-31 09:40:47 +01:00
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Create Test Coverage
|
|
|
|
run: make test-coverage
|
2020-03-26 21:43:52 +00:00
|
|
|
- name: Upload Test Coverage
|
2022-04-11 19:12:37 +01:00
|
|
|
uses: codecov/codecov-action@v3
|
2020-03-26 21:43:52 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
fail_ci_if_error: true
|