From aa330fc7b9c6a7f43e3cf3bfb754f2e0e37875dd Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 12:57:11 +0000 Subject: github: Rename workflow to reflect reality --- .github/workflows/checks.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++ .github/workflows/push.yml | 63 -------------------------------------------- 2 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/checks.yml delete mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..ce17f94 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,63 @@ +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 + 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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - name: Install Go + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version: 1.18 + - name: Go test + run: | + go test ./... -race + + fmt_and_vet: + name: "fmt and lint" + runs-on: ubuntu-latest + + steps: + - name: "Fetch source code" + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - name: Install Go + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version: 1.18 + - name: "Check vet" + run: | + go vet ./... + - name: "Check fmt" + run: | + go fmt ./... + if [[ -z "$(git status --porcelain)" ]]; then + echo "Formatting is consistent with 'go fmt'." + else + echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages." + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index a16f7b6..0000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Per-commit 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 - 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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Install Go - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 - with: - go-version: 1.18 - - name: Go test - run: | - go test ./... -race - - fmt_and_vet: - name: "fmt and lint" - runs-on: ubuntu-latest - - steps: - - name: "Fetch source code" - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Install Go - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 - with: - go-version: 1.18 - - name: "Check vet" - run: | - go vet ./... - - name: "Check fmt" - run: | - go fmt ./... - if [[ -z "$(git status --porcelain)" ]]; then - echo "Formatting is consistent with 'go fmt'." - else - echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages." - git status --porcelain - exit 1 - fi -- cgit v1.2.3 From 82351cc777eb4118a8ad348b9a7da831a4a2fa1d Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 12:57:36 +0000 Subject: github: Run unit tests on macos/amd64 as well --- .github/workflows/checks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ce17f94..4842b6e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,6 +14,8 @@ jobs: 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 }}" -- cgit v1.2.3 From 97cf603f3cadfdcd5b472e55e2576ad22e971b17 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 13:04:28 +0000 Subject: github: Read Go version from go.mod This reduces the number of places to update whenever we upgrade Go version. --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4842b6e..6aaa038 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -34,7 +34,7 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: 1.18 + go-version-file: go.mod - name: Go test run: | go test ./... -race @@ -49,7 +49,7 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: 1.18 + go-version-file: go.mod - name: "Check vet" run: | go vet ./... -- cgit v1.2.3