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

Add JS/CSS coding standard workflow #14

Merged
merged 5 commits into from
Mar 29, 2024
Merged

Conversation

Ninodevo
Copy link
Contributor

Changes proposed in this Pull Request

  • Adds a JS/CSS coding standard GitHub workflow that runs the lint:scripts and int:styles scripts
  • Maybe we could divide the workflow into separate JS and CSS? We would use more GitHub minutes...

Testing instructions

  1. Add some JS and CSS that throw errors with lint
  2. Create a PR request with your branch
  3. You should see the workflow run and throw errors

@Ninodevo Ninodevo requested a review from ahegyes August 22, 2023 11:41

# Adding Node.js setup to run JS and CSS linters
- name: Setup Node.js
uses: actions/setup-node@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why you're using @v2 instead of @v3 which is the latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

${{ runner.os }}-node-

- name: Install NPM dependencies
run: npm install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think npm ci is more appropriate in this context: https://stackoverflow.com/a/53325242

run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache npm dependencies
uses: actions/cache@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, any reason why locking into @v2 instead of the latest @v3?

uses: actions/cache@v2
with:
path: |
**/node_modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the idea to cache the node_modules specifically? All tutorials I can find on this just use the outputs.dir folder from the line below 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that was my idea, not sure if this is needed, I can remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove it based on this (taken from these docs):

Note It is not recommended to cache node_modules, as it can break across Node versions and won't work with npm ci

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it wouldn't be better to simply use the cache directive in actions/setup-node directly: https://github.com/marketplace/actions/setup-node-js-environment#caching-global-packages-data

It's supposed to use actions/cache under the hood and is guaranteed to work and to simplify our entire action 🤔

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.15' # project version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could automate this number by replacing node-version with node-version-file: 'package.json'? https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file

@ahegyes ahegyes merged commit a7fb1db into trunk Mar 29, 2024
3 checks passed
@ahegyes ahegyes deleted the feature/js-css-cs-workflow branch March 29, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants