SPR-168 Download all files #16
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: Integration and E2E Testing | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- main | |
paths: | |
- "app/**" | |
- "api/**" | |
- ".github/workflows/containerized-tests.yaml" | |
workflow_dispatch: | |
# ENV values match local development seed values only. | |
# Does not allow for Keycloak-Express or GC Notify tests | |
env: | |
TESTING: true | |
API_PORT: 3004 | |
MONGO_PORT: 27017 | |
MONGO_PASSWORD: purchase-admin | |
MONGO_USERNAME: purchase-admin | |
MONGO_DATABASE: purchase-db | |
MONGO_SERVICE: mongo | |
ENVIRONMENT: local | |
FRONTEND_PORT: 8080 | |
SSO_CLIENT_ID: citz-imb-sandbox-4796 | |
SSO_CLIENT_SECRET: ${{ secrets.SSO_CLIENT_SECRET }} | |
SSO_AUTH_SERVER_URL: https://dev.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect | |
TEST_USERNAME: ${{ secrets.TEST_USERNAME }} | |
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} | |
jobs: | |
containerized-tests: | |
name: Containerized Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Spin Up API and Mongo Images | |
run: | | |
docker-compose up --build -d mongo spr-api | |
- name: Wait for Mongo Healthcheck | |
uses: stringbean/docker-healthcheck-action@v1 | |
with: | |
container: mongodb | |
wait-time: 60 | |
require-status: running | |
require-healthy: true | |
- name: Wait for API Healthcheck | |
uses: stringbean/docker-healthcheck-action@v1 | |
id: api-healthcheck | |
continue-on-error: true | |
with: | |
container: spr-api | |
wait-time: 60 | |
require-status: running | |
require-healthy: true | |
- name: Print Docker API Logs | |
run: | | |
docker logs spr-api | |
- name: Stop if API Failed | |
if: steps.api-healthcheck.outcome == 'failure' | |
run: | | |
exit 1 | |
- name: Install Integration Testing Dependencies | |
working-directory: ./api | |
run: | | |
npm i jest supertest ts-jest dotenv @types/jest | |
- name: Run API Integration Tests | |
working-directory: ./api | |
run: | | |
npm run test | |
# Vite does not see this if just specified in the ENV for the workflow | |
- name: Specify VITE_TARGET | |
working-directory: ./app | |
run: | | |
echo "VITE_TARGET=dev" >> .env | |
- name: Spin Up APP Image | |
run: | | |
docker-compose up --build -d spr-app | |
- name: Wait for APP Healthcheck | |
uses: stringbean/docker-healthcheck-action@v1 | |
id: app-healthcheck | |
continue-on-error: true | |
with: | |
container: spr-app | |
wait-time: 60 | |
require-status: running | |
require-healthy: true | |
- name: Print Docker APP Logs | |
run: | | |
docker logs spr-app | |
- name: Stop if APP Failed | |
if: steps.app-healthcheck.outcome == 'failure' | |
run: | | |
exit 1 | |
- name: Install E2E Testing Dependencies | |
working-directory: ./app | |
run: | | |
npm i -D cypress dotenv | |
- name: Run E2E Tests | |
working-directory: ./app | |
run: | | |
npm run cypress:e2e |