Debian Codegraph @

.github/workflows/test.yaml

raw
1 name: Run tests and upload coverage
2
3 on:
4 workflow_call:
5 pull_request:
6 branches: [main]
7 paths:
8 - shoutrrr/**
9 - pkg/**
10 - internal/**
11 - shoutrrr.go
12 - go.mod
13 - go.sum
14
15 permissions:
16 contents: read # Set default read-only permissions
17
18 jobs:
19 test:
20 name: Run Tests and Upload Coverage Report
21 runs-on: ${{ matrix.platform }}
22 strategy:
23 fail-fast: false
24 matrix:
25 platform:
26 - macos-latest
27 - windows-2025
28 - ubuntu-latest
29 steps:
30 - name: Harden the Runner (Step Security)
31 uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
32 with:
33 egress-policy: audit
34
35 - name: Checkout Repo
36 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37 with:
38 fetch-depth: 0
39 persist-credentials: false
40
41 - name: Setup Go
42 uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
43 with:
44 cache: true
45 cache-dependency-path: "**/go.sum"
46 go-version-file: go.mod
47
48 - name: Install Dependencies
49 run: go mod download
50
51 - name: Run Tests
52 shell: bash
53 run: |
54 go list ./... | grep -vE '/testing/e2e(/|$)' | xargs go test -v -coverprofile coverage.out -covermode atomic
55
56 - name: Upload Coverage Report to Codecov
57 uses: codecov/codecov-action@0b35c9ecc4f0529d0eb674914510c22f85b196b4 # v7.1.0
58 with:
59 token: ${{ secrets.CODECOV_TOKEN }}