-
Notifications
You must be signed in to change notification settings - Fork 10
46 lines (43 loc) · 1.33 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# This workflow runs on every push and pull request to the repository.
# It then calculates the unit test coverage and checks if it's above a certain threshold.
# this information is passed on to another workflow as artifacts for commenting on the PR.
# This is because the `pull_request` event does not have the commenting permissions.
# We could switch to `pull_request_target` which does have them, however, it
# opens a security hole. See:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Tests
on:
pull_request:
push:
branches:
- develop
- main
- master
- release/**
permissions:
# for uploading artifacts
contents: write
pull-requests: read
# Automatically cancel run if another commit to the same ref is detected.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-unit-cover:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Test and create coverage report
run: |
make test-unit-cover
if: env.GIT_DIFF