Skip to content

Commit

Permalink
feat(agora): run agora e2e tests in CI (AG-1623) (#3011)
Browse files Browse the repository at this point in the history
  • Loading branch information
hallieswan authored Feb 14, 2025
1 parent b0014da commit 1b703e8
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/apps/agora/ @Sage-Bionetworks/sage-monorepo-agora
/libs/agora/ @Sage-Bionetworks/sage-monorepo-agora
/.github/workflows/e2e-agora.yaml @Sage-Bionetworks/sage-monorepo-agora

/libs/shared/ @tschaffter

Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/e2e-agora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Run e2e tests for Agora

on: push

jobs:
run-agora-e2e-tests:
# Run in Sage repo on main branch and on all branches in user-owned forks
if: ${{ github.ref_name == 'main' || github.actor == github.repository_owner }}
timeout-minutes: 60
runs-on: ubuntu-22.04
environment: agora
steps:
- uses: actions/checkout@v4
with:
# We need to fetch all branches and commits so that Nx affected has a base to compare
# against.
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4

- name: Set up the dev container
uses: ./.github/actions/setup-dev-container

- name: Check if Agora was affected
id: agora_affected
run: |
AFFECTED=$(devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx show projects --affected --with-target e2e | grep -q 'agora' && echo 'true' || echo 'false'")
echo "AFFECTED=${AFFECTED}" >> "${GITHUB_OUTPUT}"
- name: Install Playwright Browsers
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& npx playwright install --with-deps"
- name: Build Agora
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& agora-build-images"
- name: Write Synapse PAT for Agora
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
sed -i "s/^SYNAPSE_AUTH_TOKEN=.*/SYNAPSE_AUTH_TOKEN=\"${{ secrets.AGORA_DATA_SYNAPSE_AUTH_TOKEN }}\"/" apps/agora/data/.env
- name: Start Agora
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx run agora-apex:serve-detach"
- name: Run Agora e2e tests
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx run agora-app:e2e"
- name: Stop Agora
if: steps.agora_affected.outputs.AFFECTED == 'true'
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& workspace-docker-stop"
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && steps.agora_affected.outputs.AFFECTED == 'true'}}
with:
name: playwright-report
path: playwright-report/
retention-days: 5

- name: Remove the dev container
run: docker rm -f sage_devcontainer
6 changes: 0 additions & 6 deletions apps/agora/app/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import { workspaceRoot } from '@nx/devkit';
const port = 8000;
export const baseURL = process.env['BASE_URL'] || `http://localhost:${port}`;

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down

0 comments on commit 1b703e8

Please sign in to comment.