Move verification tests to own workflow #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Verification Tests | |
env: | |
IMAGE_NAME: job-server | |
PUBLIC_IMAGE_NAME: ghcr.io/opensafely-core/job-server | |
REGISTRY: ghcr.io | |
SSH_AUTH_SOCK: /tmp/agent.sock | |
on: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "47 0 * * *" | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: user | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: jobserver | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "opensafely-core/setup-action@v1" | |
with: | |
python-version: "3.12" | |
install-just: true | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".node-version" | |
cache: "npm" | |
cache-dependency-path: package-lock.json | |
- name: Install node_modules | |
run: just assets-install --ignore-scripts | |
- name: Lint assets | |
run: npm run lint | |
- name: Run JS tests | |
run: just assets-test | |
- name: Build assets | |
run: just assets-build | |
- name: Install venv | |
run: just devenv | |
- name: Run verification tests | |
env: | |
DATABASE_URL: postgres://user:password@localhost/jobserver | |
GITHUB_TOKEN: empty | |
GITHUB_TOKEN_TESTING: ${{ secrets.OPENSAFELY_GITHUB_TESTING_ORG_PAT }} | |
SECRET_KEY: 12345 | |
SOCIAL_AUTH_GITHUB_KEY: test | |
SOCIAL_AUTH_GITHUB_SECRET: test | |
run: | | |
just check-migrations | |
# hardcode n because auto=2 in CI for some reason | |
just test-verification --migrations -n 4 | |
- name: Upload HTML coverage report if tests failed | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-coverage-report | |
path: htmlcov | |
# don't fail the job because no files were found, we expect this when | |
# * the tests passed with 100% coverage | |
# * a test failed and coverage didn't run | |
if-no-files-found: ignore | |
if: ${{ failure() }} # only upload when the previous step, run tests, fails |