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