2020-07-31 12:25:24 +02:00
|
|
|
name: test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
2022-04-04 16:12:33 +02:00
|
|
|
paths:
|
2022-05-12 09:49:35 +02:00
|
|
|
- '.github/workflows/test.yml'
|
2022-04-04 16:12:33 +02:00
|
|
|
- '**.go'
|
|
|
|
- 'go.*'
|
|
|
|
- 'Makefile'
|
2020-07-31 12:25:24 +02:00
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
2022-04-04 16:12:33 +02:00
|
|
|
paths:
|
2022-05-12 09:49:35 +02:00
|
|
|
- '.github/workflows/test.yml'
|
2022-04-04 16:12:33 +02:00
|
|
|
- '**.go'
|
|
|
|
- 'go.*'
|
|
|
|
- 'Makefile'
|
2020-07-31 12:25:24 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
go:
|
2020-08-13 14:03:16 +02:00
|
|
|
env:
|
|
|
|
MAXMIND_GEOLITE2_LICENSE: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
|
2020-07-31 12:25:24 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version:
|
2021-09-14 13:58:13 +02:00
|
|
|
- "1.17"
|
2022-03-17 09:26:15 +01:00
|
|
|
- "1.18"
|
2020-07-31 12:25:24 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 14:10:28 +01:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-08 22:11:32 +02:00
|
|
|
- uses: actions/setup-go@v3
|
2020-07-31 12:25:24 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
2022-04-05 10:32:03 +02:00
|
|
|
- id: go-cache-paths
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
echo "::set-output name=go-version::$(go version | cut -d ' ' -f 3)"
|
|
|
|
|
|
|
|
- name: Go build cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
|
|
key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-build-${{ hashFiles('**/go.mod', '**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Go mod cache
|
2022-03-21 21:11:35 +01:00
|
|
|
uses: actions/cache@v3
|
2020-07-31 12:25:24 +02:00
|
|
|
with:
|
2022-04-05 10:32:03 +02:00
|
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
|
|
key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }}
|
2020-07-31 12:25:24 +02:00
|
|
|
|
2022-06-21 16:04:40 +02:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt -y update && sudo apt -y install protobuf-compiler
|
|
|
|
|
2020-07-31 12:25:24 +02:00
|
|
|
- name: Build applications
|
|
|
|
run: |
|
2021-01-05 08:58:53 +01:00
|
|
|
echo "Building with $(nproc) threads"
|
|
|
|
make client -j$(nproc)
|
|
|
|
make proxy -j$(nproc)
|
|
|
|
make server -j$(nproc)
|
2020-07-31 12:25:24 +02:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2022-07-08 08:33:57 +02:00
|
|
|
make test
|
2020-07-31 12:25:24 +02:00
|
|
|
|
|
|
|
- name: Generate coverage report
|
|
|
|
run: |
|
2022-07-08 08:33:57 +02:00
|
|
|
make cover
|
2022-05-13 10:07:50 +02:00
|
|
|
echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
|
2020-07-31 16:33:20 +02:00
|
|
|
|
|
|
|
- name: Convert coverage to lcov
|
2022-05-23 22:25:24 +02:00
|
|
|
uses: jandelgado/gcov2lcov-action@v1.0.9
|
2020-07-31 16:33:20 +02:00
|
|
|
with:
|
2022-05-13 10:07:50 +02:00
|
|
|
infile: cover.out
|
|
|
|
outfile: cover.lcov
|
2020-07-31 16:33:20 +02:00
|
|
|
|
|
|
|
- name: Coveralls Parallel
|
2021-07-07 11:28:24 +02:00
|
|
|
uses: coverallsapp/github-action@1.1.3
|
2020-07-31 16:42:04 +02:00
|
|
|
env:
|
|
|
|
COVERALLS_FLAG_NAME: run-${{ matrix.go-version }}
|
2020-07-31 16:33:20 +02:00
|
|
|
with:
|
|
|
|
path-to-lcov: cover.lcov
|
|
|
|
github-token: ${{ secrets.github_token }}
|
|
|
|
parallel: true
|
|
|
|
|
|
|
|
finish:
|
|
|
|
needs: go
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Coveralls Finished
|
2021-07-07 11:28:24 +02:00
|
|
|
uses: coverallsapp/github-action@1.1.3
|
2020-07-31 16:33:20 +02:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.github_token }}
|
|
|
|
parallel-finished: true
|