Skip to content

Commit

Permalink
Optimize OS and Go version matrix strategy for CI workflow (#13)
Browse files Browse the repository at this point in the history
Before the CI workflow used a matrix strategy to run the `lint-node`,
`lint-go` and `test` jobs, but this also included steps that were not
necessary for this repository. This has been improved to make the
workflow run faster by avoiding unnecessary tasks:

- The `lint-node` job has been changed to only run on the currently
  latest stable Node version `14.x` [1] only on Linux because this
  repository is not focused on JavaScript but only runs Node based tools
  to lint other files within this repository.
- The `lint-go` job has been changed to only run on the currently latest
  stable Go version `1.15.x` [2] 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` [2] and only Linux and Windows while macOS
  is not necessary for this repository because there is no macOS
  specific code.

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://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V14.md#14.12.0
[2]: https://golang.org/doc/go1.15

Resolves GH-12
  • Loading branch information
svengreb authored Sep 24, 2020
1 parent d9268f0 commit 2fca9af
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on: [push]
jobs:
lint-node:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- name: Print metadata and context information
run: |
Expand All @@ -24,19 +21,13 @@ jobs:
- name: "Setup Node.js version ${{ matrix.node-version }}"
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: "14.x"
- name: Install Node modules
run: yarn --frozen-lockfile
- 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 @@ -45,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 @@ -54,10 +49,8 @@ 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]
os: [macos-latest, ubuntu-latest, windows-latest]
go-version: ["1.15.x"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs:
- lint-go
Expand Down

0 comments on commit 2fca9af

Please sign in to comment.