-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4245 - E2E Testing framework and test runner in Github Actions (#4246)
* 4245 - dont start reporter server * 4245 - run tests inside container * 4245 - partial-backup: support excluding schemas and tables outside script, support custom name * 4245 - workflow: test: partial db copy * 4245 - workflow: test: cleanup * 4245 - Dockerfile.playwright remove unnecessary ls * 4245 - debug * 4245 - use exact name * 4245 - Disable whisper * 4245 - Google authentication env var placeholder * 4245 - token_secret env var placeholder * 4245 - Remove unknown opt * 4245 - Disable tmate * 4245 - use latest cycle * 4245 - Mount test results folder and upload artifact * debug * 4245 - Zipped results and one drive db * 4245 - Backup from s3 * 4245 - Fix failing title test * 4245 - Disable tmate * 4245 - add db caching * 4245 - Fix indentation * Empty-Commit * Empty-Commit * 4245 - split CI workflows into build, test, and e2e * 4245 - separate unit and integration test configs * 4245 - run unit and integration tests parallel * 4245 - remove deprecated workflow * 4245 - fix typo * 4245 - Cache and parallel * 4245 - fix typo * 4245 - Remove separate build wf * 4245 - Fix typo * 4245 - cache only db * 4245 - run migrations * 4245 - default false * 4245 - boolean * 4245 - remove jest prefix * 4245 - e2e: run integration and unit tests * 4245 - test: ignore only development * 4245 - Rename workflows --------- Co-authored-by: Heroku-Deploy <> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1c0c69d
commit 5881cfe
Showing
14 changed files
with
228 additions
and
124 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Run test all (unit, integration and e2e) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'development' | ||
workflow_dispatch: | ||
inputs: | ||
force_refresh: | ||
description: 'Force database refresh' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | ||
aws-region: eu-west-1 | ||
|
||
- name: Cache test database | ||
id: cache-db | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./db/backup | ||
key: test-db-${{ runner.os }}-v1-${{ hashFiles('src/test/e2e/docker-compose.test.yml') }} | ||
restore-keys: | | ||
test-db-${{ runner.os }}-v1- | ||
test-db-${{ runner.os }}- | ||
- name: Download and decrypt test database | ||
if: steps.cache-db.outputs.cache-hit != 'true' || ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force_refresh == true }} | ||
run: | | ||
mkdir -p ./db | ||
aws s3 cp s3://fra-platform-s3-developer-assets/test-assets/database/backup.gpg ./db/backup.gpg | ||
./src/tools/heroku/decrypt.sh ./db/backup.gpg | ||
env: | ||
BACKUP_PASSPHRASE: ${{ secrets.BACKUP_PASSPHRASE }} | ||
|
||
- name: Build and start containers | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml up -d | ||
env: | ||
NPM_GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Wait for services to be ready | ||
run: | | ||
timeout 300 bash -c 'until docker compose -f src/test/e2e/docker-compose.test.yml ps web | grep -q "healthy"; do sleep 5; done' | ||
- name: Create test results directory | ||
run: mkdir -p playwright-report | ||
|
||
- name: Run database migrations | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml exec -T web yarn migration-steps:run | ||
|
||
- name: Run unit and integration tests | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml exec -T web yarn test | ||
env: | ||
NPM_GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Run E2E tests | ||
if: always() | ||
run: | | ||
docker compose -f src/test/e2e/docker-compose.test.yml run \ | ||
playwright npm run test:e2e | ||
env: | ||
NPM_GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Zip test results | ||
if: always() | ||
run: | | ||
cd src/test/e2e | ||
zip -r ../../../playwright-results.zip test-results/ | ||
- name: Upload test results | ||
if: always() && !env.ACT | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: playwright-results | ||
path: playwright-results.zip | ||
retention-days: 30 | ||
|
||
- name: Stop containers | ||
if: always() | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml down -v | ||
|
||
- name: Cleanup database backup | ||
if: always() | ||
run: | | ||
rm -rf ./db |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Run test partial (unit and integration) | ||
|
||
on: | ||
pull_request: | ||
branches-ignore: | ||
- 'development' | ||
workflow_dispatch: | ||
inputs: | ||
force_refresh: | ||
description: 'Force database refresh' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | ||
aws-region: eu-west-1 | ||
|
||
- name: Cache test database | ||
id: cache-db | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./db/backup | ||
key: test-db-${{ runner.os }}-v1-${{ hashFiles('src/test/e2e/docker-compose.test.yml') }} | ||
restore-keys: | | ||
test-db-${{ runner.os }}-v1- | ||
test-db-${{ runner.os }}- | ||
- name: Download and decrypt test database | ||
if: steps.cache-db.outputs.cache-hit != 'true' || ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force_refresh == 'true' }} | ||
run: | | ||
mkdir -p ./db | ||
aws s3 cp s3://fra-platform-s3-developer-assets/test-assets/database/backup.gpg ./db/backup.gpg | ||
./src/tools/heroku/decrypt.sh ./db/backup.gpg | ||
env: | ||
BACKUP_PASSPHRASE: ${{ secrets.BACKUP_PASSPHRASE }} | ||
|
||
- name: Build and start containers | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml up -d | ||
env: | ||
NPM_GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Wait for services to be ready | ||
run: | | ||
timeout 300 bash -c 'until docker compose -f src/test/e2e/docker-compose.test.yml ps web | grep -q "healthy"; do sleep 5; done' | ||
- name: Run database migrations | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml exec -T web yarn migration-steps:run | ||
|
||
- name: Run unit and integration tests | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml exec -T web yarn test | ||
env: | ||
NPM_GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Stop containers | ||
if: always() | ||
run: docker compose -f src/test/e2e/docker-compose.test.yml down -v | ||
|
||
- name: Cleanup database backup | ||
if: always() | ||
run: | | ||
rm -rf ./db |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const baseConfig = require('./jest.config.base') | ||
|
||
module.exports = { | ||
...baseConfig, | ||
testMatch: ['**/integration.test.ts'], | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const baseConfig = require('./jest.config.base') | ||
|
||
module.exports = { | ||
...baseConfig, | ||
testMatch: ['**/?(*.)+(test).ts'], | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/src/test/integration/', '/src/test/e2e/'], | ||
} |
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
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
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
2 changes: 1 addition & 1 deletion
2
src/test/e2e/jest-playwright.config.local.ts → src/test/e2e/playwright.config.local.ts
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
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
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
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
Oops, something went wrong.