aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/checks.yaml
blob: 3b2c9a82c3d69efb738da7c1070726aed064c6c4 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SPDX-FileCopyrightText: 2025 Stefan Majewsky <majewsky@gmx.net>
# SPDX-License-Identifier: Apache-2.0

name: Checks
"on":
  push:
    branches: [ main ]
  pull_request:
    branches: [ '*' ]
  workflow_dispatch: {}
permissions:
  checks: write
  contents: read
jobs:
  checks:
    name: Checks
    runs-on: ubuntu-latest
    steps:

      ####################
      ### Setup Phase

      - name: Check out code
        uses: actions/checkout@v6
      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version: stable

      ####################
      # Static Tests

      - name: Run golangci-lint
        uses: golangci/golangci-lint-action@v9
        with:
          version: latest
      - name: REUSE Compliance Check
        uses: fsfe/reuse-action@v6

      ####################
      # Test Suite

      - name: Run tests
        run: mkdir -p build && go test -shuffle=on -coverprofile=build/cover.out -covermode=count ./...
      - name: Archive code coverage results
        uses: actions/upload-artifact@v7
        with:
          name: code-coverage
          path: build/cover.out

  code_coverage:
    name: Code coverage report
    if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
    needs: [ checks ]
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      pull-requests: write
    steps:
      - name: Check out code
        uses: actions/checkout@v6
      - name: Post coverage report
        uses: fgrosse/go-coverage-report@v1.3.0
        with:
          coverage-artifact-name: code-coverage
          coverage-file-name: cover.out