summaryrefslogtreecommitdiff
path: root/.github/workflows/checks.yml
blob: 75c1f98186bc55510a0ce765acf41459704fe375 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Checks

on:
  push:
  workflow_dispatch:
  pull_request:

jobs:
  unit_tests:
    strategy:
      matrix:
        include:
          - runs-on: ubuntu-latest
            target: linux_amd64
          - runs-on: windows-latest
            target: windows_amd64
          - runs-on: macos-latest
            target: darwin_amd64
      fail-fast: false

    name: "Unit Tests on ${{ matrix.target }}"
    runs-on: "${{ matrix.runs-on }}"
    steps:
      - name: "Disable git crlf conversions"
        if: ${{ runner.os == 'Windows' }}
        # HCL preserves the input line endings when processing a heredoc,
        # and our tests for heredocs are written to expect the result for
        # the source code as checked in to the repository, so git's normal
        # tampering with the line endings would invalidate those tests.
        run: |
          git config --global core.autocrlf false
      - name: "Fetch source code"
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
      - name: Install Go
        uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
        with:
          go-version-file: go.mod
      - name: Go test
        run: |
          go test ./... -race

  copyright:
    name: "copyright headers"
    runs-on: ubuntu-latest
    steps:
      - name: "Fetch source code"
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
      - name: Install Go
        uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
        with:
          go-version-file: go.mod
      - name: "copyright headers check"
        run: |
          make copyrightcheck

  govet:
    name: "go vet"
    runs-on: ubuntu-latest
    steps:
      - name: "Fetch source code"
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
      - name: Install Go
        uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
        with:
          go-version-file: go.mod
      - name: "go vet"
        run: |
          make vetcheck

  gofmt:
    name: "gofmt"
    runs-on: ubuntu-latest
    steps:
      - name: "Fetch source code"
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
      - name: Install Go
        uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
        with:
          go-version-file: go.mod
      - name: "gofmt"
        run: |
          make fmtcheck