Repository navigation
Run tests in CI before deploying, like BioSpex #88
Copy link
Copy link
Closed
Description
Bring the CI in line with BioSpex: run the tests before every deploy and on pull requests, and share one deploy workflow between production and development. Today deploy.yml deploys without running any tests, has the production and development build-and-deploy jobs copied out in full, and trusts the servers with ssh-keyscan at deploy time.
To do
-
tests.yml: runs on pull requests intomainanddevelopmentand as aworkflow_call.testjob: PHP 8.5, Composer cache,composer install --no-scripts, generate theAPP_KEYfor the run (echo 'APP_KEY=' > .env && php artisan key:generate --force, as in Generate the test APP_KEY in CI instead of committing it Biospex#531, so no key is committed),package:discover, Pint on the changed files for pull requests (vendor/bin/pint --test --diff=origin/${{ github.base_ref }}), thenvendor/bin/pest --compact(Pest 4, SQLite in memory fromphpunit.xml; no MongoDB service needed).auditjob, pull requests only:composer audit --locked. It reports but never blocks a deploy.
-
deploy-environment.yml: one reusable workflow with anenvironmentinput (production/development), replacing the two copies of the build-and-deploy job indeploy.yml. It runs under the matching GitHub environment and keeps the current steps: runner IP allow-list and revoke, PHP and Composer, Yarn install andnpm run production, deployment package and artifact, Deployer. - SSH host keys: commit
.github/known_hostswith both servers' keys and setStrictHostKeyChecking yes, instead ofssh-keyscanat deploy time. -
deploy.yml:- A
testsjob (callingtests.yml) that the production and development deploys bothneed, so a failing test stops the deploy.[skip deploy]/[no deploy]skip the tests too. concurrencyper branch withcancel-in-progress: false, so two quick merges can't deploy at once or calculate the same version.- Release notes from
gh release create --generate-notessince the previous release, as BioSpex does.
- A
- Dependabot:
.github/dependabot.ymlfor GitHub Actions, Composer (minor and patch grouped) and npm, weekly, targetingdevelopment. - README: describe the tests job and the known-hosts file.
- Fix whatever the first run turns up (for example, existing Pint findings only fail on changed files).
After merging
- Run Build and Deploy manually on
development: the tests run first, the SSH steps connect with host-key checking on, and the site deploys. - The production deploy from the merge runs the tests first and deploys.
- Add the
testcheck as required in themainruleset.
Reference: BioSpex's .github/workflows/{tests,deploy,deploy-environment}.yml, .github/known_hosts and .github/dependabot.yml on development (AustinMastLab/Biospex#524, AustinMastLab/Biospex#531). They aren't in BioSpex main yet; they're released with AustinMastLab/Biospex#538.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity