Skip to content

Commit

Permalink
Merge pull request #34 from levante-framework/upstream-sync-2
Browse files Browse the repository at this point in the history
Upstream sync 2
  • Loading branch information
Zio-4 authored Oct 25, 2024
2 parents 3ff29ac + 48a2a01 commit 6e42cb7
Show file tree
Hide file tree
Showing 238 changed files with 60,714 additions and 18,456 deletions.
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# App Check Debug Tokens
VITE_APPCHECK_DEBUG_TOKEN='your-app-check-debug-token'

# 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
VITE_AUTH_SESSION_TIMEOUT_IDLE_THRESHOLD=900000# 15 minutes in milliseconds
VITE_AUTH_SESSION_TIMEOUT_COUNTDOWN_DURATION=60000# 1 minute in milliseconds

23 changes: 23 additions & 0 deletions .env.example.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Cypress Environment Variables
CLEVER_USERNAME='your-clever-username'
CLEVER_PASSWORD='your-clever-password'
SUPER_ADMIN_USERNAME='your-super-admin-username'
SUPER_ADMIN_PASSWORD='your-super-admin-password'
SUPER_ADMIN_ID='your-super-admin-id'
PARTNER_ADMIN_USERNAME='your-partner-admin-username'
PARTNER_ADMIN_PASSWORD='your-partner-admin-password'
PARTNER_ADMIN_ID='your-partner-admin-id'
PARTICIPANT_USERNAME='your-participant-username'
PARTICIPANT_PASSWORD='your-participant-password'
PARTICIPANT_UID='your-participant-uid'
PARTICIPANT_EMAIL='your-participant-email'
PARTICIPANT_EMAIL_PASSWORD='your-participant-email-password'

# Parent information for testing
PARENT_FIRST_NAME='your-parent-first-name'
PARENT_LAST_NAME='your-parent-last-name'
PARENT_EMAIL='your-parent-email'
PARENT_PASSWORD='your-parent-password'

# Firebase App Check Tokens
VITE_APPCHECK_DEBUG_TOKEN='your-firebase-app-check-debug-token'
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These owners will be the default owners for everything in the repo. Unless a
# later match takes precedence, these owners will be requested for review when
# someone opens a pull request.
* @yeatmanlab/roar-maintainers
72 changes: 72 additions & 0 deletions .github/workflows/cypress-component-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Run Cypress Component 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 }}-3
cancel-in-progress: true

jobs:
cypress-run:
name: Run Cypress Component 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: Component 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_UID: ${{ secrets.PARTICIPANT_UID }}
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 }}

# 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:
component: true
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/component/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}
5 changes: 3 additions & 2 deletions .github/workflows/cypress-participant-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
required: true

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

jobs:
Expand All @@ -30,7 +30,7 @@ jobs:
CLEVER_PASSWORD: ${{ secrets.CLEVER_PASSWORD }}
CYPRESS_BASE_URL: 'http://localhost:5173'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: Tests for PR ${{ github.event.number }} "${{ github.event.pull_request.title }}" from commit "${{ github.event.pull_request.head.sha }}"
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 }}
Expand All @@ -40,6 +40,7 @@ jobs:
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
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/cypress-partner-admin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
required: true

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

jobs:
Expand All @@ -28,7 +28,7 @@ jobs:
NODE_ENV: 'test'
CYPRESS_BASE_URL: 'http://localhost:5173'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: Tests for PR ${{ github.event.number }} "${{ github.event.pull_request.title }}" from commit "${{ github.event.pull_request.head.sha }}"
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 }}
Expand All @@ -37,7 +37,12 @@ jobs:
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
PARTICIPANT_EMAIL: ${{ secrets.PARTICIPANT_EMAIL }}
PARTICIPANT_EMAIL_PASSWORD: ${{ secrets.PARTICIPANT_EMAIL_PASSWORD }}
PARENT_FIRST_NAME: ${{ secrets.PARENT_FIRST_NAME }}
PARENT_LAST_NAME: ${{ secrets.PARENT_LAST_NAME }}
PARENT_EMAIL: ${{ secrets.PARENT_EMAIL }}
PARENT_PASSWORD: ${{ secrets.PARENT_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
Expand Down
56 changes: 55 additions & 1 deletion .github/workflows/firebase-hosting-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,58 @@ jobs:
- run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}

outputs:
deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
deployUrl: ${{ steps.set-deploy-url.outputs.deployUrl }}

whitelist-pr-domains-roar-admin:
name: Whitelist PR Domains on Firebase App Check for gse-roar-admin
runs-on: ubuntu-latest
needs: build-and-preview

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

- name: Authenticate with Google Cloud SDK
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}

- name: Set up Google Cloud SDK with Firebase Service Account
uses: google-github-actions/setup-gcloud@v2
with:
project_id: gse-roar-admin

- name: Update App Check Domains for gse-roar-admin
run: |
CURRENT_DOMAINS=$(gcloud recaptcha keys describe ${{ secrets.FIREBASE_APPCHECK_SITE_KEY_GSE_ROAR_ADMIN }} --format="value(webSettings.allowedDomains)" | tr ';' '\n')
NEW_DOMAIN=$(echo ${{ needs.build-and-preview.outputs.deployUrl }} | sed 's|https://||')
ALL_DOMAINS=$(echo -e "${CURRENT_DOMAINS}\n${NEW_DOMAIN}")
UPDATED_DOMAINS=$(echo "$ALL_DOMAINS" | sort | uniq | paste -sd ',' -)
gcloud recaptcha keys update ${{ secrets.FIREBASE_APPCHECK_SITE_KEY_GSE_ROAR_ADMIN }} --domains="$UPDATED_DOMAINS" --web
whitelist-pr-domains-roar-assessment:
name: Whitelist PR Domains on Firebase App Check for gse-roar-assessment
runs-on: ubuntu-latest
needs: build-and-preview

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

- name: Authenticate with Google Cloud SDK
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ASSESSMENT }}

- name: Set up Google Cloud SDK for gse-roar-assessment
uses: google-github-actions/setup-gcloud@v2
with:
project_id: gse-roar-assessment

- name: Update App Check Domains for gse-roar-assessment
run: |
CURRENT_DOMAINS=$(gcloud recaptcha keys describe ${{ secrets.FIREBASE_APPCHECK_SITE_KEY_GSE_ROAR_ASSESSMENT }} --format="value(webSettings.allowedDomains)" | tr ';' '\n')
NEW_DOMAIN=$(echo ${{ needs.build-and-preview.outputs.deployUrl }} | sed 's|https://||')
ALL_DOMAINS=$(echo -e "${CURRENT_DOMAINS}\n${NEW_DOMAIN}")
UPDATED_DOMAINS=$(echo "$ALL_DOMAINS" | sort | uniq | paste -sd ',' -)
gcloud recaptcha keys update ${{ secrets.FIREBASE_APPCHECK_SITE_KEY_GSE_ROAR_ASSESSMENT }} --domains="$UPDATED_DOMAINS" --web
Loading

0 comments on commit 6e42cb7

Please sign in to comment.