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
|
|
|
|
2023-01-17 11:29:54 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
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:
|
2023-02-02 13:25:39 +01:00
|
|
|
- "1.20"
|
2023-08-09 09:00:46 +02:00
|
|
|
- "1.21"
|
2020-07-31 12:25:24 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 22:25:17 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-06 21:59:16 +01:00
|
|
|
- uses: actions/setup-go@v5
|
2020-07-31 12:25:24 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
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: |
|
2023-01-17 15:15:00 +01:00
|
|
|
make test TIMEOUT=120s
|
2020-07-31 12:25:24 +02:00
|
|
|
|
|
|
|
- name: Generate coverage report
|
|
|
|
run: |
|
2023-01-17 15:15:00 +01:00
|
|
|
make cover TIMEOUT=120s
|
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
|
2023-09-07 22:10:38 +02:00
|
|
|
uses: coverallsapp/github-action@v2.2.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:
|
2023-01-17 11:29:54 +01:00
|
|
|
permissions:
|
|
|
|
contents: none
|
2020-07-31 16:33:20 +02:00
|
|
|
needs: go
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Coveralls Finished
|
2023-09-07 22:10:38 +02:00
|
|
|
uses: coverallsapp/github-action@v2.2.3
|
2020-07-31 16:33:20 +02:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.github_token }}
|
|
|
|
parallel-finished: true
|