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 gh actions for building and testing the repo #1310

Closed
wants to merge 1 commit into from

Conversation

vzaidman
Copy link
Contributor

@vzaidman vzaidman commented Aug 2, 2024

Introduced config that triggers GH actions that build, lint, and test the repo.

These are triggered when a pull request is created or it's latest commit is updated.

If a new job is triggered, the previous is abandoned.

  • Please notice that tests are currently disabled for windows because they fail. This will be fixed in a subsequent diff.

Test:

  • See the Github actions on this PR:
Screenshot 2024-08-02 at 17 14 07

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 2, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.93%. Comparing base (e1ec4c7) to head (ef1b01f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1310   +/-   ##
=======================================
  Coverage   83.93%   83.93%           
=======================================
  Files         208      208           
  Lines       10954    10954           
  Branches     2757     2757           
=======================================
  Hits         9194     9194           
  Misses       1760     1760           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch 5 times, most recently from 954ee65 to 621a2b7 Compare August 2, 2024 16:09
@vzaidman vzaidman requested a review from robhogan August 2, 2024 16:12
Copy link
Contributor

@robhogan robhogan left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on! Just a couple of nits/questions

.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/actions/yarn-install/action.yml Outdated Show resolved Hide resolved
@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch 3 times, most recently from 41a8980 to 270f4cf Compare August 5, 2024 08:40
@vzaidman vzaidman requested a review from robhogan August 6, 2024 09:46
@vzaidman vzaidman changed the title add gh actions for building and testing the repo Add gh actions for building and testing the repo Aug 6, 2024
@vzaidman vzaidman requested a review from huntie August 6, 2024 16:08
@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch 6 times, most recently from 0e91dc7 to 4085dde Compare August 7, 2024 12:58
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
Comment on lines 12 to 15
default: '18.12'
current-node-version:
required: false
default: '20.2'
Copy link
Member

Choose a reason for hiding this comment

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

I reckon we can reduce to 18.x, 20.x as specifiers at the GitHub level so we can simplify this. Then we could receive one node-version arg as a string, and more easily test 3 versions in future if we need to.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to have a test on 18.0 though since we claim to support it, and there are some differences vs later minors. ['current', 'lts/*', 'lts/-1', '18.0'] (which resolves to 21.x, 20.x, 18.x, 18.0), IMO.

Copy link
Contributor Author

@vzaidman vzaidman Aug 7, 2024

Choose a reason for hiding this comment

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

Sounds good to me, however @huntie disagreed that it makes sense to test the minimum and lts versions before. His argument regarding lts/* and I assume current is that these might "force us to make a CI config code change to unblock future lands" if there's a failure. Instead we should hardcode the versions and bump them manually.
Did I understand you correctly @huntie?

BTW @robhogan, current resolves to v22.6.0.
https://github.com/facebook/metro/actions/runs/10286511772/job/28467353526

Copy link
Contributor

@robhogan robhogan Aug 7, 2024

Choose a reason for hiding this comment

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

Yeah that's fair - essentially it's unstable (though fwiw these CI signals aren't land blocking yet). I'd like to test 18.0 (which should be stable), I'd be OK to use 20.x, 18.x instead of the aliases.

It would still be good to know asap if we're incompatible with a new Node major, because we don't put a "maximum" constraint on engines so Node releases can break users (it's happened before), but ideally we'd run that as a separate scheduled (eg nightly) run rather than anything that potentially signals a diff-time failure unrelated to the diff. We can follow up with that.

Copy link
Contributor Author

@vzaidman vzaidman Aug 7, 2024

Choose a reason for hiding this comment

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

OK. Great idea with the nightlies!
I've updated the code to ['18.0', '18.x', '20.x'] and added to my TODO list to introduce a nightly job that tests lts/* and current.

Copy link
Contributor

@robhogan robhogan Aug 7, 2024

Choose a reason for hiding this comment

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

One more for the TODO list then - we should also have a scheduled test that doesn't use (maybe deletes) yarn.lock and pulls the latest versions of all our dependencies, so we can see if a dependency update breaks us somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

np

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@huntie please approve as well

@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch 5 times, most recently from 8e864dd to 55992a4 Compare August 7, 2024 14:42
@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch from 55992a4 to c35b1a6 Compare August 7, 2024 15:15
@robhogan
Copy link
Contributor

robhogan commented Aug 7, 2024

@vzaidman LGTM, thanks for iterating - if you want to import I think the diff should now be auto-stamped because I've approved it here (never actually tried that tbh!).

@vzaidman vzaidman requested a review from huntie August 7, 2024 15:26
Copy link
Member

@huntie huntie left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ✅

Comment on lines +30 to +31
name: "Tests with coverage"
steps:
Copy link
Member

Choose a reason for hiding this comment

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

Wait, this indentation looks wrong. Can we triple-check this, and enable Prettier on YAML files in our repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have validation on yml.

Both idents are valid in yml apparently: https://stackoverflow.com/questions/17014460/yaml-indentation-for-array-in-hash
Also, evidently it works.

However, I'll make sure they are formatted the same across the file regardless. Thx for noticing.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but can we please enable auto-formatting? 🥹 Good to go 👍🏻

@vzaidman vzaidman force-pushed the migrate-to-gh-actions branch from c35b1a6 to 3c91124 Compare August 8, 2024 11:04
@facebook-github-bot
Copy link
Contributor

@vzaidman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@vzaidman merged this pull request in 6289dab.

@vzaidman vzaidman deleted the migrate-to-gh-actions branch August 8, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants