nextcloud-spreed-signaling/.github/workflows/test.yml
Joachim Bauch a34f3b6093
No longer support Golang 1.17.
While it might still compile with 1.17, it's no longer tested through CI
and at some point, features that require 1.18 will be used.
2023-02-22 08:19:30 +01:00

103 lines
2.5 KiB
YAML

name: test
on:
push:
branches: [ master ]
paths:
- '.github/workflows/test.yml'
- '**.go'
- 'go.*'
- 'Makefile'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/test.yml'
- '**.go'
- 'go.*'
- 'Makefile'
permissions:
contents: read
jobs:
go:
env:
MAXMIND_GEOLITE2_LICENSE: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
strategy:
matrix:
go-version:
- "1.18"
- "1.19"
- "1.20"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- 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
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install protobuf-compiler
- name: Build applications
run: |
echo "Building with $(nproc) threads"
make client -j$(nproc)
make proxy -j$(nproc)
make server -j$(nproc)
- name: Run tests
run: |
make test TIMEOUT=120s
- name: Generate coverage report
run: |
make cover TIMEOUT=120s
echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.9
with:
infile: cover.out
outfile: cover.lcov
- name: Coveralls Parallel
uses: coverallsapp/github-action@1.1.3
env:
COVERALLS_FLAG_NAME: run-${{ matrix.go-version }}
with:
path-to-lcov: cover.lcov
github-token: ${{ secrets.github_token }}
parallel: true
finish:
permissions:
contents: none
needs: go
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true