forked from baron/baron-sso
merge feat/304-userfront-wasm-e2e into dev
This commit is contained in:
@@ -24,6 +24,11 @@ on:
|
||||
required: true
|
||||
type: boolean
|
||||
default: true
|
||||
run_userfront_e2e_tests:
|
||||
description: "Run userfront WASM Playwright E2E tests"
|
||||
required: true
|
||||
type: boolean
|
||||
default: true
|
||||
run_adminfront_tests:
|
||||
description: "Run adminfront Playwright tests"
|
||||
required: true
|
||||
@@ -96,10 +101,14 @@ jobs:
|
||||
working-directory: backend
|
||||
args: --enable-only=gofmt,gofumpt
|
||||
|
||||
- name: Sync userfront locales
|
||||
run: |
|
||||
/bin/sh ./scripts/sync_userfront_locales.sh
|
||||
|
||||
- name: Install Userfront dependencies
|
||||
run: |
|
||||
cd userfront
|
||||
flutter pub get
|
||||
cd userfront
|
||||
flutter pub get
|
||||
|
||||
- name: Format Flutter userfront
|
||||
run: |
|
||||
@@ -201,6 +210,10 @@ jobs:
|
||||
channel: "stable"
|
||||
cache: true
|
||||
|
||||
- name: Sync userfront locales
|
||||
run: |
|
||||
/bin/sh ./scripts/sync_userfront_locales.sh
|
||||
|
||||
- name: Run userfront tests
|
||||
run: |
|
||||
cd userfront
|
||||
@@ -276,6 +289,222 @@ jobs:
|
||||
reports/userfront-test.log
|
||||
if-no-files-found: ignore
|
||||
|
||||
userfront-e2e-tests:
|
||||
needs: lint
|
||||
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_e2e_tests == true) }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
cache-dependency-path: userfront-e2e/package-lock.json
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
cache: true
|
||||
|
||||
- name: Sync userfront locales
|
||||
run: |
|
||||
/bin/sh ./scripts/sync_userfront_locales.sh
|
||||
|
||||
- name: Install userfront-e2e dependencies
|
||||
run: |
|
||||
mkdir -p reports
|
||||
set +e
|
||||
cd userfront-e2e
|
||||
npm ci 2>&1 | tee ../reports/userfront-e2e-install.log
|
||||
install_exit_code=${PIPESTATUS[0]}
|
||||
cd ..
|
||||
set -e
|
||||
|
||||
if [ "$install_exit_code" -ne 0 ]; then
|
||||
{
|
||||
echo "# Userfront E2E Test Failure Report"
|
||||
echo
|
||||
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||
echo "- Job: \`userfront-e2e-tests\`"
|
||||
echo "- Reason: \`Dependency install failed\`"
|
||||
echo "- Exit Code: \`$install_exit_code\`"
|
||||
echo
|
||||
echo "## Command"
|
||||
echo "\`cd userfront-e2e && npm ci\`"
|
||||
echo
|
||||
echo "## Install Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-install.log
|
||||
echo '```'
|
||||
} > reports/userfront-e2e-test-failure-report.md
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build userfront WASM
|
||||
run: |
|
||||
mkdir -p reports
|
||||
set +e
|
||||
cd userfront
|
||||
flutter build web --wasm --release 2>&1 | tee ../reports/userfront-e2e-build.log
|
||||
build_exit_code=${PIPESTATUS[0]}
|
||||
cd ..
|
||||
set -e
|
||||
|
||||
if [ "$build_exit_code" -ne 0 ]; then
|
||||
{
|
||||
echo "# Userfront E2E Test Failure Report"
|
||||
echo
|
||||
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||
echo "- Job: \`userfront-e2e-tests\`"
|
||||
echo "- Reason: \`WASM build failed\`"
|
||||
echo "- Exit Code: \`$build_exit_code\`"
|
||||
echo
|
||||
echo "## Command"
|
||||
echo "\`cd userfront && flutter build web --wasm --release\`"
|
||||
echo
|
||||
echo "## Build Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-build.log
|
||||
echo '```'
|
||||
} > reports/userfront-e2e-test-failure-report.md
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Provision browsers for userfront-e2e tests
|
||||
run: |
|
||||
set +e
|
||||
cd userfront-e2e
|
||||
npx playwright install --with-deps chromium 2>&1 | tee ../reports/userfront-e2e-provision.log
|
||||
provision_exit_code=${PIPESTATUS[0]}
|
||||
cd ..
|
||||
set -e
|
||||
|
||||
if [ "$provision_exit_code" -ne 0 ]; then
|
||||
{
|
||||
echo "# Userfront E2E Test Failure Report"
|
||||
echo
|
||||
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||
echo "- Job: \`userfront-e2e-tests\`"
|
||||
echo "- Reason: \`Browser provisioning failed\`"
|
||||
echo "- Exit Code: \`$provision_exit_code\`"
|
||||
echo
|
||||
echo "## Command"
|
||||
echo "\`cd userfront-e2e && npx playwright install --with-deps chromium\`"
|
||||
echo
|
||||
echo "## Provision Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-provision.log
|
||||
echo '```'
|
||||
} > reports/userfront-e2e-test-failure-report.md
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run userfront-e2e tests
|
||||
run: |
|
||||
mkdir -p reports
|
||||
set +e
|
||||
cd userfront-e2e
|
||||
npm test 2>&1 | tee ../reports/userfront-e2e-test.log
|
||||
test_exit_code=${PIPESTATUS[0]}
|
||||
cd ..
|
||||
set -e
|
||||
|
||||
if [ "$test_exit_code" -ne 0 ]; then
|
||||
{
|
||||
echo "# Userfront E2E Test Failure Report"
|
||||
echo
|
||||
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||
echo "- Job: \`userfront-e2e-tests\`"
|
||||
echo "- Exit Code: \`$test_exit_code\`"
|
||||
echo
|
||||
echo "## Commands"
|
||||
echo "1. \`cd userfront-e2e\`"
|
||||
echo "2. \`npm ci\`"
|
||||
echo "3. \`cd ../userfront && flutter build web --wasm --release\`"
|
||||
echo "4. \`cd ../userfront-e2e && npx playwright install --with-deps chromium\`"
|
||||
echo "5. \`npm test\`"
|
||||
echo
|
||||
echo "## Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-test.log
|
||||
echo '```'
|
||||
} > reports/userfront-e2e-test-failure-report.md
|
||||
fi
|
||||
|
||||
exit "$test_exit_code"
|
||||
|
||||
- name: Ensure userfront-e2e failure report exists
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
mkdir -p reports
|
||||
if [ -f reports/userfront-e2e-test-failure-report.md ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
{
|
||||
echo "# Userfront E2E Test Failure Report"
|
||||
echo
|
||||
echo "- Workflow: \`${GITHUB_WORKFLOW:-Code Check}\`"
|
||||
echo "- Job: \`userfront-e2e-tests\`"
|
||||
echo "- Reason: \`Job failed before detailed report generation\`"
|
||||
echo
|
||||
if [ -f reports/userfront-e2e-install.log ]; then
|
||||
echo "## Install Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-install.log
|
||||
echo '```'
|
||||
echo
|
||||
fi
|
||||
if [ -f reports/userfront-e2e-build.log ]; then
|
||||
echo "## Build Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-build.log
|
||||
echo '```'
|
||||
echo
|
||||
fi
|
||||
if [ -f reports/userfront-e2e-provision.log ]; then
|
||||
echo "## Provision Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-provision.log
|
||||
echo '```'
|
||||
echo
|
||||
fi
|
||||
if [ -f reports/userfront-e2e-test.log ]; then
|
||||
echo "## Test Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
tail -n 200 reports/userfront-e2e-test.log
|
||||
echo '```'
|
||||
fi
|
||||
} > reports/userfront-e2e-test-failure-report.md
|
||||
|
||||
- name: Publish userfront-e2e failure summary
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
if [ -f reports/userfront-e2e-test-failure-report.md ]; then
|
||||
cat reports/userfront-e2e-test-failure-report.md >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
|
||||
- name: Upload userfront-e2e failure report artifact
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: userfront-e2e-test-failure-report
|
||||
path: |
|
||||
reports/userfront-e2e-test-failure-report.md
|
||||
reports/userfront-e2e-install.log
|
||||
reports/userfront-e2e-build.log
|
||||
reports/userfront-e2e-provision.log
|
||||
reports/userfront-e2e-test.log
|
||||
userfront-e2e/playwright-report
|
||||
userfront-e2e/test-results
|
||||
if-no-files-found: ignore
|
||||
|
||||
adminfront-tests:
|
||||
needs: lint
|
||||
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_adminfront_tests == true) }}
|
||||
|
||||
Reference in New Issue
Block a user