Commit Graph

28 Commits

Author SHA1 Message Date
Fabien "egg" O'Carroll
5103b58c0c Disabled the Ghost-CLI Github Action
This action was failing and stopping us from releasing a patch release.
The failure was a false negative, and due to what we believe is a cache issue.
2023-08-01 20:44:04 +01:00
Daniel Lockyer
58cfa6ff15 Updated dependency cache keys
- this should now restore from a shared cache but update a unique cache
  for use within the rest of the jobs
2023-07-28 10:11:52 +02:00
Daniel Lockyer
13c8a26ea4 Fixed dependency cache key with new package
- in the event there is a new package, we need to completely reset the
  cache key otherwise `yarn` won't link the packages correctly
2023-07-27 22:33:46 +02:00
Daniel Lockyer
af320ab864 Fixed new package detection
- turns out new packages folders aren't generating an `A` status in `git
  diff`, so this line never worked
- if we create a `package.json` file, we can reasonably assume we're
  creating a new package, so this should fix the issues we were seeing
  with caching + new packages
2023-07-25 16:15:36 +02:00
Daniel Lockyer
adc3f8e8ee Skipped dependency caching for new packages
- in this event, we don't want to cache the dependencies because the new
  package will need to be linked to the others
- this commit should add detection for new packages and skip the cache
  if so
2023-07-25 15:14:50 +02:00
Daniel Lockyer
0a7fb4c881 Reimplemented canary builds on main
refs https://github.com/TryGhost/DevOps/issues/47

- this adds a canary job that waits for successful tests and then kicks
  off the Docker build step
2023-07-18 14:52:54 +02:00
Daniel Lockyer
90adbc4865 Removed canary workflows
refs https://github.com/TryGhost/DevOps/issues/47

- we need to start building from git refs so this workflow which builds
  a tarball is no longer needed and just adds to the execution time
2023-07-14 11:24:18 +02:00
Daniel Lockyer
9f40c90e07 Switched to Nx runner for more tasks
- this switches us to using Nx for `ghost:dev`, which means we can
  configure its dependencies and ensure that the TS projects are built
  beforehand
- also switches to Nx for `ghost:archive` so we don't need to run
  `build:ts` for all `yarn` commands
2023-07-14 08:52:01 +02:00
Daniel Lockyer
e990cbba01 Configured storing Nx cache in GHA to speed up builds
refs https://github.com/TryGhost/DevOps/issues/47

- this allows us to store and restore the cache for TS builds, which
  should speed up the whole process
2023-07-14 08:52:01 +02:00
Daniel Lockyer
2aa7da3a0b Improved monorepo tooling setup
refs https://github.com/TryGhost/DevOps/issues/45

- this switches the monorepo over to using Nx instead of Lerna, because
  we don't currently need the versioning+publishing capabilities
- this also adds an `nx.json`, which allows us to enable task caching
- also adds `build:ts` to the TS projects, which is cached for fast execution
- how these interact with the dev.js script will hopefully soon be
  reworked to be a better experience
2023-07-12 16:27:39 +02:00
Daniel Lockyer
d38e7fd46f Disabled CI workflows for Renovate branches
refs https://github.com/TryGhost/DevOps/issues/43

- because we now enforce all commits through a PR, Renovate can no
  longer automerge commits
- this is actually a huge bonus because it simplifies a lot of the
  issues we were having with the GHA setup
- this commit removes the triggers and special handling to remove the
  duplicate executions
2023-07-11 09:30:59 +02:00
Daniel Lockyer
f7aeb4138e Switched to printf to echo GitHub context
- printf is a little safer and should prevent issues with command
  execution within the metadata job
2023-07-10 17:54:47 +02:00
Daniel Lockyer
aa303414cb ℹ️ Bumped minimum Node 16 version to 16.14.0
fixes https://github.com/TryGhost/DevOps/issues/42

- several of our dependencies require this so making the minor bump to
  increase the version helps keep them updated
2023-07-10 16:41:34 +02:00
Daniel Lockyer
f50e878cb2 Fixed error about long filename
- echoing the data should avoid issues with piping in data through a
  file redirection
2023-07-10 15:15:12 +02:00
Daniel Lockyer
389f480c96 Removed forced pushed CI check
- we probably just want to run my logic to get the base commit for all
  pushes because otherwise the `base.sha` will be null for new branches
2023-07-10 15:03:09 +02:00
Daniel Lockyer
a5fe87cc4d Fixed caching build assets
- we shouldn't cache the build assets against the yarn.lock hash because
  the files could change independent of that file
- this bring the build caching more inline with https://github.com/getsentry/sentry-javascript/blob/develop/.github/workflows/build.yml,
  which is a big inspiration for this file
2023-07-10 14:47:08 +02:00
Daniel Lockyer
c158aa7397 Updated fetching latest base commit
- unfortunately GitHub makes this incredibly hard and this commit
  doesn't even provide a full solution, but it should allow us to fetch
  the latest commit for PRs and pushes to a branch, but not force pushes
2023-07-10 13:22:00 +02:00
Daniel Lockyer
b4d9191522 Fixed --since parameter for partial executions
- if a branch is force-pushed, the existing value is incorrect and we
  get errors from Lerna
- this switches to finding the common commit between this branch and
  the head as reported by GitHub
2023-07-10 09:55:19 +02:00
Daniel Lockyer
5b7a89d8fc Deduplicated execution check in CI workflow
- we only need this on the metadata step because it trickles down to the
  other workflows that depend on it
2023-07-10 09:55:19 +02:00
Daniel Lockyer
b6131f0631 Fixed canary build triggering
- this previously wouldn't trigger if any of the `needs` are skipped
- this switches to waiting for the actual job which checks if all
  required jobs were completed successfully
2023-07-07 15:30:22 +02:00
Daniel Lockyer
f6aeff6524 Added handling for building arch branch
refs https://github.com/TryGhost/DevOps/issues/40

- this is an experimental branch that needs a separate canary build
- these changes should help support that by allowing canary builds on
  that branch
2023-07-06 09:24:45 +02:00
Daniel Lockyer
92120324eb Updated workflow for code coverage
- added separate Admin codecov step
- removed unit test until we figure out handling for partial runs
2023-07-06 09:24:45 +02:00
Daniel Lockyer
289e459283 Added tests for migrations
refs https://github.com/TryGhost/DevOps/issues/39

- up until now, we've had a CI job which does a really basic test for
  migrations, but it barely functions and misses bugs all the time
- this commit removes that and switches to an actual test suite for our
  migrations, so we can ensure they function as expected
- also removes the env var hack I came up with for those migrations
  tests
- this should lead to safer migrations and faster tests
2023-07-05 11:00:06 +02:00
Daniel Lockyer
40e8bc09ce Optimized unit test workflow to only run for changed packages
- this implements a similar idea to linting by only running for changed
  packages, which saves ~3 minutes for this job
2023-07-05 11:00:06 +02:00
Daniel Lockyer
ec94930876 Fixed only running linting on changed projects
- this configures the lint step to only run on packages that have
  changed since the previous commit
2023-07-04 14:21:05 +02:00
Daniel Lockyer
f2c2e7f687 Fixed duplicate workflow executions on PRs
- if we push to a branch, and open a PR, we'll get duplicate executions
- this fixes that by adding the same check we have elsewhere in the
  workflow
2023-07-04 12:31:00 +02:00
renovate[bot]
017a87eeeb Update actions/checkout action to v3 2023-07-04 12:16:16 +02:00
Daniel Lockyer
88954f7318 Reworked CI workflow to optimize setup
refs https://github.com/TryGhost/Toolbox/issues/609

- this rewrites the CI workflow to include a pre-test step which will
  download and cache dependencies, and will only run tests when the
  associated code changes
- this provides a huge improvement over the existing setup, and will
  save us a lot of time in CI
2023-07-04 12:03:34 +02:00