Skip to content

Commit

Permalink
chore(ci): Uncomment PR open test and results job. (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
fergmac authored Nov 14, 2024
1 parent 8fdc1a5 commit 58d97b1
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 100 deletions.
149 changes: 78 additions & 71 deletions .github/workflows/.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,81 +20,88 @@ env:
PREFIX: ${{ github.event.repository.name }}-${{ inputs.target }}

jobs:
integration-tests:
name: Integration
tests:
name: Tests
runs-on: ubuntu-latest
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 }}-
- name: TODO Tests
run: echo "The automated test suite is not set up yet."

# integration-tests:
# name: Integration
# runs-on: ubuntu-latest
# 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-latest
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-latest
# 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-latest
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-latest
# 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
15 changes: 9 additions & 6 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Analysis

on:
# push:
# branches: [main]
# pull_request:
# types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
# schedule:
# - cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
schedule:
- cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -84,7 +84,10 @@ jobs:
name: Analysis Results
# needs: [tests, trivy]
needs: [trivy]
if: always()
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure')
run: echo "At least one job has failed." && exit 1
- run: echo "Success!"

38 changes: 15 additions & 23 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,24 @@ jobs:
tag_fallback: latest
triggers: ('${{ matrix.package }}/')

deploy:
deploys:
name: Deploy
needs: [builds]
secrets: inherit
uses: ./.github/workflows/.deploy.yml

# tests:
# name: Tests
# if: needs.deploys.outputs.triggered == 'true'
# needs: [deploys]
# uses: ./.github/workflows/.tests.yml
# with:
# target: ${{ github.event.number }}
tests:
name: Tests
if: needs.deploys.outputs.triggered == 'true'
needs: [deploys]
uses: ./.github/workflows/.tests.yml
with:
target: ${{ github.event.number }}

# results:
# name: PR Results
# # needs: [builds, deploys, tests]
# if: always() && (!failure()) && (!cancelled())
# runs-on: ubuntu-latest
# steps:
# - run: echo "Success!"

# dump:
# name: Dump Context
# runs-on: ubuntu-latest
# env:
# CONTEXT: ${{ toJson(github) }}
# steps:
# - run: echo "${{ env.CONTEXT }}"
results:
name: PR Results
needs: [builds, deploys, tests]
if: always() && (!failure()) && (!cancelled())
runs-on: ubuntu-latest
steps:
- run: echo "Success!"

0 comments on commit 58d97b1

Please sign in to comment.