Skip to content

Commit

Permalink
Merge branch 'ref/project-config-ci' into ref/project-config-ci-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianoertel committed Jan 15, 2025
2 parents 5671700 + 0db6100 commit eaf62d5
Show file tree
Hide file tree
Showing 61 changed files with 960 additions and 621 deletions.
65 changes: 59 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,61 @@
# App Check Debug Tokens
VITE_APPCHECK_DEBUG_TOKEN='your-app-check-debug-token'
# |------------------------------------------------------------------------------------------------------------------- #
# | Environment Configuration
# |
# | This file contains the list of environment variables supported by the application. The variables that are mandatory
# | for the application to run are marked as (required). The variables that are optional are marked as (optional).
# |
# | Important: this file serves a source of truth for the environment variables that the application supports and should
# | be updated when variables are added, removed, or changed.
# |------------------------------------------------------------------------------------------------------------------- #

# Auth Session Timeout (Optional)
# Control the session timeout limit and countdown duration before a user is signed out due to inactivity.
VITE_AUTH_SESSION_TIMEOUT_IDLE_THRESHOLD=900000# 15 minutes in milliseconds
VITE_AUTH_SESSION_TIMEOUT_COUNTDOWN_DURATION=60000# 1 minute in milliseconds

# -------------------------------------------------------------------------------------------------------------------- #
# ROAR Firekit Configuration
# -------------------------------------------------------------------------------------------------------------------- #
# Project ID (required)
VITE_FIREBASE_ADMIN_PROJECT_ID=
VITE_FIREBASE_APP_PROJECT_ID=

# API Key (required)
VITE_FIREBASE_ADMIN_API_KEY=
VITE_FIREBASE_APP_API_KEY=

# Auth Domain (required)
VITE_FIREBASE_ADMIN_AUTH_DOMAIN=
VITE_FIREBASE_APP_AUTH_DOMAIN=

# Storage Bucket (required)
VITE_FIREBASE_ADMIN_STORAGE_BUCKET=
VITE_FIREBASE_APP_STORAGE_BUCKET=

# Cloud Messaging Sender ID (required)
VITE_FIREBASE_ADMIN_MESSAGING_SENDER_ID=
VITE_FIREBASE_APP_MESSAGING_SENDER_ID=

# App ID (required)
VITE_FIREBASE_ADMIN_APP_ID=
VITE_FIREBASE_APP_APP_ID=

# App Check (optional)
VITE_FIREKIT_ADMIN_RECAPTCHA_SITE_KEY=
VITE_FIREKIT_APP_RECAPTCHA_SITE_KEY=
VITE_FIREKIT_APPCHECK_DEBUG_TOKEN=

# Google Analytics Measurement ID (optional)
VITE_ANALYTICS_ADMIN_MEASUREMENT_ID=

# Firekit Logging Level (optional)
VITE_FIREKIT_VERBOSE_LOGGING_ENABLED=false

# Firebase Emulator (optional)
VITE_FIREBASE_EMULATOR_ENABLED=false


# -------------------------------------------------------------------------------------------------------------------- #
# Application Configuration
# -------------------------------------------------------------------------------------------------------------------- #

# Auth Session Timeout (optional)
# Control the session timeout limit and countdown duration before a user is signed out due to inactivity.
VITE_AUTH_SESSION_TIMEOUT_IDLE_THRESHOLD="900000"
VITE_AUTH_SESSION_TIMEOUT_COUNTDOWN_DURATION="60000"
5 changes: 5 additions & 0 deletions .env.test.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# -------------------------------------------------------------------------------------------------------------------- #
# Cypress Configuration
# -------------------------------------------------------------------------------------------------------------------- #
<<<<<<< HEAD
# Project ID
CYPRESS_PROJECT_ID=

Expand All @@ -20,6 +21,8 @@ CYPRESS_PROJECT_ID=
# -------------------------------------------------------------------------------------------------------------------- #
# Firebase Admin Project ID
CYPRESS_FIREBASE_ADMIN_PROJECT_ID=
=======
>>>>>>> ref/project-config-ci

# Clever Auth Credentials
CYPRESS_CLEVER_USERNAME=
Expand All @@ -39,6 +42,8 @@ CYPRESS_PARTNER_ADMIN_ID=
CYPRESS_PARTICIPANT_USERNAME=
CYPRESS_PARTICIPANT_PASSWORD=
CYPRESS_PARTICIPANT_UID=
CYPRESS_PARTICIPANT_EMAIL=
CYPRESS_PARTICIPANT_EMAIL_PASSWORD=

# ROAR Participant Account Credentials for Legal Document Testing
CYPRESS_PARTICIPANT_TESTLEGAL_USERNAME=
Expand Down
32 changes: 0 additions & 32 deletions .firebaserc

This file was deleted.

19 changes: 14 additions & 5 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,24 @@ runs:
cd app && pwd && ls -la
# Deploy application
# Note: When invoking this action with 'pr' as environment, the channelId is set to an empty string to deploy to an
# ephemeral preview environment in Firebase Hosting.
- name: Deploy application
# Note: Due to a bug in the FirebaseExtended/action-hosting-deploy action, it is not possible to use a conditional
# expression on the channelId parameter. As a workaround, we use two separate steps to deploy the application.
- name: Deploy application to ephemeral environment
if: ${{ inputs.firebase-channel == 'preview' }}
uses: FirebaseExtended/[email protected]
id: firebase-deploy
with:
firebaseServiceAccount: '${{ env.GCP_HOSTING_SERVICE_ACCOUNT_KEY }}'
projectId: '${{ inputs.firebase-project-id }}'
channelId: ${{ inputs.firebase-channel == 'preview' && '' || 'live' }}
entryPoint: ./app

- name: Deploy application
if: ${{ inputs.firebase-channel == 'default' }}
uses: FirebaseExtended/[email protected]
with:
firebaseServiceAccount: '${{ env.GCP_HOSTING_SERVICE_ACCOUNT_KEY }}'
projectId: '${{ inputs.firebase-project-id }}'
channelId: 'live'
entryPoint: ./app

# Output deployment URL
Expand All @@ -76,5 +85,5 @@ runs:
id: output-deployment-url
shell: bash
run: |
deployment_url=$(echo "${{ steps.firebase-deploy.outputs.urls }}" | jq -r '.[0]')
deployment_url="${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}"
echo "deployment-url=$deployment_url" >> $GITHUB_OUTPUT
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: npm run lint

- name: Check format
run: npm run check-format
run: npm run format:check

# ––––––––––––––––––––––––––––––––––––––––––––––– #
# Test
Expand Down Expand Up @@ -183,18 +183,20 @@ jobs:
runs-on: ubuntu-latest
needs: [lint, test, build]
timeout-minutes: 5
env:
DOTENV_PRIVATE_KEY_STAGING: ${{ secrets.DOTENV_PRIVATE_KEY_STAGING }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build app
- name: Build preview app
uses: ./.github/actions/build
with:
environment: staging
github-pat: ${{ secrets.CI_GITHUB_PAT }}

- name: Deploy app
- name: Deploy preview app
uses: ./.github/actions/deploy
id: deployment
with:
Expand All @@ -203,9 +205,6 @@ jobs:
gcp-workload-identity-provider: ${{ secrets.CI_FIREBASE_WORKLOAD_IDENTITY_PROVIDER_ADMIN_STAGING }}
gcp-service-account-id: ${{ secrets.CI_FIREBASE_HOSTING_SERVICE_ACCOUNT_ID_ADMIN_STAGING }}

- name: Debug
run: echo ${{ steps.deployment.outputs.deployment-url }}

# - name: Whitelist AppCheck admin environment
# if: ${{ success() }}
# uses: ./.github/actions/whitelist-appcheck-environment
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/cypress-participant-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Run Cypress Participant Tests

on:
# pull_request:
# types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
pr_branch:
description: 'Checkout this branch from the LEVANTE repository and execute CI/CD tests on it.'
required: true

concurrency:
group: cypress-tests-${{ github.ref }}-2
cancel-in-progress: true

jobs:
cypress-run:
name: Run Cypress Participant Tests
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
browser: [chromium, edge]
containers: [1, 2]
env:
NODE_OPTIONS: '--max_old_space_size=8192'
NODE_ENV: 'test'
CLEVER_USERNAME: ${{ secrets.CLEVER_USERNAME }}
CLEVER_PASSWORD: ${{ secrets.CLEVER_PASSWORD }}
CYPRESS_BASE_URL: 'http://localhost:5173'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: E2E Tests for PR ${{ github.event.number }} "${{ github.event.pull_request.title }}" from commit "${{ github.event.pull_request.head.sha }}"
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
PARTNER_ADMIN_USERNAME: ${{ secrets.PARTNER_ADMIN_USERNAME }}
PARTNER_ADMIN_PASSWORD: ${{ secrets.PARTNER_ADMIN_PASSWORD }}
PARTNER_ADMIN_ID: ${{ secrets.PARTNER_ADMIN_ID }}
PARTICIPANT_USERNAME: ${{ secrets.PARTICIPANT_USERNAME}}
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
PARTICIPANT_EMAIL: ${{ secrets.PARTICIPANT_EMAIL }}
PARTICIPANT_EMAIL_PASSWORD: ${{ secrets.PARTICIPANT_EMAIL_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_APPCHECK_DEBUG_TOKEN: ${{ secrets.VITE_APPCHECK_DEBUG_TOKEN }}
steps:
# For workflows triggered by pull requests
- name: Checkout PR code
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

# For workflows triggered manually, targeting the LEVANTE dashboard repository specifically
- name: Checkout manual trigger code
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.pr_branch }}
repository: levante-framework/levante-dashboard
fetch-depth: 0

- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: ${{ matrix.browser }}
build: npm ci && npm run build
start: npm run dev
wait-on: ${{ env.CYPRESS_BASE_URL }}
wait-on-timeout: 120
record: true
parallel: true
spec: 'cypress/e2e/participant/default-tests/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}
71 changes: 71 additions & 0 deletions .github/workflows/cypress-partner-admin-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Run Cypress Partner Admin Tests

on:
# pull_request:
# types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
pr_branch:
description: 'Checkout this branch from the LEVANTE repository and execute CI/CD tests on it.'
required: true

concurrency:
group: cypress-tests-${{ github.ref }}-1
cancel-in-progress: true

jobs:
cypress-run:
name: Run Cypress Partner Admin Tests
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
browser: [chromium, edge]
containers: [1, 2]
env:
NODE_OPTIONS: '--max_old_space_size=8192'
NODE_ENV: 'test'
CYPRESS_BASE_URL: 'http://localhost:5173'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: E2E Tests for PR ${{ github.event.number }} "${{ github.event.pull_request.title }}" from commit "${{ github.event.pull_request.head.sha }}"
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
PARTNER_ADMIN_USERNAME: ${{ secrets.PARTNER_ADMIN_USERNAME }}
PARTNER_ADMIN_PASSWORD: ${{ secrets.PARTNER_ADMIN_PASSWORD }}
PARTNER_ADMIN_ID: ${{ secrets.PARTNER_ADMIN_ID }}
PARTICIPANT_USERNAME: ${{ secrets.PARTICIPANT_USERNAME}}
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
PARTICIPANT_EMAIL: ${{ secrets.PARTICIPANT_EMAIL }}
PARTICIPANT_EMAIL_PASSWORD: ${{ secrets.PARTICIPANT_EMAIL_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_APPCHECK_DEBUG_TOKEN: ${{ secrets.VITE_APPCHECK_DEBUG_TOKEN }}
steps:
# For workflows triggered by pull requests
- name: Checkout PR code
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

# For workflows triggered manually, targeting the LEVANTE dashboard repository specifically
- name: Checkout manual trigger code
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.pr_branch }}
repository: levante-framework/levante-dashboard
fetch-depth: 0

- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: ${{ matrix.browser }}
build: npm ci && npm run build
start: npm run dev
wait-on: ${{ env.CYPRESS_BASE_URL }}
wait-on-timeout: 120
record: true
parallel: true
spec: 'cypress/e2e/partner-admin/default-tests/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}
3 changes: 0 additions & 3 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:

- name: Deploy app
uses: ./.github/actions/deploy
id: deployment
with:
firebase-channel: default
firebase-project-id: ${{ secrets.FIREBASE_PROJECT_ID_ADMIN }}
Expand All @@ -54,7 +53,6 @@ jobs:
uses: actions/checkout@v4

- name: Deploy Firestore config to Admin instance
if: steps.deployment.outcome == 'success'
uses: ./.github/actions/deploy-firestore-config@121306f5985136950481ef94c10e675e31d6f6f4
with:
firebase-project-id: ${{ secrets.FIREBASE_PROJECT_ID_ADMIN }}
Expand All @@ -63,7 +61,6 @@ jobs:
config-directory: firebase/admin

- name: Deploy Firestore config to Assessment instance
if: steps.deployment.outcome == 'success'
uses: ./.github/actions/deploy-firestore-config@121306f5985136950481ef94c10e675e31d6f6f4
with:
firebase-project-id: ${{ secrets.FIREBASE_PROJECT_ID_ASSESSMENT }}
Expand Down
Loading

0 comments on commit eaf62d5

Please sign in to comment.