-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (45 loc) · 1.55 KB
/
test.yml
File metadata and controls
54 lines (45 loc) · 1.55 KB
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
47
48
49
50
51
52
53
54
# SPDX-FileCopyrightText: 2025 itiquette/git-provider-sync
#
# SPDX-License-Identifier: CC0-1.0
---
name: Golang Test
on: [workflow_call] # yamllint disable-line rule:truthy
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Harden GitHub runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "stable"
cache: false
- name: Go test run
run: |
go mod tidy
# shellcheck disable=SC2046
go test -count=1 $(go list './...' | grep -v generated) -v -coverprofile=coverage.txt
go tool cover -func=coverage.txt -o=coverage.out
# shellcheck disable=SC2002
# shellcheck disable=SC2086
echo "COVERAGE=$(cat coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+')" >> $GITHUB_ENV
# - name: Create Coverage Badge
# uses: schneegans/dynamic-badges-action@v1.7.0
# with:
# auth: ${{ secrets.GIST_SECRET }}
# gistID: 87d513c639cf65c02ecc31c1670cbcd1
# filename: go-coverage.json
# label: Coverage
# message: ${{ env.COVERAGE }}%
# color: purple