Commit Graph

554 Commits

Author SHA1 Message Date
Simon Backx
cc83b3661a
Added signup-form e2e tests to CI (#16860)
refs https://github.com/TryGhost/Team/issues/3298

This adds a new GitHub workflow that runs the signup-form E2E tests,
only when files in `ghost/signup-form` have changed
2023-05-25 10:28:48 +02:00
Daniel Lockyer
dd6559b3c8
Disabled project codecov status by default
refs https://github.com/TryGhost/Toolbox/issues/583

- this disables the project codecov, as it's better to determine the
  codecov by the individual flags we have set
2023-05-24 14:18:11 +02:00
Daniel Lockyer
2daf4bad5c
Reconfigured codecov config
refs https://github.com/TryGhost/Toolbox/issues/583

- removed default config so we just have separate numbers for the flags
- added threshold to flags config so we can protect against small
  changes in variance
2023-05-24 13:04:38 +02:00
Daniel Lockyer
1adbd7d507
Added codecov config to repo
refs https://github.com/TryGhost/Toolbox/issues/583

- this commit adds config for codecov because this repo needs some
  changes that aren't suitable for the global config
- this probably needs some adjusting over time but should get us started
  for now
2023-05-24 11:09:13 +02:00
Daniel Lockyer
3e12c0ea54
Split CI database tests into separate types
- this will allow us to see which set of tests are consuming the most
  amount of time in CI
- in order to split apart the commands, I've had to override the
  coverage thresholds for integration+regression tests in order to keep
  c8 happy
- also sprinkled some more labels into the workflows to make things
  clearer to read
2023-05-22 19:34:17 +02:00
Daniel Lockyer
ade8a1f5f4
Removed debugging statements
- these snook their way into my previous commit
2023-05-22 18:19:41 +02:00
Daniel Lockyer
6c85c2c195 Fixed uploading single code coverage to Codecov
fixes https://github.com/TryGhost/Toolbox/issues/583

- we currently upload the codecov for unit tests and e2e/admin tests
  separately
- unfortunately this means that when one submits before the other, the
  codecov % will be incorrect
- this leaves a big red cross on the commit until the other coverage is
  uploaded
- this should fix that by upload the coverage in one step once CI is
  happy
2023-05-22 18:10:23 +02:00
Daniel Lockyer
03122cde77
Added support to yarn dev for --announcement-bar
refs https://github.com/TryGhost/Toolbox/issues/584

- we should strive to provide a good development experience by keeping
  the number of "other" setup steps to a minimum
- this adds support for the Announcement Bar app to the dev script so a
  simple flag spins up the dev server too
2023-05-22 15:31:28 +02:00
renovate[bot]
f6e7f15c84 Update peter-evans/create-or-update-comment digest to c9cf0f5 2023-05-19 12:18:51 +02:00
Daniel Lockyer
58539c355b
Added --adminX functionality to yarn dev
fixes https://github.com/TryGhost/Toolbox/issues/581

- this adds support for spinning up AdminX within the `yarn dev` script
  with zero other steps needed
2023-05-19 10:34:06 +02:00
Daniel Lockyer
3dd4d3943b
Fixed creating patch branches on the last released version
- without the `--match=v*`, this matches the last tag which might come
  from something like Portal or Admin-X, which isn't correct
2023-05-18 19:47:14 +02:00
Daniel Lockyer
8127a481ca
Added --lexical support to yarn dev
refs https://github.com/TryGhost/Team/issues/3240

- this adds support for `--lexical` to `yarn dev`, which sets the
  env variable so Ghost uses a local Lexical instance and not the CDN version
2023-05-18 15:14:36 +02:00
Daniel Lockyer
d9ea8f2827
Removed release workflow
refs https://github.com/TryGhost/Toolbox/issues/580

- this has been moved to internal automations so we don't need the
  workflow here
2023-05-15 08:48:42 +02:00
Daniel Lockyer
b403dd8a81
Fixed path to slack-build action
refs 990b477a31

- I've moved this into the Actions repo so it's easier to maintain
2023-05-12 13:11:16 +02:00
renovate[bot]
7639b7b69e Update peter-evans/create-or-update-comment digest to 7dfe4b0 2023-05-12 11:49:10 +02:00
renovate[bot]
be28ae77b8 Update peter-evans/create-or-update-comment digest to 594dca4 2023-05-12 11:27:37 +02:00
Fabien 'egg' O'Carroll
474e683011
Added @tryghost/in-memory-repository (#16769)
This is the first pass at an abstract class for our in-memory repository
implementations. It's based off of the existing implementations and
should speed up local development and deduplicate code
2023-05-10 09:23:16 -04:00
Fabien "egg" O'Carroll
9ac8301f5b Revert "Added @tryghost/in-memory-repository"
This reverts commit 905578d590.
2023-05-09 19:38:06 -04:00
Fabien "egg" O'Carroll
905578d590 Added @tryghost/in-memory-repository
This is the first pass at an abstract class for our in-memory repository
implementations. This should speed up local development and deduplicate code
2023-05-09 18:46:48 -04:00
Daniel Lockyer
16ea824f71
Fixed building Admin in development mode for browser tests
- I switched over `build` to run in production mode because we now do
  `lerna run build` during the release process, but this was bundling
  development assets
- this adds `build:dev` and switches the browser test to use that, so
  they should use the development assets moving forwards
2023-05-05 12:13:11 +02:00
Fabien "egg" O'Carroll
ac2adfc964 Fixed browser tests on CI
We need to run `yarn build` in the top level to ensure that all packages are built
2023-05-03 14:38:26 -04:00
Fabien "egg" O'Carroll
b9565bc290 Migrated @tryghost/post-revisions to TypeScript!
This is an initial start to using TypeScript in our non-core Ghost packages.

- Adds a prepare script to build the project after installing deps
- Adds an initial tsconfig.json which is compatible with our node env
- Migrates all of the code to TypeScript, including tests
- Updates tests to use ts-node so that we don't need to compile the tests
- ts-node is installed at the top level because the env is weird with lerna and
  doesn't work otherwise
- Updates the yarn dev script to build the project with the --all and --revisions flag
2023-05-03 14:32:31 -04:00
Fabien "egg" O'Carroll
ed674981e6 Updated npm scripts to support packages with a build step
- Updates the prepare script in the top level to run prepare on packages, so
  that packages can be built when running `yarn`

- Updates the build script in ghost/core to run build on packages, so that
  packages are built before being monobundled

- Updates monobundle to be a dependency and use the new TryGhost repo, which
  includes some minor fixes and improvements, such as supporting devDeps

- Updates the GitHub workflows to run the build command in the top level
  directory rather than ghost/core so that other packages are built, too.
2023-05-03 14:32:31 -04:00
Fabien "egg" O'Carroll
be28283b36 Added support for --all and --offline to yarn dev
The --all flag will run all of our apps and services including Stripe
The --offline flag will disable any network services, e.g. Stripe
2023-05-01 13:00:37 -04:00
Daniel Lockyer
ada28188a3
Dropped Node 14 from CI
refs https://github.com/TryGhost/Toolbox/issues/570

- Node 14 is now EOL so we don't need to support and run tests for it
2023-05-01 15:07:20 +02:00
Daniel Lockyer
f2f3f5cf79
Allowed secrets to passthrough to re-usable workflow
- this is needed so we can pass the secrets down the workflow chain
2023-04-20 08:52:29 +01:00
Daniel Lockyer
fcb100141b
Allowed secrets to be passed to child workflows
- we need this so the Canary build can access our repo secrets
2023-04-19 15:13:52 +01:00
Daniel Lockyer
e30a386e67
Updated PR template to just auto-generate the summary
- Copilot for PRs is cool but quite verbose, so I think just showing the
  summary is more useful
2023-04-10 10:35:52 +02:00
Daniel Lockyer
aaaedbf715
Removed extra line in PR template
- turns out some of the descriptions are actually pretty good, but we wanna reduce the amount of lines in the template
2023-04-07 09:24:50 +02:00
renovate[bot]
9217a5fd9c Update peter-evans/create-or-update-comment digest to e21423b 2023-04-06 19:56:55 +02:00
Daniel Lockyer
5536d0ae9e Removed hiring link from PR template
- we're currently pausing hiring for new product engineers to let the
  new ones settle in
2023-04-05 15:09:56 +02:00
Daniel Lockyer
52aadd4134
Added Copilot prompts to PR template
- we're beta testers for the feature so let's give it a go
2023-04-05 15:04:11 +02:00
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
renovate[bot]
c5316966e3 Update peter-evans/create-or-update-comment digest to 3383acd 2023-04-05 09:46:26 +02:00
Daniel Lockyer
11183e34b6
Added workflow to label i18n PRs
- this helps us track i18n PRs by labelling them as such
2023-04-05 09:28:43 +02:00
renovate[bot]
db7d52b8ca Update peter-evans/create-or-update-comment digest to 9c63576 2023-04-05 09:25:07 +02:00
renovate[bot]
bfeb2a0169 Update peter-evans/create-or-update-comment digest to 3d6c0b9 2023-04-04 09:04:23 +02:00
Daniel Lockyer
ec9181921b
Fixed preventing git submodules from being committed
- because we now ignore git submodule changes, they didn't show up in
  `git diff --cached...`, so it was possible to get submodules to be
  committed
- you can re-enable submodules to be shown with `--ignore-submodules=none`
- this implements that
- we never want to allow submodules to be committed, so I've removed the
  prompt for faster feedback
2023-03-28 12:16:46 +02:00
Daniel Lockyer
846a9cdafc
Fixed pre-push hook running when pushing to fork
- this prevents the unit tests running if you're pushing to a fork,
  which we don't care about because it doesn't block the upstream `main`
2023-03-23 17:31:06 +01: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
6207766ce7
Migrated from nodemon to native Node --watch
fixes https://github.com/TryGhost/Toolbox/issues/493

- `nodemon` doesn't properly wait for graceful shutdown if there's a job
  running in Ghost when it tries to reload, so it ends up producing
  errors because two versions of Ghost are started
- Node 18 added a `--watch` flag, which reloads if any required file is
  changed
- switching from nodemon to this native feature should keep the
  core functionality the same but fix this edge case that disrupts the
  development flow
2023-03-21 15:57:41 +01:00
Daniel Lockyer
0ec539f084
Switched browser tests back to standard CI machines
- these larger machines aren't giving us much benefit and cost more
  money, so we're better off with the standard machines right now
2023-03-20 21:34:18 +01:00
Daniel Lockyer
cad7082aee Added concurrency group to Browser tests
- by using the same group (the workflow name), we should be able to
  limit the concurrency to 1 execution, which might help with some
  flaky tests we keep seeing
2023-03-17 16:35:17 +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
renovate[bot]
101549b3df Update asdf-vm/actions action to v2 2023-03-17 15:15:35 +01:00
Daniel Lockyer
3302f4125e
Added support to yarn dev for --search to launch Sodo-Search
refs https://github.com/TryGhost/Toolbox/issues/400

- this makes development more fluid by allowing developers to use the
  local Sodo-Search code
2023-03-17 11:51:42 +01:00
Daniel Lockyer
f06ee87787
Removed myself as a CODEOWNER for migrations
refs https://ghost.slack.com/archives/C02G9E68C/p1678726901892459

- following a procedure update, I am no longer required to review
  migrations so I can remove myself as a CODEOWNER for those paths
2023-03-13 18:06:35 +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
0c6a0c64d1
Revert "Temporarily removed Slack notification from failed browser tests"
This reverts commit 9fde77a95c.
2023-03-09 10:30:53 +01:00
renovate[bot]
d7a3e961c6 Update peter-evans/create-or-update-comment digest to 44526e3 2023-03-09 10:18:15 +01:00
Daniel Lockyer
9fde77a95c
Temporarily removed Slack notification from failed browser tests
- this is becoming far too noisy and there are some dependency issues we
  need to fix first
2023-03-07 12:18:28 +01: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
renovate[bot]
6184bbcceb Update peter-evans/create-or-update-comment digest to b1fa5d5 2023-03-01 08:45:32 +01:00
renovate[bot]
41e01f6531 Update peter-evans/create-or-update-comment digest to c5a7a98 2023-02-28 19:09:58 +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
renovate[bot]
3e4cb3f85e Update peter-evans/create-or-update-comment digest to 300bfad 2023-02-16 15:01:36 +01:00
renovate[bot]
aa6242eb6d Update peter-evans/create-or-update-comment digest to 521ce1b 2023-02-07 09:45:48 +01:00
Daniel Lockyer
a8726036f5
Added Slack notification to Playwright tests
refs https://ghost.slack.com/archives/C02G9E68C/p1675094899771479

- this allows the team to know sooner when we've broken the Playwright
  tests
2023-01-31 08:56:51 +01:00
Daniel Lockyer
672d6b3f90
Added migration label to PRs containing migrations
- this helps us to filter PRs for migrations in the future
2023-01-26 15:46:47 +01:00
renovate[bot]
bac75b5d1d Update peter-evans/create-or-update-comment digest to e0e8aa0 2023-01-26 12:46:01 +01:00
renovate[bot]
e4d79a0bcf Update peter-evans/create-or-update-comment digest to 2cabc73 2023-01-20 14:11:31 +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
renovate[bot]
9d577a2d5a Update peter-evans/create-or-update-comment digest to 66af805 2023-01-03 18:48:48 +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
renovate[bot]
24274fec0b Update actions/stale action to v7 2023-01-02 18:03:54 +01:00
renovate[bot]
ed6abe60be Update peter-evans/create-or-update-comment digest to 69c3c2d 2022-12-13 11:04:20 +07:00
Daniel Lockyer
7f8f5205e2
Updated suggested fix when yarn dev fails
- `yarn fix` is much more likely to fix dependency problems because it
  clears the cache and re-runs `yarn`
2022-12-12 17:23:51 +07:00
Daniel Lockyer
f8dbda4629
Disabled browser tests on pull requests
- these tests shouldn't be running on pull requests yet as they don't
  have access to the environment secrets they currently require
2022-12-06 15:49:23 +07:00
Sam Lord
fe99a000f1 Enable browser job on workflow_dispatch
refs: https://github.com/TryGhost/Toolbox/issues/481
2022-12-05 14:48:39 +00:00
Sam Lord
d3716007bf
Fixed browser-based tests running in CI
refs: https://github.com/TryGhost/Toolbox/issues/481

* Correctly setup environment variable to run both local & staging browser-based tests
* Use non-production Ghost Admin build, since production builds require HTTPS to use Stripe Connect
2022-12-05 13:39:10 +00:00
Sam Lord
74d0fee125 Set a default environment for browser tests
no issue
2022-12-02 17:04:04 +00:00
Sam Lord
00d223991d Improved browser test CI integration
refs: https://github.com/TryGhost/Toolbox/issues/481
2022-12-02 17:04:04 +00:00
Daniel Lockyer
bc0b1f6adc Added CI for running Playwright tests
🚧
2022-12-02 17:04:04 +00:00
Sam Lord
8b80233ae6 Added sample Portal test to PlayWright suite
refs: https://github.com/TryGhost/Toolbox/issues/479
2022-11-24 17:47:04 +00: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
e1a6a083a5
Removed nested quotes
- for some reason these aren't working with the GitHub Actions workflow
2022-11-04 10:52:06 +07:00
Daniel Lockyer
0609ec2525
Fixed create-release-branch failing with non-core tags
- the create-release-branch workflow works by getting the most recent
  tag, bumping it and using that to create the new tag
- now we've moved Portal into the monorepo, we've got two different
  types of flags, but the Portal ones aren't valid semver so the
  workflow fails if the most recent tag is one for Portal
- this fixes that by ensuring we only fetch tags matching the pattern we
  use for tagging Ghost
2022-11-04 10:38:22 +07:00
Daniel Lockyer
077ff89960
Removed pre-commit linting on non-main branches
- our use-case for this is to ensure that people don't push to
  `main` without running linting, as this can block CI from passing
  until the linting issue is resolved
- however, it can become annoying to run linting on non-main branches,
  especially when you just want to WIP some changes without caring for
  linting
- generally speaking, anyone who creates commits on a non-main branch is
  going to open them as a PR, so linting is run anyway
- this commit get the branch name and only runs linting if we're on
  `main`
2022-10-27 11:47:10 +07:00
Daniel Lockyer
3da7040e32
Removed verbose error logging for yarn dev failures
fixes https://github.com/TryGhost/Toolbox/issues/459

- in the situation where the `yarn dev` command fails, it pumps out a
  massive error message, which is incredibly distracting to the dev
  experience
- this changes the output to just be a log line with some suggestions on
  how to fix it
2022-10-27 11:25:43 +07:00
renovate[bot]
14dfd618c3 Update peter-evans/create-or-update-comment digest to 7305482 2022-10-20 10:24:34 +07:00
Daniel Lockyer
31235dcd04
Improved commit message docs in contributing guide
- `refs/closes` can be confusing to those who are not familiar with GitHub when we actually mean "use refs or fixes (or closes)"
- we generally don't want to use emojis for alpha features because adding it to the release notes is unnecessary until the feature is GA
2022-10-13 09:56:14 +07:00
Daniel Lockyer
e11636b6f8
Fixed execution path for lint commands in lint-staged
refs https://ghost.slack.com/archives/C02G9E68C/p1665497363885949

- we've seen an issue with `lint-staged` in the Admin package because it
  doesn't pick up the lint-todo file, so it incorrectly flags linting
  issues that we're ignoring
- this is happening because it runs the command from cwd, where the lint
  exclusion file does not exist
- thankfully, `lint-staged` has `--relative` which will run the command
  from the directory where the command is defined in config, so `ghost/admin`
  in our case, and that means the lint file is present and picked up
2022-10-11 21:54:58 +07:00
Daniel Lockyer
a37b2cd24e Switched to Husky + lint-staged for git hooks
- up until this commit, git hooks were only used by a handful of people
  because they were a pain:
  - they'd only be set up when you did `yarn setup`
  - the existing hooks ran `yarn lint` on all projects, which was
    incredibly slow
- as a result, not many of us actually had them enabled, but this would
  cause issues in CI because people were pushing un-linted commits
- other JS projects tend to use husky to automate the git hook setup and
  lint-staged to speed up linting on changed files
- this commit switches to using them both
  - `lint-staged` only runs `eslint` on staged JS files that are about to
    be committed - if there's a linting error, it will stop the commit
  - I've configured the pre-commit hook to successfully exit in CI because we
    don't want to run pre-commit hooks right now
- this means we can remove Grunt - yay!
2022-10-10 15:10:48 +07:00
Daniel Lockyer
0ecc6dc238
Added note about fetching the Stripe secret token
- this helps debug what is happening and when
2022-10-06 16:56:05 +07:00
Daniel Lockyer
7308bb9122
Switched to accessing config loader directly
- I lowered the code coverage on the repo to the point where
  it started failing because I added a new export to the config library
- this wasn't easy to add tests for because the existing config tests
  use the loader directly and not the library export
- instead, I'm just going to make the dev script access the loader, and
  make a note to clean this up in the future when we pull out the config
  module
2022-10-06 16:25:29 +07:00
Daniel Lockyer
0bfbee5523
Fixed yarn dev --stripe ignoring HTTPS configured sites
- because the cwd of `.github/dev.js` is not `ghost/core`, it doesn't
  pick up config.local.json files, so any configuration you set in there
  isn't applied
- this meant that developers with HTTPS configured locally couldn't use
  `--stripe` because it wouldn't configure the Stripe listening URL
  correctly
- this adds an exports to the config lib to allow passing options in,
  which I then utilize to pass the directory that config resides in
- this should fix the aforementioned problem with HTTPS
2022-10-06 15:58:51 +07:00
Daniel Lockyer
a35d388543
Fixed missing return when fetching Stripe key fails
- we should protect against the stripe command throwing an error because
  it's not installed or it errors etc
2022-10-06 15:42:19 +07:00
Daniel Lockyer
28cc88c2cd
Added --stripe support to yarn dev
refs https://ghost.slack.com/archives/C02G9E68C/p1665043198507819?thread_ts=1664955131.950719&cid=C02G9E68C

- this adds support for `yarn dev --stripe` which will spin up the
  Stripe CLI to listen for webhooks, and configures Ghost with the
  secret key it needs to communicate
- also fixes a minor typing error with a missing `env: {}`
2022-10-06 15:32:08 +07:00
Daniel Lockyer
ab99109bbf
Added support for running Portal from the monorepo
refs https://github.com/TryGhost/Toolbox/issues/426

- this adds support for `--portal` in `yarn dev` to support the upcoming
  migration of Portal into the monorepo
- also adds the Portal folder to the ignorelist for nodemon so Ghost
  doesn't bootloop
2022-10-05 11:51:06 +07:00
Hannah Wolfe
0b41fbf102
Updated hiring links
- Ghost is still hiring, but we've split our product engineer into two and the URL has changed
2022-09-30 19:56:26 +01:00
Daniel Lockyer
0a322574a8
Increased frequency of stale bot execution to hourly
- daily is a little to infrequent for us as it means new comments don't
  cause the issue/PR to be unlabeled as `stale` for up to 24hrs
- this commit increases the frequency to hourly
2022-09-29 16:10:49 +07:00
Daniel Lockyer
6de598dec9
Loosened restrictions on GHA label-actions workflow
refs https://github.com/TryGhost/Toolbox/issues/381

- when using `pull_request`, the workflow doesn't have permissions to
  write to the PR in question
- there is another trigger - `pull_request_target` - but this comes with
  a heap of security warnings
- our use of it should be OK because we're only checking out our own
  Action and not code from the PR
- this commit also adds permissions to specify we only want write access
  to issues and PRs
2022-09-29 11:39:35 +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
renovate[bot]
f0a37a36ba Update actions/stale action to v6 2022-09-23 15:21:51 +01:00
Daniel Lockyer
2bff2a22e0
Extracted dev tooling to separate script
refs https://github.com/TryGhost/Toolbox/issues/426

- we're going to need to support more complex combinations of dev
  commands soon, with other packages optionally running and env
  variables being altered
- this command pulls out a lot of the dev env scripting into a single
  scripts
- also cleans up the use of grunt-shell so we can remove the dependency
2022-09-23 15:02:35 +02: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
renovate[bot]
82d5d20aa0 Update peter-evans/create-or-update-comment digest to 6fcd282 2022-09-13 09:17:20 +01:00
Daniel Lockyer
914775d55f
Fixed creating release branches
- we didn't clone the repo at the point when we were running a git
  command, so that failed
- switched to a different method of checking out `main` and then
  checking out the most recent tag
2022-09-06 15:46:49 +01:00
Daniel Lockyer
e80ab4fc46
Added support for latest when creating release branches
- this should allow us to run the job without any manual effort, because
  it'll choose the latest tag for the patch release
2022-09-06 15:39:10 +01:00
Daniel Lockyer
064e91fb2d
Added pull_request event type to label actions workflow triggers
refs https://github.com/TryGhost/Toolbox/issues/381

- we want to start collecting events from pull requests so we can label
  and reply upon certain events
- this adds the `closed` and `labeled` events to the workflow triggers
2022-09-05 11:53:46 +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
82c3e6b6a4
Fixed several issues with create-release-branch job
- uses the `semver` bash tool so we don't have to deal with NPM
  dependencies
- also cleans up the env variables
2022-09-01 21:23:26 +01:00
Daniel Lockyer
4e85343a94
Installed semver globally in CI workflow
- if we install it locally, it'll run into issues with colliding with
  Ghost's package versions
2022-09-01 20:48:25 +01:00
Daniel Lockyer
4ba26364a7
Added workflow to create release branches
- right now, we use an internal CI solution to create branches for patch
  releases, but it's difficult to use
- this workflow should allow the team to create release branches from
  the GitHub UI, without delving into our internal tooling
2022-09-01 20:43:07 +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
renovate[bot]
19befe7d56 Update peter-evans/create-or-update-comment digest to 5fdb3a6 2022-08-29 08:34:13 +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
renovate[bot]
30a9b5d1fa Update peter-evans/create-or-update-comment digest to 7aef7e4 2022-08-19 10:17:25 +02:00
Daniel Lockyer
d3a8b64f20
Added name to Custom build workflow
- this was missed from the previous commit but makes it prettier to read
2022-08-19 08:54:38 +02:00
Daniel Lockyer
f133e6af4d
Added workflow to build custom version of Ghost
refs 7913283c96

- you can supply a branch and a version to call it, and it'll produce a
  zip of the tarball you can use
- this should avoid the need for local builds, which are error prone
2022-08-19 08:52:33 +02:00
Daniel Lockyer
e77fedf9b2
Allowed label actions workflow to be run manually
- we might want to manually trigger the workflow outside of the
  schedule/event-driven flow
2022-08-17 09:26:56 +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
fa25b72495
Disabled stalebot on PRs
fixes https://github.com/TryGhost/Toolbox/issues/350

- we don't want to mark PRs as stale because they might contain
  wonderful contributions ❤️
2022-08-08 21:31:20 +02:00
Daniel Lockyer
5b6544504b
Configured stale issues to be closed as not_planned
- if an issue goes stale, it shouldn't show up in GitHub as completed
2022-08-08 12:57:19 +02:00
Hannah Wolfe
6d6fd15e87
Update CONTRIBUTING.md
- remove references to defunct admin repo
2022-08-05 16:06:26 +01: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
72411a3a4a
Added workflow_dispatch trigger to Release workflow
- this allows us to manually trigger a release from a tag
2022-07-26 09:31:20 +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
8dd2b036ab
Added Release workflow
- this re-adds the Release workflow using a templated Action
2022-07-25 08:36:42 +02:00
Daniel Lockyer
cff4772d50
Removed Members packages from auto-assign rules
- there won't be any package bumps matching this now they are merged
  into this monorepo
2022-07-22 12:40:29 +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
70110a39cc
Deleted Release GitHub Action
- I don't want it accidentally triggering whilst I'm importing packages,
  and it's likely to change anyway in the near future
2022-07-20 17:16:07 +02:00
Daniel Lockyer
6f1e7fc40f
Fixed migration review action target paths
- now we've moved to a monorepo, the paths have changed
2022-07-20 16:50:33 +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
8be9db7bcf
Merged v5.4.1 into main
v5.4.1
2022-07-19 16:01:04 +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
48194ff444
Refactored release workflow
- up until now, we've been running `grunt release` before publishing to
  NPM or pushing the canary zip
- this command runs the production asset build and generates a zip
- this zip isn't used by the NPM publishing task because that does an
  `npm pack`
- we only use it for the canary build, but this should be brought more
  inline with the NPM process to make the gaps smaller
- this commit refactors the `grunt release` task to become a lot smaller
  by removing the generated zip steps
- the expected workflow is now to just to an `npm pack`, which will run
  the `prepack` task to generate a `.tgz` archive
- this should still respect `.npmignore`, so it'll just include the
  files we expect
- the test of the canary workflow is being updated to handle this
- also cleans up a dev dependency that is no longer used, along with 2
  imports
2022-07-19 08:32:54 +02:00
Renovate Bot
dc3a6a4eaa Update peter-evans/create-or-update-comment digest to b95e16d 2022-07-07 08:59:57 +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
264678e9be
Prevented certain GitHub Actions workflows from running on forks
fixes https://github.com/TryGhost/Toolbox/issues/285

- without this, some of the workflows that are only useful for the core
  team will run on forks
- this commit adds checks to ensure we're running on a repo maintained
  by the TryGhost organization for a handful of workflows
2022-06-01 17:54:26 -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
Naz
bc464f8930 Fixed file permissions on pre-push hook
refs 002cf5b0eb

- The hook file has to be executable to be triggered in the pre-push stage:

hint: The '.git/hooks/pre-push' hook was ignored because it's not set as executable.
2022-05-05 22:09:44 +08:00
Naz
002cf5b0eb Moved linting check to pre-push git hook
refs 81cd5fac7e

- While developing locally it's common to commit small WIP changes which might contain linting errors. Having the check done once on a pre-push phase gives enoght protection from pushing out broken code and reduces frustration when developing locally
2022-05-05 21:36:56 +08:00
Naz
81cd5fac7e Added linting check to a pre-commit hook
refs 648530009d

- Naz has broken the main too many times - it's time to stop the atrocities.
- Having a lint check as a pre-commit hook will make it really hard commiting code with linting errors
2022-05-05 21:21:48 +08: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
5d17e7b777
Changed auto assignee for TryGhost Members packages
- the most suitable person for these packages is now Rish
2022-04-07 06:10: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
c187b3d182
Extracted Canary workflow to template
refs 4aee97472e

- the referenced commit copied the workflow file to our shared templates
  repository
- this commit switches to using that template
- this should help reduce duplication when we're doing v5
2022-03-31 08:27:18 +01:00
Renovate Bot
bf6188e331 Update peter-evans/create-or-update-comment digest to 26f0786 2022-03-28 14:30:20 +01:00
Renovate Bot
96503862bf Update peter-evans/create-or-update-comment digest to 704bc87 2022-03-24 12:07:09 +00: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
Matt Hanley
cd081e46fb Removed migration requirement for sqlite 2022-03-04 11:27:04 +00:00
Renovate Bot
e4df868886 Update actions/upload-artifact action to v3 2022-03-04 11:02:53 +01:00
Renovate Bot
5220083470 Update actions/stale action to v5 2022-03-03 14:56:07 +01: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
Renovate Bot
83af4795e2 Update actions/checkout action to v3 2022-03-02 08:06:56 +01:00
Renovate Bot
d87a8f1a6e Update actions/setup-node action to v3 2022-03-01 08:31:42 +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
33d4a711e0
Fixed inputs being passed as env variables in CI
- turns out we need `github.event` prepended to the variable for it to
  work
2022-02-17 12:25:30 +01:00
Daniel Lockyer
b1bb2ad8e8
Fixed syntax of inputs in CI workflow
- the inputs should be under an `inputs` key - not sure where that went
  missing
2022-02-17 12:20:29 +01:00
Daniel Lockyer
1a0362f3db Added demo E2E browser test
refs https://github.com/TryGhost/Toolbox/issues/207

- we want to start writing some E2E tests that involve automated
  pointing and clicking around the frontend of Ghost to test that
  members of Ghost sites can still do what we expect
- we've decided to look in to Playwright for this - it looks __really__
  nice
- this is a VERY basic first test - it'll check for a 200 on the
  homepage of whatever we provide as the TEST_URL env variable, or
  default to a (manually-run) Ghost instance on port 2368
- also adds a `yarn test:browser` command to run the tests using the
  Playwright CLI, and a sample GitHub Action workflow which we can
  manually run with a site URL
- there's a lot more to add here in terms of test framework but this
  gets us started
2022-02-17 12:16:58 +01: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
Daniel Lockyer
f55f2b1587
Added check for Ghost-CLI logs in CI
no issue

- we might fail the tests but not produce any logs in Ghost-CLI
- concatenating the logs would then fail because of the lack of existence
  of a directory
- this commit adds a check that files exist before trying to get the
  contents of the files
2022-02-04 09:40:26 +01:00
Renovate Bot
79609632b1 Update peter-evans/create-or-update-comment commit hash to 63e171a 2022-01-31 08:45:43 +00:00
Daniel Lockyer
2122a47ce0 Added MySQL 8 to CI tests
refs https://github.com/TryGhost/Toolbox/issues/181

- we officially support MySQL 8 but we don't run tests for it -- oops
- this commit adds MySQL 8 to the DB matrix in CI tests
- I had to switch to a fork of the `mysql-action` repo so I could get
  the native authentication plugin working, but I expect to revert this
  once we've merged support for mysql2
2022-01-25 12:23:15 +00:00
John O'Nolan
b004f5a705
Updated PR template with careers CTA 2022-01-20 12:21:06 -05:00
Daniel Lockyer
34e8c299e7
Added concurrency option to test workflow in CI
refs
https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-a-fallback-value

- CI sometimes becomes clogged up with concurrent runs for a PR if the
  PR is updated
- this sometimes happens when we merge a bunch of Renovate PRs and other
  PRs rebase on top of `main` multiple times
- we shouldn't continue to run tests for PRs if the branches have been pushed
  to since they started
- from the referenced link above, this is the built-in solution that
  cancels previous in-progress runs if a new job starts
2022-01-14 10:26:26 +00:00
Joe Grigg
60ff6d4267 Updated github release action to use new main branch of ghost-release
no issue

- We have switched over to using the new git standard of using the main branch rather than master.
2022-01-11 16:09:58 +00:00
Sam Lord
845ed665f0 Prevent TailScale failures from breaking the build
no issue

Includes a timeout if TailScale is completely inaccessible, and a
continue-on-error statement which should handle all forms of
failure. The following step also includes a continue-on-error step, as
reporting metrics depends on TailScale succeeding, and should also
never fail the build.
2021-12-14 09:37:38 +00:00
Sam Lord
928a30bd98 Prevent TailScale from trying to run in pushes to main branch on forks. 2021-12-06 15:28:05 +00:00
Renovate Bot
74f45669d2 Update peter-evans/create-or-update-comment commit hash to ad0c5a2 2021-12-03 09:51:13 +00:00
Oscar Dominguez
141f794750
Added yarn cache to CI workflows (#13716) 2021-11-30 08:01:22 +00:00
Daniel Lockyer
aec14e5cf3
Disabled FORCE_COLOR on setup-node GitHub Action
refs https://github.com/TryGhost/Ghost/pull/13716
refs https://github.com/actions/setup-node/issues/317#issuecomment-929694556

- the `setup-node` GitHub Action seems to use a shell command to get the
  cache path, but these are colorised when `FORCE_COLOR` is enabled
- this causes the Action to fail to read the path correctly
- the comment referenced above suggests to remove `FORCE_COLOR` but it's
  nice to have colored output for our tests
- instead, I'm disabling the environment variable on the `setup-node`
  action so it still works
- I've tested with the referenced PR and this unblocks dependency caching 🎉
2021-11-25 09:11:35 +01:00
Daniel Lockyer
b1ee741ddb
Added issue closed event to triggers for label action
refs 2a19e6151c

- we want to ensure that the `needs triage` label is removed when an
  issue is closed
- the event was handled in the labelling Action but it needs the event
  adding here to trigger execution
2021-11-18 11:05:49 +01:00
Renovate Bot
c2fe04f681 Update actions/stale action to v4 2021-11-15 08:23:54 +00:00
Matt Hanley
1477d2712b Pinned GH Action for migration PR workflow to a specific commit
no-issue
- The workflow runs in the pull_request_target context which has access to repo secrets even when triggered from a fork
- Pinned the GH Action to a specific version to guard against upstream changes to the Action which may abuse access to secrets
2021-11-12 15:49:41 +00:00
Daniel Lockyer
9768ad42c4
Configured stalebot to run at 15:00 UTC
refs https://github.com/TryGhost/Toolbox/issues/81

- changes the bot to run during office hours so we can keep an eye on it
2021-11-12 14:44:54 +00:00
Daniel Lockyer
0847340b9a
Switched to GitHub Action for handling stale issues + PRs
refs https://github.com/TryGhost/Toolbox/issues/81

- https://github.com/actions/stale is the official way to handle stale
  issues and PRs and our old method hasn't worked for a while
- most of this is copied from [Ghost-CLI's stale
  workflow](https://github.com/TryGhost/Ghost-CLI/blob/main/.github/workflows/stale.yml)
  but the comment contents and labels have been updated
- also removes the config for the broken, existing method
2021-11-12 14:21:12 +00:00
Daniel Lockyer
bf4ae212fd
Switched to custom issue labeling bot
refs https://github.com/TryGhost/Toolbox/issues/81

- the existing `label-actions` tooling was deprecated and shut down but
  after reviewing, it wasn't expressive enough for our workflow use cases
- we wanted a tool we could drop into our repos and it works without
  extra configuration
- I've developed the `tryghost/label-actions` GitHub Action which will
  supports all our labeling flows for triaging
- this commit switches the repo over to using that
- configured the scheduled tasks to run at midnight daily
2021-11-12 10:57:27 +00:00
Hannah Wolfe
69f66a6efb
Switched our old style bug report template to a form
- this is a beta feature in GitHub rn but it's _really_ nice!
- hopefully this will help us get bug reports we can deal with more efficiently
2021-11-12 10:30:08 +00:00
Sam Lord
0955caf311 Prevent Tailscale running in PRs on forks 2021-11-11 10:17:08 +00:00
Sam Lord
e4487c395c
Add metrics for test duration in Github workflow
refs: https://github.com/TryGhost/Toolbox/issues/118

Previously would attempt to run in forked repos, but couldn't access secrets so just hung.
2021-11-11 09:26:11 +00:00
Matt Hanley
64e8fdf4bb
Added migration review checklist (#13711)
no issue
- Adds a comment to PRs containing migrations with a checklist for the reviewer to complete
2021-11-05 09:33:55 +00:00
Matt Hanley
a1ebdc8330 Updated test command in the PR template
no issue
- The correct command for running all tests is now `yarn test:all` instead of `yarn test`
2021-11-04 14:06:42 +00:00
Sam Lord
b79870d48c Revert "Added metrics for test runs"
This reverts commit e9afa6f40f.

Reverting because the TailScale step sometimes crashes the build
2021-11-01 13:31:43 +00:00
Sam Lord
e9afa6f40f
Added metrics for test runs
Refs CORE-120

When test runs execute, use the new @tryghost/metrics package to send metrics to configurable backends.

At the moment, we're just sending the test run duration to our metric store in preparation of changes to the test suite.
2021-10-28 14:15:48 +01:00
Daniel Lockyer
f4b48c1373 🔥 Added support for Node 16
refs https://github.com/TryGhost/Toolbox/issues/71

- Node 16 is now LTS so we're adding support in Ghost
- we're also bumping the minimum Node 14 version to 14.17.0 so we can merge
  dependencies who have higher Node 14 requirements than current
- this commit adds Node 16 to the `package.json` engines and to CI
- also bumps all dependencies that needed new versions to add Node 16
  support
2021-10-27 11:39:42 +01:00
Daniel Lockyer
32b325eb4c Added codecov.io coverage uploader to CI
refs linear.app/tryghost/issue/CORE-74/improve-the-test-situation

- this commit adds the codecov GitHub Action into CI so we can upload
  coverage reports
- the coverage files need to be in XML for them to work with
  codecov, so this commit also adds cobertura (XML) as a reporter
2021-10-20 15:12:07 +02:00
Hannah Wolfe
bcf19c8fe2
Fixed CI not running integration tests
refs: 726db1c0e

- I totally forgot/missed that we run each test suite individually on CI, rather than using `yarn test:all`
2021-10-14 12:24:16 +01:00
Hannah Wolfe
1dec3d56b1
Renamed our acceptance tests to "e2e"
- These are end-to-end tests, make it clearer what they are and what they are supposed to do
2021-10-06 12:40:52 +01:00
Daniel Lockyer
0d5b836557
Added RELEASE_NOTIFICATION_URL secret to release workflow
refs https://linear.app/tryghost/issue/CORE-38/automate-releases

- this is a notification endpoint which we pass down to the
  `action-ghost-release` GitHub Action to create notifications when the
  release is done
2021-09-28 16:45:30 +01:00
Daniel Lockyer
99d601bc9f
Moved GITHUB_TOKEN env variable to workflow scope
no issue

- the CLI install extension step also needs the token so it's just best
  to include it globally in the workflow
2021-09-09 09:49:08 +01:00
Daniel Lockyer
d897942af7
Added auto-assign workflow to pull requests
no issue

- Renovate will open PRs to bump dependencies but these are unassigned
- Renovate does have the ability to set assignees, but these are blanket
  assigns not based upon the package that is being upgraded
- we want to assign them to the owners of the package that is being
  upgraded
- I've created the `gh-auto-assign` GitHub CLI exntension which reads a
  `.github/AUTO_ASSIGN` file and assign PRs based upon the entries listed
- this commit adds the initial `AUTO_ASSIGN` file and GitHub Actions
  workflow to trigger when a PR is opened
2021-09-08 10:12:31 +01:00
Daniel Lockyer
c7f45f5580 Renamed coverage:unit command to cov:unit
no issue

- this is slightly quicker to type and cleaner to read
2021-08-26 15:06:45 +02:00
Daniel Lockyer
70bea3ddf8 Added c8 coverage to unit tests
no issue

- coverage allows us to see how much of our code we're hitting in tests
  and it's time we started to get visibility on this in Ghost
- we can then make informed decisions on which well-tested internal libraries
  can be pulled out into their own packages
- this commit:
  - adds the c8 dev dependency to Ghost
  - prepends the `test:unit` command with c8 with the `text-summary` reporter
  - adds a `coverage:unit` command to get the `text` report
    - you can do `yarn coverage:unit --reporter html` to get a HTML report etc
  - uses this new test coverage reporter command in CI tests
2021-08-20 12:42:11 +02:00
Daniel Lockyer
fe3355276f
Included v4.* branches in CI testing
no issue

- as we're making more and more use of branches for releases, we want
  tests to run on them
- this commit adds the v4 wildcard to the GitHub workflow so it'll
  trigger when we push to them
2021-07-22 15:21:36 +01:00
Daniel Lockyer
7fe943bb49
Updated CI release workflow to use built-in token
no issue

- `RELEASE_TOKEN` is currently a GitHub personal token, but this
  has some downsides:
    - if the token ever expires and I'm unaware, it'll break the release
      process
    - GitHub Releases say the creator was `daniellockyer` even if someone
      else actually did the release
- this commit switches over to using the built-in `GITHUB_TOKEN`, which
  is owned by the `github-actions` app and should never expire
- aside from that, Ghost releases will be created by the neutral
  `github-actions` account
2021-07-12 13:14:55 +01:00
Daniel Lockyer
6eba445f23
Fixed canary build after yarn command changes
refs 7e6800b2b8

- referenced commit deprecated `grunt main` in favor of `yarn main` but
  this wasn't updated so we never installed dependencies for Admin,
  which caused the build to break
- this commit switches to the new command
2021-07-06 10:22:07 +01:00
Hannah Wolfe
7e6800b2b8
Improved dev tooling (#13118)
This commit achieves a few things:

- ☑️  No longer having to remember whether a command is yarn something or grunt something
- ☑️  Simplification of tools hopefully making them easier to remember and use 
- ☑️  Complete removal of the need for grunt from our test tooling

Several of the tools still use grunt under the hood, but the **entrypoint** should aways be `yarn xxx`.

- `grunt main` -> `yarn main`
- `grunt dev` -> `yarn dev`
- `grunt build` -> `yarn build`
- `grunt test:file-or-folder` -> `yarn test file-or-folder`
- `grunt test-unit` -> `yarn test:unit`
- `grunt test-acceptance` -> `yarn test:acceptance`
- `grunt test-regression` -> `yarn test:regression`
- `grunt validate` -> removed due to lack of use

There is now also `yarn test:all` to run all 3 classes of tests

This PR also reorders & restructures the Gruntfile extensively so that:

- The remaining useful commands are all at the top of the file
- Config and other blah happens after all the useful commands
- All release-only config happens in the release task at the very end of the file

---

DONE:

* Removed all references to npm/bower
* Removed all references to lint / deprecated command
* Moved debug to yarn dev:debug
* Removed all references to travis
* Removed broken help task + useless comment
* Removed unused knex-migrator and clean:test setup tasks
* Added new test commands, removed grunt validate
* Moved stubClientFiles to test utility and use in the few tests that need it
* Used mocha in yarn directly except grunt test:x
* Swapped grunt test for yarn test
* extensive cleanup and reshuffling
2021-07-05 20:02:22 +01:00
Daniel Lockyer
d25b8680f4
Added CI step to print debug logs upon CLI failure
no issue

- if Ghost-CLI tests fail, the CLI will put some extra debug logs in
  `~/.ghost/logs`
- these are useful to help see what the issue is, so we should print
  them out if we're experiencing a failure
- this commit cats the contents of the folder so we can see it in CI
2021-06-09 13:51:55 +01:00
Daniel Lockyer
84bfbae282
Extracted canary build to separate workflow
no issue

- by extracting it to a different workflow that uses the
  `workflow_dispatch` trigger, we can manually run a build, but also
  trigger it from Admin so we can always stay up-to-date
2021-06-01 17:04:16 +01:00
Daniel Lockyer
bbeeb83235
Updated Canary builds to use preminor versioning
no issue

- we want to use `preminor` so it'll run migrations for the unreleased
  version if they are present
2021-05-21 16:40:06 +01:00
Daniel Lockyer
28f125926c
Updated release workflow to use Node 14
no issue

- Node 14 is now our recommended version and it's easier if we build
  Ghost with this version
- this also works around the fact that 12.18.0 would no longer build
  Ghost because we have bumped our minimum 12 version
2021-05-10 20:41:38 +01:00
Daniel Lockyer
4385070881
⬆️ Bumped minimum Node version to 12.22.1 and 14.16.1
refs https://nodejs.org/en/blog/vulnerability/april-2021-security-releases/

- these are the latest security releases and we should encourage people
  to upgrade to them
- also replaces Node 12 in the tests with Node 14 as this is soon our
  recommended version
2021-05-07 14:14:46 +01:00
Daniel Lockyer
7360be5625
Disabled Ghost v1 and v2 CLI tests
refs 57ff38da8a

- we're dropping support for Node 10 which involved bumping the Node
  version we run our Ghost-CLI tests on but they fail because Ghost v1
  and v2 don't support Node 12
- this commit disables these tests until we come up with a good
  workaround
2021-05-05 14:59:20 +01:00
Daniel Lockyer
57ff38da8a
🔥 Dropped support for Node 10
refs https://github.com/TryGhost/Team/issues/658

- Node 10 become EOL as of April 30th so it's time to drop support
- this commit:
  - removes the Node 10 range from the `node` `engines` block
  - removes Node 10 from CI tests
  - switches Node 10 in the CLI test to Node 12 so we can ensure it
    installs on our oldest supported Node version
2021-05-05 14:38:14 +01:00
Hannah Wolfe
cc736a3eef
Update CONTRIBUTING.md 2021-04-20 15:44:18 +01:00
Hannah Wolfe
f247f6b3ef
Update ---bug-report.md 2021-04-13 10:53:36 +01:00
Hannah Wolfe
c99dc2f0bc
Update ---bug-report.md 2021-04-07 08:57:20 +01:00
Matthew Schmoyer
4b0a990a75
Update contributing docs to reference main branch (#12815)
no issue
2021-03-25 11:05:14 +00:00
Daniel Lockyer
35e45dbe7b
Added CI check to test updates from v3
no issue

- now we've officially released v4, we need to check updates from v3
- this commit adds a test copied from the other tests above
- also renames the steps from Upgrade to Update to match internal terminology
2021-03-17 11:52:26 +00:00
Daniel Lockyer
1155a3cd5d
Removed Casper-specific 4.0 code from CI
no issue

- the 4.0 Casper work is now in `main` and we don't need to switch
  branches any more
2021-03-10 21:49:02 +00:00
Daniel Lockyer
dc8e6be9fe
Updated canary workflow to use Casper 4.0 branch
no issue

- when building the canary zip, we currently use `main` within Casper,
  but the 4.0 changes are on the 4.0 branch
- this commit updates the workflow to checkout that branch as part of
  the pipeline
2021-03-09 08:48:59 +00:00
Daniel Lockyer
a39f15c196 Switched CI to using v4 Casper
no issue

- some new GScan changes mean that CI now throws a warning when using v3
  Casper, which causes tests to fail
- we need to switch to v4 to get the tests to pass
- we can't put v4 Casper in `main` because it'll autodeploy and be
  unusable for anyone downloading until Ghost 4.0 is released
2021-03-01 10:53:18 +00:00
Daniel Lockyer
26c49b4f57 Updated SQLite path for CI tests
- turns out GitHub Actions doesn't have /tmp as a tmpfs, so this commit
  switches to using /dev/shm, which *should* work ok
2021-02-23 16:58:31 +00:00
Daniel Lockyer
5a758ea86e Re-enabled Ghost-CLI upgrade tests
no issue

- now GScan has been updated to support v4, we should be able to run these tests again
2021-02-09 17:13:55 +00:00
Daniel Lockyer
3e39239af0
Updated actions/setup-node to v2
no issue

- amongst many other things, v2 uses a cache to download Node versions
2021-02-09 16:21:54 +00:00
Daniel Lockyer
d9a7fb0677
Fixed versioning for canary builds
no issue

- premajor will build a 5.0.0 prerelease but we want a 4.0.0 prerelease
  built
2021-02-03 09:29:04 +00:00
Daniel Lockyer
a2d97de09a
Updated test workflow to reflect branch renames
no issue

- 4.x has been renamed to main, which is now the default
- `master` is now 3.x, which is on a different set of workflows anyway
2021-02-02 18:04:38 +00:00
Daniel Lockyer
bf163bf058
Commented out select Ghost-CLI tests
no issue

- Ghost-CLI uses gscan under the hood to check the theme, but GScan has
  not yet been updated to support v4
- disabling these tests for now until it does
2021-02-02 17:21:56 +00:00
Daniel Lockyer
fb26e3d892
Updated migrations test to rollback to different versions
no issue

- in 4.0, we don't expect to rollback to 3.0 because there are
  irreversible migrations
- the existing test attempts to do this because it was written for v3
- this commit updates the test to apply to v4, although this will need
  to change soon when we switch branches
2021-02-02 16:12:54 +00:00
Daniel Lockyer
032741a5ef
Enabled tests and canary build on 4.0 branch
no issue

- we want tests to run on the 4.0 branch, along with Slack notifications
- we also want a canary build of the 4.0 branch, but this requires some
  alterations to bump to a premajor + use a different artifact name
2021-01-21 11:36:41 +00:00
Daniel Lockyer
ff11b42c33
Inlined canary build workflow into tests
- this allows us to rely on successful test steps before building a
  canary zip
2021-01-19 12:11:34 +00:00
Renovate Bot
1b0a8f5fbf Update actions/setup-node action to v2 2021-01-04 08:56:33 +00:00
Daniel Lockyer
fc9e107254 Revert "Bumped Node version used for Ghost-CLI tests"
- this reverts commit a43f4dc4de
- we can't use Node 12 here because Ghost v1 doesn't support it...
2020-11-23 11:22:23 +00:00
Daniel Lockyer
a43f4dc4de Bumped Node version used for Ghost-CLI tests
- our recommended version is Node 12 so we should use this
- possibly also solves some random CI failures we were seeing with
  sqlite3 not installing?
2020-11-23 11:18:48 +00:00
Daniel Lockyer
736c96439b Increased sleep delay before killing Ghost in CI tests
- We'd randomly see SQLite take more than 10 seconds to set up the DB in
  CI so Ghost was getting killed prematurely, causing test failures
2020-11-20 08:41:59 +00:00
Daniel Lockyer
6b8bfb81fc Fixed canary build on release commits
- because the Admin submodule has been updated, there aren't any
  differences that can be committed so we shouldn't do it
- this should check if we have uncommitted changes and only commit if so
2020-11-17 14:23:44 +00:00
Daniel Lockyer
249c4a3e83 Enabled cloning of submodules in migrations test
- we start Ghost in this test but Ghost will check Casper, which isn't
  cloned without this commit
2020-11-17 09:16:03 +00:00
Daniel Lockyer
7640fa3bee Revert "Bumped CI rollback version to 3.30"
- this reverts commit d22bbf58c7
- the issue with a migration was actually valid and we've fixed it
2020-11-11 11:59:02 +00:00
Daniel Lockyer
d22bbf58c7 Bumped CI rollback version to 3.30 2020-11-11 11:12:21 +00:00
Daniel Lockyer
d67683d7e6 Switched to running Ghost in CI migration tests
- if we only run 'knex-migrator init', the settings don't get populated like
  they would when running Ghost
- switching to running Ghost for initialization is more realistic of
  what would happen IRL
2020-11-11 10:42:13 +00:00
Daniel Lockyer
36fb04f735 Renamed workflow to Canary
- makes more sense than "zip"
2020-11-10 11:03:54 +00:00
Daniel Lockyer
361d79a8ef Added CI workflow for testing migrations
- initializes the DB, rolls back to v3.0 and then forward to the latest again
2020-11-06 13:33:39 +00:00
Daniel Lockyer
489add6e5e Pinned Node version in CI
- The default Node version on GitHub Actions is moving to Node 14 and we
  want to keep building it on 12 for now, so this commit pins the
  version to 12.18.0
2020-11-02 08:48:05 +00:00
Daniel Lockyer
b8c9ef5033 Added temporary second artifact upload
- we're changing the name but need to maintain compatibility until the
  new setup is live
2020-10-29 13:18:45 +00:00
Daniel Lockyer
52bac88136 Added Ghost & Ghost-Admin commit hashes into version
- this will generate zips with the hashes already included, and avoid
  the crazy bash further in the script
2020-10-29 12:08:16 +00:00
Daniel Lockyer
1cc58c1f95 Added GitHub Actions workflow to build the latest code
- we want to allow people to download and run the latest code in Ghost
  and Ghost-Admin from Ghost-CLI without going through the process of
  cloning the repos
- this GitHub Actions will generate a release zip and upload it as an
  artifact
- we then have a tool to download the latest artifact, which can be used
  in Ghost-CLI
2020-10-28 16:20:42 +00:00