bumping versions #978
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: Playwright Tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- '**' | |
- '!k8s-operator/**' | |
- '!webui/apps/docs/**' | |
pull_request_target: | |
types: [ opened, synchronize ] | |
paths: | |
- '**' | |
- '!k8s-operator/**' | |
- '!webui/apps/docs/**' | |
jobs: | |
test-e2e: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:latest | |
ports: | |
- 27017:27017 | |
options: >- | |
--health-cmd="echo 'db.runCommand({ ping: 1 })' | mongosh localhost:27017/test --quiet" | |
--health-interval=30s | |
--health-timeout=10s | |
--health-retries=10 | |
env: | |
AUTH_TRUST_HOST: ${{ secrets.AUTH_TRUST_HOST }} | |
EIDOLON_SERVER: ${{ secrets.EIDOLON_SERVER }} | |
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | |
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
NEXT_PUBLIC_DEBUG: ${{ secrets.NEXT_PUBLIC_DEBUG }} | |
NEXT_PUBLIC_LOG_LEVEL: ${{ secrets.NEXT_PUBLIC_LOG_LEVEL }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
CI: true | |
steps: | |
# https://michaelheap.com/access-secrets-from-forks/ | |
# Allow contributors to run the tests with secret access if it is kicked off by a maintainer | |
- name: Get User Permission | |
id: checkAccess | |
uses: actions-cool/check-user-permission@v2 | |
with: | |
require: write | |
username: ${{ github.triggering_actor }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check User Permission | |
if: steps.checkAccess.outputs.require-result == 'false' | |
run: | | |
echo "${{ github.triggering_actor }} does not have permissions on this repo." | |
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" | |
echo "Job originally triggered by ${{ github.actor }}" | |
exit 1 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # This is dangerous without the first access check | |
- name: Check for OPENAI_API_KEY | |
run: | | |
if [ -z "${{ secrets.OPENAI_API_KEY }}" ]; then | |
echo "OPENAI_API_KEY is not set. Failing the job." | |
exit 1 | |
fi | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install PNPM | |
run: npm install -g pnpm | |
- name: Stop conflicting MongoDB containers | |
run: | | |
CONFLICTING_CONTAINERS=$(docker ps -q --filter "ancestor=mongo:latest" --filter "status=running") | |
if [ -n "$CONFLICTING_CONTAINERS" ]; then | |
echo "Stopping conflicting MongoDB containers" | |
docker stop $CONFLICTING_CONTAINERS | |
else | |
echo "No conflicting MongoDB containers" | |
fi | |
- name: Install dependencies | |
run: pnpm install | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Build Docker images | |
run: pnpm run docker:build | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Start Docker containers | |
run: pnpm run docker:up | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Save MongoDB logs | |
run: docker logs $(docker ps -q --filter name=mongo) > mongodb-logs.txt | |
- name: List Docker containers | |
run: docker ps -a | |
- name: Install Playwright dependencies | |
run: pnpm exec playwright install | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Install browsers Playwright | |
run: pnpm dlx playwright install | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Run Playwright tests | |
run: pnpm exec playwright test | |
working-directory: ./webui/apps/eidolon-ui2 | |
- name: Stop Docker containers | |
run: pnpm run docker:down | |
working-directory: ./webui/apps/eidolon-ui2 | |
if: always() | |
- name: Upload MongoDB logs | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: mongodb-logs | |
path: mongodb-logs.txt | |
- name: Upload Playwright test results | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-results | |
path: | | |
webui/apps/eidolon-ui2/tests/test-results | |
if-no-files-found: ignore | |
- name: Upload Playwright screenshots | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-screenshots | |
path: webui/apps/eidolon-ui2/tests/screenshots | |
if-no-files-found: ignore |