nextcloud-spreed-signaling/.github/workflows/test.yml

102 lines
2.5 KiB
YAML
Raw Normal View History

2020-07-31 12:25:24 +02:00
name: test
on:
push:
branches: [ master ]
paths:
- '.github/workflows/test.yml'
- '**.go'
- 'go.*'
- 'Makefile'
2020-07-31 12:25:24 +02:00
pull_request:
branches: [ master ]
paths:
- '.github/workflows/test.yml'
- '**.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:
env:
MAXMIND_GEOLITE2_LICENSE: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
2020-07-31 12:25:24 +02:00
strategy:
matrix:
go-version:
2022-08-03 16:24:23 +02:00
- "1.19"
2023-02-02 13:25:39 +01:00
- "1.20"
2020-07-31 12:25:24 +02:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
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 "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
echo "go-version=$(go version | cut -d ' ' -f 3)" >> $GITHUB_OUTPUT
2022-04-05 10:32:03 +02:00
- 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
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: |
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
echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
2020-07-31 16:33:20 +02:00
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.9
2020-07-31 16:33:20 +02:00
with:
infile: cover.out
outfile: cover.lcov
2020-07-31 16:33:20 +02:00
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2.2.0
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
uses: coverallsapp/github-action@v2.2.0
2020-07-31 16:33:20 +02:00
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true