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:
|
2024-05-12 10:35:01 +01:00
|
|
|
version: [{go: '1.21.10', golangci: 'latest'}, {go: '1.22.3', 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 }}
|
2023-12-11 00:29:44 +00:00
|
|
|
uses: actions/setup-go@v5
|
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
|
2023-09-11 09:53:32 +01:00
|
|
|
uses: actions/checkout@v4
|
2024-01-22 01:36:12 +00:00
|
|
|
- uses: actions/cache@v4
|
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
|
2024-05-13 01:23:24 +01:00
|
|
|
uses: golangci/golangci-lint-action@v6
|
2022-03-14 13:19:29 +00:00
|
|
|
with:
|
2023-02-08 09:40:36 +00:00
|
|
|
version: ${{ matrix.version.golangci }}
|
|
|
|
- name: Run Gosec Security Scanner
|
|
|
|
uses: securego/gosec@master
|
|
|
|
with:
|
|
|
|
args: ./...
|
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
|
2023-12-11 00:29:44 +00:00
|
|
|
uses: actions/setup-go@v5
|
2021-05-31 09:40:47 +01:00
|
|
|
with:
|
2024-05-12 10:35:01 +01:00
|
|
|
go-version: '1.22.3'
|
2020-03-26 21:43:52 +00:00
|
|
|
- name: Checkout Source
|
2023-09-11 09:53:32 +01:00
|
|
|
uses: actions/checkout@v4
|
2024-01-22 01:36:12 +00:00
|
|
|
- uses: actions/cache@v4
|
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
|
2024-02-05 01:32:00 +00:00
|
|
|
uses: codecov/codecov-action@v4
|
2020-03-26 21:43:52 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
fail_ci_if_error: true
|