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-10 09:08:04 +01:00
|
|
|
golangci:
|
|
|
|
name: lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-14 13:10:28 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-10 09:08:04 +01:00
|
|
|
- name: golangci-lint
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2021-05-10 09:08:04 +01:00
|
|
|
with:
|
|
|
|
version: latest
|
2021-05-31 09:40:47 +01:00
|
|
|
test:
|
|
|
|
needs: [golangci]
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go_version:
|
|
|
|
- '1.16'
|
2021-09-02 13:59:49 +01:00
|
|
|
- '1.17'
|
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
|
2021-05-31 09:40:47 +01:00
|
|
|
- uses: actions/cache@v2
|
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-
|
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:
|
2021-09-02 13:59:49 +01:00
|
|
|
go-version: '1.17'
|
2020-03-26 21:43:52 +00:00
|
|
|
- name: Checkout Source
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-05-31 09:40:47 +01:00
|
|
|
- uses: actions/cache@v2
|
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
|
2021-07-27 21:04:29 +01:00
|
|
|
uses: codecov/codecov-action@v2
|
2020-03-26 21:43:52 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
fail_ci_if_error: true
|