generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
91 additions
and
91 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 |
---|---|---|
@@ -1,100 +1,100 @@ | ||
name: .Tests | ||
# name: .Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
### Required | ||
target: | ||
description: PR number, test or prod | ||
required: true | ||
type: string | ||
# on: | ||
# workflow_call: | ||
# inputs: | ||
# ### Required | ||
# target: | ||
# description: PR number, test or prod | ||
# required: true | ||
# type: string | ||
|
||
### Typical / recommended | ||
triggers: | ||
description: Bash array to diff for build triggering; omit to always fire | ||
required: false | ||
type: string | ||
# ### Typical / recommended | ||
# triggers: | ||
# description: Bash array to diff for build triggering; omit to always fire | ||
# required: false | ||
# type: string | ||
|
||
env: | ||
DOMAIN: apps.silver.devops.gov.bc.ca | ||
PREFIX: ${{ github.event.repository.name }}-${{ inputs.target }} | ||
# env: | ||
# DOMAIN: apps.silver.devops.gov.bc.ca | ||
# PREFIX: ${{ github.event.repository.name }}-${{ inputs.target }} | ||
|
||
jobs: | ||
integration-tests: | ||
name: Integration | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: cache-npm | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-cache-node-modules- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
# jobs: | ||
# integration-tests: | ||
# name: Integration | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 1 | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - id: cache-npm | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.npm | ||
# key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-build-cache-node-modules- | ||
# ${{ runner.os }}-build- | ||
# ${{ runner.os }}- | ||
|
||
- env: | ||
API_NAME: nest | ||
BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }} | ||
run: | | ||
cd tests/integration | ||
npm ci | ||
node src/main.js | ||
# - env: | ||
# API_NAME: nest | ||
# BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }} | ||
# run: | | ||
# cd tests/integration | ||
# npm ci | ||
# node src/main.js | ||
|
||
e2e-tests: | ||
name: E2E | ||
defaults: | ||
run: | ||
working-directory: frontend | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
project: [ chromium, Google Chrome, firefox, safari, Microsoft Edge ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
- uses: actions/setup-node@v4 | ||
name: Setup Node | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
cache-dependency-path: frontend/package-lock.json | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
npx playwright install --with-deps | ||
# e2e-tests: | ||
# name: E2E | ||
# defaults: | ||
# run: | ||
# working-directory: frontend | ||
# runs-on: ubuntu-22.04 | ||
# timeout-minutes: 5 | ||
# strategy: | ||
# matrix: | ||
# project: [ chromium, Google Chrome, firefox, safari, Microsoft Edge ] | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# name: Checkout | ||
# - uses: actions/setup-node@v4 | ||
# name: Setup Node | ||
# with: | ||
# node-version: 20 | ||
# cache: 'npm' | ||
# cache-dependency-path: frontend/package-lock.json | ||
# - name: Install dependencies | ||
# run: | | ||
# npm ci | ||
# npx playwright install --with-deps | ||
|
||
- name: Run Tests | ||
env: | ||
E2E_BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}/ | ||
CI: 'true' | ||
run: | | ||
npx playwright test --project="${{ matrix.project }}" --reporter=html | ||
# - name: Run Tests | ||
# env: | ||
# E2E_BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}/ | ||
# CI: 'true' | ||
# run: | | ||
# npx playwright test --project="${{ matrix.project }}" --reporter=html | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
name: upload results | ||
with: | ||
name: playwright-report-${{ matrix.project }} | ||
path: "./frontend/playwright-report" # path from current folder | ||
retention-days: 7 | ||
# - uses: actions/upload-artifact@v4 | ||
# if: ${{ !cancelled() }} | ||
# name: upload results | ||
# with: | ||
# name: playwright-report-${{ matrix.project }} | ||
# path: "./frontend/playwright-report" # path from current folder | ||
# retention-days: 7 | ||
|
||
load-tests: | ||
name: Load | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [backend, frontend] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: grafana/k6-action@v0.3.1 | ||
env: | ||
BACKEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/api | ||
FRONTEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }} | ||
with: | ||
filename: ./tests/load/${{ matrix.name }}-test.js | ||
flags: --vus 10 --duration 30s | ||
# load-tests: | ||
# name: Load | ||
# runs-on: ubuntu-22.04 | ||
# strategy: | ||
# matrix: | ||
# name: [backend, frontend] | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: grafana/k6-action@v0.3.1 | ||
# env: | ||
# BACKEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/api | ||
# FRONTEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }} | ||
# with: | ||
# filename: ./tests/load/${{ matrix.name }}-test.js | ||
# flags: --vus 10 --duration 30s |