-
Notifications
You must be signed in to change notification settings - Fork 773
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
ci: run PR jobs on Ubuntu, MacOS and Windows #329
ci: run PR jobs on Ubuntu, MacOS and Windows #329
Conversation
🦋 Changeset detectedLatest commit: ecacf92 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9ea3968
to
a843255
Compare
a843255
to
b24e8db
Compare
Hmm, this is worrying. When we use the CI cache for node_modules in Windows and then run
Followed by a bunch of failures. It seems that whatever we are caching is not quite right for Windows npm... Or Windows npm is broken. |
I can confirm something's up with our caching strategy, but also something's up with how eslint cache even works.I faced CI failures in #348 but not locally. Had to blow away my local |
0c0c453
to
9f633ef
Compare
9f633ef
to
589828d
Compare
I worked out what the problem is here. We were caching the |
589828d
to
9f39be6
Compare
This PR will fix #361 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, very excited to see the improvements! Approving tentatively, but with a couple of questions.
9f39be6
to
4cf9e25
Compare
- update .gitattributes to be consistent on Windows - update Prettier command to ignore unknown files Windows seems to be more brittle here. - tighten up eslint config Windows seems to be more brittle here as well. - use the matrix.os value in the cache key Previously we were using `running.os` but this appeared not to be working.
- Don't rely on bash variables to configure tests The use of bash variables in the `npm test` script is not supported in Windows Powershell, causing CI on Windows to fail. These bash variables are used to override the API token and the Account ID. This change moves the control of mocking these two concepts into the test code, by adding `mockAccountId()` and `mockApiToken()` helpers. - The result is slightly more boilerplate in tests that need to avoid hitting the auth APIs. - But there are other tests that had to revert these environment variables. So the boilerplate is reduced there. - Sanitize command line for snapshot tests This change applies `normalizeSlashes()` and `trimTimings()` to command line outputs and error messages to avoid inconsistencies in snapshots. The benefit here is that authors do not need to keep adding them to all their snapshot tests. - Move all the helper functions into their own directory to keep the test directory cleaner.
This also speeds up tests and avoids us checking that npm did what it is supposed to do.
Previously we were caching all the `node_modules` files in the CI jobs and then running `npm install`. While this resulted in slightly improved install times on Ubuntu, it breaks on Windows because the npm workspace setup adds symlinks into node_modules, which the Github cache action cannot cope with. This change removes the `node_modules` caches (saving some time by not needing to restore them) and replaces `npm install` with `npm ci`. The `npm ci` command is actually designed to be used in CI jobs as it only installs the exact versions specified in the `package-lock.json` file, guaranteeing that for any commit we always have exactly the same CI job run, deterministically. It turns out that, on Ubuntu, using `npm ci` makes very little difference to the installation time (~30 secs), especially if there is no `node_modules` there in the first place. Unfortunately, MacOS is slower (~1 min), and Windows even worse (~2 mins)! But it is worth this longer CI run to be sure we have things working on all OSes.
4cf9e25
to
ecacf92
Compare
After the cache has been primed we still get super fast jobs on Ubuntu but somewhat slower on MacOS and Windows: