Freemabd/dt 940 #4717
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: Run UI Integration Tests | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- 'README.md' | |
- 'docs/**' | |
pull_request: | |
branches: [ "**" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ lts/iron ] | |
services: | |
postgres: | |
image: postgres:13.1 | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
if: "!contains( github.event.sender.login, 'broadbot')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Initialize Postgres DB | |
env: | |
PGPASSWORD: postgres | |
run: psql -h 127.0.0.1 -U postgres -f ./service/local-dev/local-postgres-init.sql | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }} | |
restore-keys: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }} | |
- name: Pull credentials | |
id: pull_credentials | |
run: | | |
# For security reasons, Broad prefers we read GHA secrets instead of reading from vault. | |
# This step does the equivalent of the pull-credentials.sh script. | |
# On local machines, the script fetches a SA from Vault. | |
# In GH actions, the SA key is stored in a GH repo secret. | |
# Regardless of how it was fetched, tests and scripts expect these | |
# keys to be stored in rendered/. | |
mkdir -p rendered/broad/ | |
echo "$TEST_PROJECT_SA_KEY" > rendered/broad/tanagra_sa.json | |
chmod a+r rendered/broad/tanagra_sa.json | |
env: | |
TEST_PROJECT_SA_KEY: ${{ secrets.TEST_PROJECT_SA_KEY }} | |
- name: Launch local server | |
uses: ./.github/actions/start-local-server | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run codegen | |
start: npm start | |
wait-on: "http://localhost:3000" | |
working-directory: ui | |
# NOTE: screenshots will be generated only if E2E test failed | |
# thus we store screenshots only on failures | |
# Alternative: create and commit an empty cypress/screenshots folder | |
# to always have something to upload | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ui/cypress/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-videos | |
path: ui/cypress/videos |