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

ST-5122: Add GitHub Actions CI pipeline #14

Merged
merged 11 commits into from
Aug 21, 2023
Merged

ST-5122: Add GitHub Actions CI pipeline #14

merged 11 commits into from
Aug 21, 2023

Conversation

dominicfraser
Copy link

@dominicfraser dominicfraser commented Aug 19, 2023

When this repo was forked it had a travis.yml to run CI; but travis was never added to this repo.

It had a pipeline for releases, but this was deleted when it stopped working, moving to manual releases. It was missing a pipeline for pull requests.

This PR ensures that linting and tests are enforced as a requirement for PRs. It does this using a simple GitHub Actions setup; as minimal changes as possible.

In addition to the code changes it also adds the install-and-test as a required check in the repo settings.

@@ -8,7 +8,7 @@
},
"settings": {
"react": {
"version": "16.4"
"version": "17.2"
Copy link
Author

Choose a reason for hiding this comment

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

Unrelated, but as internally we only support 17 make this match. It is prompted by eslint-config-skyscanner, though React isn't actually used in this repo at all.

Choose a reason for hiding this comment

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

I tried removing this locally to see what happens:

 alakbarzeynalzade@M-LC2R24049H  ~/dev/babel-plugin-transform-i18n   add_gha ±  npm run lint          

> @skyscanner/[email protected] lint
> eslint *.js

Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.

Copy link
Author

Choose a reason for hiding this comment

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

It doesn't break anything, but it is an annoying warning, so I can understand why some version was added as a default - may as well keep that up to date even though its currently non-functional :D

@@ -1,12 +0,0 @@
sudo: false
Copy link
Author

Choose a reason for hiding this comment

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

This file was not being used; delete.

Choose a reason for hiding this comment

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

🧹

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
Copy link
Author

Choose a reason for hiding this comment

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

We're already doing a precommit on every commit; prepush is overkill; delete.

@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
Copy link
Author

Choose a reason for hiding this comment

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

Below we split out lint and test into two different steps. This aligns to our standard setup.

@@ -21,7 +21,6 @@
],
"scripts": {
"lint": "eslint *.js",
"pretest": "npm run lint",
Copy link
Author

Choose a reason for hiding this comment

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

The precommit will still run both, but this aligns to our standard setup of individually explicit commands.

@@ -8,6 +8,6 @@ To become a maintainer, create your own account on npm.js then ask the owners of

To do this:
- After merging your changes, run `npm version -f major|minor|patch`. This will create a tagged commit changing the version in `package.json`, and the changes in `CHANGELOG.md`.
- Run `npm publish`.
- Run `npm publish --registry=https://registry.npmjs.org/`.
Copy link
Author

Choose a reason for hiding this comment

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

Be explicit, as not doing so can cause problems publishing to the wrong location.

Copy link

@alakbarz alakbarz left a comment

Choose a reason for hiding this comment

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

ten

@@ -8,7 +8,7 @@
},
"settings": {
"react": {
"version": "16.4"
"version": "17.2"

Choose a reason for hiding this comment

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

I tried removing this locally to see what happens:

 alakbarzeynalzade@M-LC2R24049H  ~/dev/babel-plugin-transform-i18n   add_gha ±  npm run lint          

> @skyscanner/[email protected] lint
> eslint *.js

Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.

@@ -0,0 +1,29 @@
name: PR

Choose a reason for hiding this comment

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

@@ -1,12 +0,0 @@
sudo: false

Choose a reason for hiding this comment

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

🧹

@dominicfraser dominicfraser merged commit a1984ee into main Aug 21, 2023
1 check passed
@dominicfraser dominicfraser deleted the add_gha branch August 21, 2023 08:48
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