Skip to content

Commit

Permalink
Optimize Go version matrix strategy for CI workflow (#17)
Browse files Browse the repository at this point in the history
Before the CI workflow used a matrix strategy to run the `lint-go` and
`test` jobs, but this was improved to make the workflow run faster by
avoiding unnecessary steps:

- The `lint-go` job has been changed to only run on the currently latest
  stable Go version `1.15.x` [1] only on Linux because `golangci-lint`
  doesn't care about the Go version and OS it runs on but only
  statically checks the source code.
- The `test` job has been changed to only run on the currently latest
  stable Go version `1.15.x` [1].

These changes also help to keep the required GitHub Action run minutes
for the account of this repository as small as possible without wasting
resources for unnecessary tasks.

[1]: https://golang.org/doc/go1.15

Resolves GH-16
  • Loading branch information
svengreb committed Sep 25, 2020
1 parent 9d50ec0 commit bda13d8
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ jobs:
- name: Run linters
run: yarn lint
lint-go:
strategy:
matrix:
# Use the official Go version policy and run for the latest three major version releases.
# See https://golang.org/doc/devel/release.html#policy for more details.
go-version: [1.13.x, 1.14.x, 1.15.x]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Print metadata and context information
run: |
Expand All @@ -42,6 +36,10 @@ jobs:
echo "Workflow Actor: $GITHUB_ACTOR"
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.15.x"
- name: "Run golangci-lint"
# The official golangci-lint action created and maintained by the golangci-lint project.
# See https://github.com/golangci/golangci-lint-action for more details.
Expand All @@ -51,9 +49,7 @@ jobs:
test:
strategy:
matrix:
# Use the official Go version policy and run for the latest three major version releases.
# See https://golang.org/doc/devel/release.html#policy for more details.
go-version: [1.13.x, 1.14.x, 1.15.x]
go-version: ["1.15.x"]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs:
Expand Down

0 comments on commit bda13d8

Please sign in to comment.