Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize GitHub action workflows for Go and Node
Before all jobs were summarized in the `ci` workflow [1] but not separated by their scope, i.e. Go and Node specific tasks. The workflow was also not optimized to only run when specific files have been changed which resulted in false-positive executions and wasted limited free tier and developer time. Therefore the `ci` workflow has been optimized by splitting it into new `ci-go` and `ci-node` workflows. >> CI Go The new `ci-go` workflow... - only runs when any `*.go` file has been modified. See the extensive GitHub action documentations about `on.<push|pull_request>.paths` [4] and the filter pattern cheat sheet [5] for more details. - only runs for `ubuntu-latest` instead of a matrix with `macos-latest` and `windows-latest` which should be added for projects with platform specific code. >> CI Node The new `ci-node` workflow... - only runs when any `*.js`, `*.json`, `*.md`, `*.yaml` and `*.yml` file has been modified. This matches the lint-staged [2], Prettier and remark configurations. See the extensive GitHub action documentations about `on.<push|pull_request>.paths` [4] and the filter pattern cheat sheet [5] for more details. - only runs for `ubuntu-latest` instead of a matrix with `macos-latest` and `windows-latest` which should be added for projects with platform specific code. - uses cache `npm` dependencies which is possible as of `actions/[email protected]` [3]. >> Silent linting errors for CI/CD environments When running the configured linting tasks [6] the Prettier CLI [7] prints matches to the standard output with a visual preview of the file content and a marker at the specific element. When files that store secret data, e.g. when encrypted with `git-crypt` [8], are decrypted in the GitHub Actions [9] this could leak this data when Prettier finds errors in these files. To prevent these case new CI specific linting tasks have been added with a `silent` `loglevel` [10]. This however comes with the drawback that possible linting errors must be analyzed locally, but the code quality is still ensured by blocking subsequent workflows. [1]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/.github/workflows/ci.yml [2]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/lint-staged.config.js#L12 [3]: https://github.com/actions/setup-node/releases/tag/v2.2.0 [4]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths [5]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [6]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/package.json#L28 [7]: https://prettier.io/docs/en/cli.html [8]: svengreb/antarctica#170 [9]: https://github.com/svengreb/antarctica/blob/0e6abe44/.github/workflows/ci-go.yaml#L29-L32 [10]: https://prettier.io/docs/en/cli.html#--loglevel GH-68
- Loading branch information