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:
|
|
|
|
go_version:
|
2023-01-09 15:49:02 +00:00
|
|
|
- '1.18.9' # TODO: remove this once actions/setup-go@v3 uses latest as latest; see https://github.com/securego/gosec/pull/880
|
|
|
|
- '1.19.4' # TODO: remove this once actions/setup-go@v3 uses latest as latest; see https://github.com/securego/gosec/pull/880
|
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:
|
2021-05-31 09:40:47 +01:00
|
|
|
- name: Setup go ${{ matrix.go_version }}
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-03-30 12:15:21 +01:00
|
|
|
with:
|
2021-05-31 09:40:47 +01:00
|
|
|
go-version: ${{ matrix.go_version }}
|
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:
|
|
|
|
version: latest
|
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-01-09 15:49:02 +00:00
|
|
|
go-version: '1.19.4' # TODO: remove this once actions/setup-go@v3 uses latest as latest; see https://github.com/securego/gosec/pull/880
|
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
|