Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize GitHub action workflows for Go and Node #68

Closed
svengreb opened this issue Nov 20, 2021 · 0 comments · Fixed by #69
Closed

Optimize GitHub action workflows for Go and Node #68

svengreb opened this issue Nov 20, 2021 · 0 comments · Fixed by #69

Comments

@svengreb
Copy link
Owner

Currently all jobs are summarized in the ci workflow but not separated by their scope, i.e. Go and Node specific tasks. The workflow is also not optimized to only run when specific files have been changed which results in false-positive executions and wastes limited free tier and developer time.
Therefore the ci workflow will be optimized by splitting it into new ci-go and ci-node workflows.

CI Go

The new ci-go workflow will…

CI Node

The new ci-node workflow will…

Silent linting errors for CI/CD environments

When running the configured linting tasks the Prettier CLI 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, are decrypted in the GitHub Actions this could leak this data when Prettier finds errors in these files.
To prevent these case new CI specific linting tasks will be added with a silent loglevel. 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.

@svengreb svengreb added this to the Next milestone Nov 20, 2021
@svengreb svengreb self-assigned this Nov 20, 2021
svengreb added a commit that referenced this issue Nov 20, 2021
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/setup-node@v2.2.0` [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
svengreb added a commit that referenced this issue Nov 20, 2021
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/setup-node@v2.2.0` [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

Closes GH-68
@svengreb svengreb removed their assignment Nov 20, 2021
svengreb added a commit that referenced this issue Nov 20, 2021
Updated to `tmpl` version `0.10.0` [1] which comes with...

1. optimized GitHub action workflows for Go and Node [2] - this change
   has also already been resolved in GH-68 [5
   the `ci-go` GitHub Action workflow.
2. the regular Node package dependency & GitHub action version
   updates [3]
3. the migration to the Markdown style guide version `0.4.0` [4]

[1]: https://github.com/svengreb/tmpl/releases/tag/v0.10.0
[2]: svengreb/tmpl#84
[3]: svengreb/tmpl#86
[4]: svengreb/tmpl#76
[5]: #68

GH-70
svengreb added a commit that referenced this issue Nov 20, 2021
Updated to `tmpl` version `0.10.0` [1] which comes with...

1. optimized GitHub action workflows for Go and Node [2] - this change
   has also already been resolved in GH-68 [5
   the `ci-go` GitHub Action workflow.
2. the regular Node package dependency & GitHub action version
   updates [3]
3. the migration to the Markdown style guide version `0.4.0` [4]

[1]: https://github.com/svengreb/tmpl/releases/tag/v0.10.0
[2]: svengreb/tmpl#84
[3]: svengreb/tmpl#86
[4]: svengreb/tmpl#76
[5]: #68

Closes GH-70
svengreb added a commit to svengreb/wand that referenced this issue Nov 20, 2021
Updated to `tmpl-go` version `0.9.0` [1] which...

1. updated to `golangci-lint` version `1.43.0` [2] - new linters are
   introduced and configurations of already supported ones are improved
   or added.
2. updated the Go module to Go `1.17` [3].
3. optimized the GitHub action workflows for Go and Node [4] - the `ci`
   workflow has been optimized by splitting it into new `ci-go` and
   `ci-node` workflows.
4. updated to the `tmpl` template repository version `0.10.0` [5].

See the full `tmpl-go` version `0.9.0` changelog [1] for all details.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.9.0
[2]: svengreb/tmpl-go#64
[3]: svengreb/tmpl-go#66
[4]: svengreb/tmpl-go#68
[5]: svengreb/tmpl-go#70

GH-104
svengreb added a commit to svengreb/wand that referenced this issue Nov 20, 2021
Updated to `tmpl-go` version `0.9.0` [1] which...

1. updated to `golangci-lint` version `1.43.0` [2] - new linters are
   introduced and configurations of already supported ones are improved
   or added.
2. updated the Go module to Go `1.17` [3].
3. optimized the GitHub action workflows for Go and Node [4] - the `ci`
   workflow has been optimized by splitting it into new `ci-go` and
   `ci-node` workflows.
4. updated to the `tmpl` template repository version `0.10.0` [5].

See the full `tmpl-go` version `0.9.0` changelog [1] for all details.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.9.0
[2]: svengreb/tmpl-go#64
[3]: svengreb/tmpl-go#66
[4]: svengreb/tmpl-go#68
[5]: svengreb/tmpl-go#70

Closes GH-104
svengreb added a commit to svengreb/nib that referenced this issue May 9, 2022
Updated to `tmpl-go` version 0.12.0 [1], including the versions in
between starting from 0.7.0 [3]:

1. Updated to Go 1.17 [4].
2. Updated to golangci-lint `v1.43.0` [5].
3. Updated to `tmpl` template repository version `0.11.0` [6].
4. Optimized GitHub action workflows for Go and Node [7].
5. Disabled golangci-lint's default excluded issues [8].
6. Introduced Go dependency caching and build outputs in `ci-go`
   workflow [9].
7. Disabled revive linter rule `package-comments` [10].
8. Fixed golangci-lint fail to run due to `revives` unknown `time-equal`
   rule [11].
9. updated Node.js packages & GitHub actions [12].

This also included changes required for any linter matches.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.12.0
[3]: https://github.com/svengreb/tmpl-go/releases/tag/v0.7.0
[4]: svengreb/tmpl-go#66
[5]: svengreb/tmpl-go#64
[6]: svengreb/tmpl-go#91
[7]: svengreb/tmpl-go#68
[8]: svengreb/tmpl-go#72
[9]: svengreb/tmpl-go#74
[10]: svengreb/tmpl-go#78
[11]: svengreb/tmpl-go#76
[12]: svengreb/tmpl-go#42

GH-62
svengreb added a commit to svengreb/nib that referenced this issue May 9, 2022
Updated to `tmpl-go` version 0.12.0 [1], including the versions in
between starting from 0.7.0 [3]:

1. Updated to Go 1.17 [4].
2. Updated to golangci-lint `v1.43.0` [5].
3. Updated to `tmpl` template repository version `0.11.0` [6].
4. Optimized GitHub action workflows for Go and Node [7].
5. Disabled golangci-lint's default excluded issues [8].
6. Introduced Go dependency caching and build outputs in `ci-go`
   workflow [9].
7. Disabled revive linter rule `package-comments` [10].
8. Fixed golangci-lint fail to run due to `revives` unknown `time-equal`
   rule [11].
9. updated Node.js packages & GitHub actions [12].

This also included changes required for any linter matches.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.12.0
[3]: https://github.com/svengreb/tmpl-go/releases/tag/v0.7.0
[4]: svengreb/tmpl-go#66
[5]: svengreb/tmpl-go#64
[6]: svengreb/tmpl-go#91
[7]: svengreb/tmpl-go#68
[8]: svengreb/tmpl-go#72
[9]: svengreb/tmpl-go#74
[10]: svengreb/tmpl-go#78
[11]: svengreb/tmpl-go#76
[12]: svengreb/tmpl-go#42

GH-62
svengreb added a commit to svengreb/nib that referenced this issue May 9, 2022
Updated to `tmpl-go` version 0.12.0 [1], including the versions in
between starting from 0.7.0 [3]:

1. Updated to Go 1.17 [4].
2. Updated to golangci-lint `v1.43.0` [5].
3. Updated to `tmpl` template repository version `0.11.0` [6].
4. Optimized GitHub action workflows for Go and Node [7].
5. Disabled golangci-lint's default excluded issues [8].
6. Introduced Go dependency caching and build outputs in `ci-go`
   workflow [9].
7. Disabled revive linter rule `package-comments` [10].
8. Fixed golangci-lint fail to run due to `revives` unknown `time-equal`
   rule [11].
9. updated Node.js packages & GitHub actions [12].

This also included changes required for any linter matches.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.12.0
[3]: https://github.com/svengreb/tmpl-go/releases/tag/v0.7.0
[4]: svengreb/tmpl-go#66
[5]: svengreb/tmpl-go#64
[6]: svengreb/tmpl-go#91
[7]: svengreb/tmpl-go#68
[8]: svengreb/tmpl-go#72
[9]: svengreb/tmpl-go#74
[10]: svengreb/tmpl-go#78
[11]: svengreb/tmpl-go#76
[12]: svengreb/tmpl-go#42

GH-62
svengreb added a commit to svengreb/golib that referenced this issue May 10, 2022
Updated to `tmpl-go` version `0.12.0` [1], including the versions in
between starting from 0.7.0 [3]:

1. Updated to Go 1.17 [4].
2. Updated to golangci-lint `v1.43.0` [5].
3. Updated to `tmpl` template repository version `0.11.0` [6].
4. Optimized GitHub action workflows for Go and Node [7].
5. Disabled golangci-lint's default excluded issues [8].
6. Introduced Go dependency caching and build outputs in `ci-go`
   workflow [9].
7. Disabled revive linter rule `package-comments` [10].
8. Fixed golangci-lint fail to run due to `revives` unknown `time-equal`
   rule [11].
9. Updated Node.js packages & GitHub actions [12].

This also includes changes required for any linter matches.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.12.0
[3]: https://github.com/svengreb/tmpl-go/releases/tag/v0.7.0
[4]: svengreb/tmpl-go#66
[5]: svengreb/tmpl-go#64
[6]: svengreb/tmpl-go#91
[7]: svengreb/tmpl-go#68
[8]: svengreb/tmpl-go#72
[9]: svengreb/tmpl-go#74
[10]: svengreb/tmpl-go#78
[11]: svengreb/tmpl-go#76
[12]: svengreb/tmpl-go#42

GH-41
svengreb added a commit to svengreb/golib that referenced this issue May 10, 2022
Updated to `tmpl-go` version `0.12.0` [1], including the versions in
between starting from 0.7.0 [3]:

1. Updated to Go 1.17 [4].
2. Updated to golangci-lint `v1.43.0` [5].
3. Updated to `tmpl` template repository version `0.11.0` [6].
4. Optimized GitHub action workflows for Go and Node [7].
5. Disabled golangci-lint's default excluded issues [8].
6. Introduced Go dependency caching and build outputs in `ci-go`
   workflow [9].
7. Disabled revive linter rule `package-comments` [10].
8. Fixed golangci-lint fail to run due to `revives` unknown `time-equal`
   rule [11].
9. Updated Node.js packages & GitHub actions [12].

This also includes changes required for any linter matches.

[1]: https://github.com/svengreb/tmpl-go/releases/tag/v0.12.0
[3]: https://github.com/svengreb/tmpl-go/releases/tag/v0.7.0
[4]: svengreb/tmpl-go#66
[5]: svengreb/tmpl-go#64
[6]: svengreb/tmpl-go#91
[7]: svengreb/tmpl-go#68
[8]: svengreb/tmpl-go#72
[9]: svengreb/tmpl-go#74
[10]: svengreb/tmpl-go#78
[11]: svengreb/tmpl-go#76
[12]: svengreb/tmpl-go#42

GH-41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant