Commit Graph

120 Commits

Author SHA1 Message Date
Daniel Lockyer
edf96ee976 Enabled --prefer-offline in CI to reduce network requests
- by default, yarn will try and fetch dependencies from the network, and
  fallback to local cache if the network is down
- `--prefer-offline` switches that around so we can take advantage of
  local caches before defaulting to the network
- hopefully this speeds up dependency install steps in CI
2023-04-05 14:22:03 +02:00
Daniel Lockyer
56b407f1f4
Added pre-push hook to run unit tests on changed packages
fixes https://github.com/TryGhost/Toolbox/issues/532

- we should protect against failures entering `main` which could be
  avoided by running a quick unit test beforehand
- this reintroduces Lerna as it supports parallelisation and `--since`,
  to run linting and unit tests on packages that have changed since
  upstream
2023-03-23 11:27:43 +01:00
Daniel Lockyer
a287912cf2
Added .eslintcache caching to CI
refs https://github.com/TryGhost/Toolbox/issues/532

- this will cache the `.eslintcache` files in packages, which should
  dramatically speed up linting in CI
2023-03-23 10:41:13 +01:00
Daniel Lockyer
a6966913dd Switched around CI machine allocation
- now the vast majority of our flaky tests are gone, we don't need the
  bigger machines
- however, browser tests seem to be a little slow, so we can try giving
  them more power than the defaults
- this should also help with resource contention when we have multiple
  jobs running at the same time, as we have double the numbers of
  runners on the free machines
2023-03-17 16:35:17 +01:00
Sam Lord
8b978b1eb3 Switch to using @tryghost/action-trigger-metric
no issue

Was previously using a repo in sam-lord's personal Github.
2023-03-13 11:19:42 +00:00
Daniel Lockyer
91e507d6f1
Removed Firefox from Admin CI runs
refs https://ghost.slack.com/archives/C02G9E68C/p1677753889082979

- Firefox tests have historically been flaky in CI and a real
  distraction when developing
- Firefox is, unfortunately :(, not a widely used browser at only 2.9%
  of global market share
- we've not had any Firefox-specific bugs that were detected in CI for
  a very long time, so it doesn't add anything anyway
2023-03-02 11:54:01 +01:00
Daniel Lockyer
50d467b1e8 Removed non-recommended Node version DB tests for SQLite3
- given SQLite3 is only supported for development, we don't really care about
  running tests on Node versions which aren't the recommended version
- this saves 2 jobs per CI run, which helps improve the health of CI in
  general
2023-03-02 11:36:26 +01:00
Daniel Lockyer
bf675e471f
Switched to general linux CI runner label
- turns out our concurrency on these 8 core machines is only 10 jobs, so
  everything is running really slowly
- by opening up to `linux`, we allow executions on 4, 8 and 16 core
  machines with a total concurrency of 30
2023-02-22 12:18:12 +01:00
Daniel Lockyer
ea2a80583b
Reduced CI machines to 8 core machines
- we're seeing low availability for the 16 core machines and they might
  be constrained as everyone jumps to the highest spec
- in theory, we don't need super fast multi-core machines to run tests,
  so I'll try with 8 core ones
2023-02-22 10:19:03 +01:00
Daniel Lockyer
eea7c9c6f8
Bumped GHA Runners to larger machines
- this reverts commit 8d18530f60
- I had to disable them before because there was an issue with
  availability
2023-02-20 18:12:02 +01:00
Daniel Lockyer
1af31bab1a ℹ️ Added support for Node 18
refs https://github.com/TryGhost/Toolbox/issues/488

- Node 18 is now LTS so we're adding support for it
- this adds Node 18.12.1 (the latest security release) to our supported
  ranges and CI
2023-01-04 11:27:39 +01:00
Daniel Lockyer
99c775be23
ℹ️ Bumped minimum Node version to 14.18.0
refs https://github.com/TryGhost/Toolbox/issues/488

- this is needed so we can bump some dependencies
- given how old these versions are, users should probably update past
  this anyway
2023-01-03 18:54:39 +01:00
Daniel Lockyer
8d18530f60
Revert "Bumped GHA Runners to larger machines"
- this reverts commit 921e9f4069
- we've been seeing issues with job scheduling so I'm reverting this for
  now
2023-01-03 17:56:03 +01:00
Daniel Lockyer
f512bd8eff
Bumped CI Node version to 16
refs https://github.com/TryGhost/Toolbox/issues/488

- Node 16 is our recommended version so we should run tests using that
2023-01-03 14:39:31 +01:00
Daniel Lockyer
921e9f4069 Bumped GHA Runners to larger machines
- this switches the testing CI over to larger 16 core machines we now
  have access to
2023-01-03 10:53:13 +01:00
Daniel Lockyer
6a3ea02fed Enabled codecov coverage uploading for E2E tests
refs https://github.com/TryGhost/Toolbox/issues/475

- this enables uploading to codecov for the E2E tests, and separates the
  unit + E2E test results with flags
2022-11-17 12:44:54 +07:00
Daniel Lockyer
6e3da6921e
Removed MySQL 5 from CI
closes https://github.com/TryGhost/Toolbox/issues/396

- we no longer support MySQL 5 so we shouldn't be running CI against it
- this cleans up use of MySQL 5 in GHA
2022-09-27 08:03:53 +07:00
Daniel Lockyer
4d63034bd2 Altered CI to upload coverage in one step
fixes https://github.com/TryGhost/Toolbox/issues/395

- we seem to be encountering issues with codecov where it randomly
  reports huge jumps in test coverage %
- I'm still not sure of the reason why, but the general trend in CI with
  codecov is to store test coverage files as artifacts and then submit
  them to codecov in one go
- this commit implements that in our CI
- let's see if this improves anything
2022-09-15 11:30:13 +01:00
Daniel Lockyer
75ec41cbe2 Fixed typo in CI workflow if-statement
- apparently I should only use single quotes here?
2022-09-05 10:15:44 +01:00
Daniel Lockyer
6f5dbf7820
Fixed submitting multiple coverage reports per test run
refs https://github.com/TryGhost/Toolbox/issues/395

- I think we regressed somewhere along the line here, but we seem to be
  submitting two test coverage reports for the Admin tests and the unit
  tests
- I'm not sure if this fixes the random issues we've been seeing with
  -5%/+14% coverage bumps but it should clean this issue up first
2022-09-05 10:06:12 +01:00
Daniel Lockyer
f04666ef52
Removed Admin production build test
- this was originally added because we had an issue with a production
  build of Admin during a release
- since then, we've got a canary build that runs for every commit on
  `main`
- I think this test is superfluous now, so this commit removes it and
  saves ~6 mins of CI time per commit
2022-08-31 11:21:22 +01:00
Daniel Lockyer
60b8cb1a30 Updated CI runners to Ubuntu 22.04
refs https://github.com/actions/runner-images/issues/6002

- Ubuntu 18.04 is now deprecated in GHA
- this commit moves all tests onto 22.04 except the Admin integration
  tests because they're failing to pick Firefox up
- I can look into this after we've unblocked CI
2022-08-22 15:37:19 +02:00
Daniel Lockyer
efc10b501e
Re-enabled Ghost-CLI tests in CI
- this required some reworking for the new monorepo setup, but this
  commit should now enable the Ghost-CLI tests in CI again
- also switched upgrade test to v4 to support Node 16
2022-08-22 11:40:13 +02:00
Daniel Lockyer
54aa9f016b Fixed full Admin test suite running during unit tests
- because of how the npm scripts were set up, we were running the full
  Admin integration tests during the unit tests phase of CI
- this commit renames the majority of `test` to `test:unit` in the
  package.json files, and aliases `test` to `test:unit`
- special packages like Admin have no-op'd `test:unit` scripts so we
  don't end up running its tests
2022-08-15 15:34:52 +02:00
Daniel Lockyer
a55d00f209
Fixed wrong command used for production build test
refs dd41929251

- this was missed from the previous commit
2022-08-05 09:59:52 +02:00
Daniel Lockyer
ddcff9621d
Updated all GitHub-owned Actions to v3
- updating to v3 gives us the Latest And Greatest ™️
- really, it only bumps these workflows to Node 16, which is still fine
  with me
2022-08-03 22:33:28 +02:00
Daniel Lockyer
8878c50c43
Fixed formatting of Canary workflow
- this was a typo from the previous commit, the `uses` should be outside
  of `steps`
2022-08-03 17:26:10 +02:00
Daniel Lockyer
0c7239b22b
Refactored testing workflows
refs https://github.com/TryGhost/Toolbox/issues/365

- re-arranged tests so Admin ones are grouped together
- required Admin tests to pass to run Canary build
2022-08-03 17:19:23 +02:00
Daniel Lockyer
cd5a8979bf
Added Admin CI test matrix
refs b0a776fd25

- this ports over the test that was delete in the workflow file in the
  referenced commit
2022-08-03 16:35:58 +02:00
Daniel Lockyer
b0a776fd25
Migrated production build test from Admin
refs https://github.com/TryGhost/Toolbox/issues/365

- the .github/workflows/test.yml in Admin needed to be merged with the
  top-level GHA folder so this test needed porting
- there is still the browser matrix testing to port once things are
  stable
2022-08-03 16:14:52 +02:00
Daniel Lockyer
e292bf3258
Removed 5.0 branch from CI triggers
- this was leftover from work towards v5 but is no longer needed
2022-07-25 11:22:38 +02:00
Daniel Lockyer
fc1f651db6
Fixed disabling of Ghost-CLI tests
- conditional binding rules are difficult so let's just make it simpler
2022-07-22 12:20:40 +02:00
Daniel Lockyer
c6e4127eaa
Removed ghost-cli dependency for canary build
- I had to disable ghost-cli tests whilst we're converting to a
  monorepo, so the canary build isn't triggered
2022-07-22 10:36:47 +02:00
Daniel Lockyer
5940fa630b
Fixed linting and unit tests running on all packages
- this was leftover from the transition to a monorepo but we should be
  running linting and tests on all packages
2022-07-21 09:44:45 +02:00
Daniel Lockyer
e0a12166fc
Enabled unit testing for all packages in CI
- again, a slight hack but this enables us to run tests for all packages
  in CI right now
2022-07-20 17:43:55 +02:00
Daniel Lockyer
b65816f421
Disabled Ghost-CLI test
- this is broken for now until I have dependency bundling working for
  the monorepo
2022-07-20 17:30:48 +02:00
Daniel Lockyer
3d989eba23 Converted Ghost repo into a monorepo
refs https://github.com/TryGhost/Toolbox/issues/354

- this commit turns the Ghost repo into a monorepo so we can bring our
  internal packages back in, which makes life easier when working on
  Ghost
2022-07-20 16:41:05 +02:00
Daniel Lockyer
1ba2988e98
Added v5.* to workflow triggers
- this is needed so we run CI tests on release branches
2022-07-19 15:21:42 +02:00
Daniel Lockyer
6a3f61f62a Fixed database environment variables leaking across matrix runs
refs https://github.com/TryGhost/Toolbox/issues/244

- due to the way we currently set the env vars, they get applied across
  all matrix variations
- this means we're leaking the variables for SQLite to the MySQL test
  runs and this shows a warning because of how strict `mysql2` is
- this commit switches to optionally setting the env variables
- this is a partial workaround for fbcdacbd83/core/shared/config/utils.js (L55-L76) not seeming to work
2022-06-02 09:49:22 -04:00
Daniel Lockyer
14828399e0
Reverted Ghost-CLI CI test to bumping minor version
- now we've released 5.0, we don't need to bump to the next major so we
  can just bump to the next minor
2022-05-24 09:20:57 +02:00
Daniel Lockyer
cb80be3d0c
Fixed migrations running in CI tests
- we needed to bump the major version so 5.0 migrations will run in CI
- I'm also switching the Migrations test to delete all 5.x migrations
  and re-run them to test idempotency
2022-05-09 11:49:53 +01:00
Daniel Lockyer
3171df4102
🔥 Dropped support for Node 12
refs https://github.com/TryGhost/Toolbox/issues/267

- Node 12 becomes EOL on April 30th so we're going to be dropping
  support for it in Ghost
- this commit updates the Node engine ranges so CLI can pick this up,
  and drops 12.22.1 from the CI matrix
2022-04-19 15:53:44 +01:00
Daniel Lockyer
6d5a8c6b31 Bumped Ghost-CLI test Node version to v14
refs https://github.com/TryGhost/Toolbox/issues/267

- we're about to remove support for Node 12 so this needs bumping to
  keep things chugging along
2022-04-19 15:44:43 +01:00
Daniel Lockyer
a109cca55c
Added 5.0 branch to CI trigger
refs https://github.com/TryGhost/Toolbox/issues/273

- ahead of 5.0, we need to make sure we're running development branch tests on CI
2022-04-05 09:31:54 +01:00
Daniel Lockyer
a7074592c8 Configured CI to only calculate coverage for recommended Node version
- we seem to be getting some odd numbers when running c8 on Node 12, and
  it's causing our CI checks to fail
- even when we're adding tests, the coverage value goes down
- this is disrupting the team from shipping, so we need to change that
- this commit alters the setup to run unit tests w/ c8 for Node 16 unit
  tests, and without c8 for other versions
- `yarn test:unit` is kept the same for everyday use
2022-03-07 13:45:33 +00:00
Daniel Lockyer
bf6f607f42 Switched to mysql2 library
refs https://github.com/TryGhost/Toolbox/issues/174

- this commit switches Ghost from using the `mysql` library to the
  `mysql2` one
- we've done this for several reasons:
  - `mysql2` is more actively maintained
  - `mysql2` natively supports the default auth plugin on MySQL 8
  - `mysql2` is fasterrrr
- there have been various other commits refactoring the groundwork for
  this commit but this commit should be short and sweet:
  - alias `mysql` to `mysql2` client so we maintain backwards
    compatibility with all configs who use `"client": "mysql"`
  - enabled `decimalNumbers` so we maintain the same functionality as
    `mysql`
  - replaced the dependencies and updated `knex-migrator`
  - hardcoded the newer authentication plugin in MySQL 8 CI. Before
    switching to `mysql2`, this would break because it didn't support
    this
2022-03-03 09:59:37 +01:00
Hannah Wolfe
3bd8e01495 Pinned coverage to current levels to prevent drops
- Updating our config to have `--check-coverage` enforces that the coverage meets a certain level.
- The default is 95 I believe, but our coverage is lower.
- I've set the levels to our current levels, so any drop below these numbers will cause the build to fail.
- I've also set the reporters to be text, html and cobertura so we always have a mini report, the full HTML files to navigate and cobertura for CI
- Cleaned up CI so we don't use the cov:unit command as we're now using codecov
- This also means we can remove the cov:unit command which was weird to use because it uses the last test run, which can be confusing
2022-02-24 09:56:06 +00:00
Daniel Lockyer
08eaed152b Added yarn test:ci command
refs https://github.com/TryGhost/Toolbox/issues/208

- we currently run all test commands separately in CI and this can make
  it harder to replicate any issues we see in CI because we have to
  manually go and copy the order of the tests
- it's also nicer if there's just one command that runs so we can make
  changes globally to CI
- this commit adds a test:ci yarn command which will run the tests in
  order of speed/importance, with the -b AKA fail-fast flag so we
  don't have to wait for all tests to run before finding out about
  issues
- this also cleans up running unit tests in the DB matrix
2022-02-16 19:22:20 +01:00
Daniel Lockyer
7a5b262a84 Renamed CI test workflows
- these names are a little more descriptive and look better in GitHub
2022-02-16 19:22:20 +01:00
Daniel Lockyer
d4759d30a7 Split out unit tests from CI matrix
refs https://github.com/TryGhost/Toolbox/issues/208

- unit tests (shouldn't) be database dependent so they don't need to be
  included in the DB matrix
- this prevents an extra 6 executions of unit tests, which isn't a big
  deal given they only take 10s to run, but semantically they belong
  outside so this commit does that
- also updates the canary step to rely on this extra test run
2022-02-16 19:22:20 +01:00