chore: Add playwright tests for app in local-only mode #4257
Workflow file for this run
This file contains hidden or 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: Main | |
on: | |
push: | |
branches: [main, v1] | |
pull_request: | |
branches: [main, v1] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
timeout-minutes: 8 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache-dependency-path: 'yarn.lock' | |
cache: 'yarn' | |
- name: Install root dependencies | |
run: yarn install | |
- name: Build dependencies | |
run: make ci-build | |
- name: Install core libs | |
run: sudo apt-get install --yes curl bc | |
- name: Run lint + type check | |
run: make ci-lint | |
unit: | |
timeout-minutes: 8 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache-dependency-path: 'yarn.lock' | |
cache: 'yarn' | |
- name: Install root dependencies | |
run: yarn install | |
- name: Build dependencies | |
run: make ci-build | |
- name: Run unit tests | |
run: make ci-unit | |
integration: | |
timeout-minutes: 8 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache-dependency-path: 'yarn.lock' | |
cache: 'yarn' | |
- name: Install root dependencies | |
run: yarn install | |
- name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v2 | |
- name: Spin up docker services | |
run: | | |
docker buildx create --use --driver=docker-container | |
docker buildx bake -f ./docker-compose.ci.yml --set *.cache-to="type=gha" --set *.cache-from="type=gha" --load | |
- name: Build dependencies | |
run: make ci-build | |
- name: Run integration tests | |
run: make ci-int | |
otel-smoke-test: | |
timeout-minutes: 8 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get changed OTEL collector files | |
id: changed-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
docker/otel-collector/** | |
smoke-tests/otel-ccollector/** | |
- name: Install required tooling | |
if: steps.changed-files.outputs.any_changed == 'true' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg | |
curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | sudo gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg | |
ARCH=$(dpkg --print-architecture) | |
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg arch=${ARCH}] https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list | |
sudo apt-get update | |
sudo apt-get install --yes curl bats clickhouse-client | |
- name: Run Smoke Tests | |
if: steps.changed-files.outputs.any_changed == 'true' | |
working-directory: ./smoke-tests/otel-collector | |
run: bats . | |
e2e-tests: | |
name: End-to-End Tests | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 15 | |
container: | |
image: mcr.microsoft.com/playwright:v1.55.0-jammy | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache-dependency-path: 'yarn.lock' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build dependencies | |
run: npx nx run-many -t ci:build | |
- name: Run Playwright tests | |
run: | | |
cd packages/app | |
yarn test:e2e | |
- name: Upload Playwright report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: packages/app/playwright-report/ | |
retention-days: 30 | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: packages/app/test-results/ | |
retention-days: 30 | |
- name: Generate test results message | |
id: test-results | |
if: always() && github.event_name == 'pull_request' | |
run: | | |
if [ -f "packages/app/test-results/results.json" ]; then | |
RESULTS=$(cat packages/app/test-results/results.json) | |
PASSED=$(echo $RESULTS | jq -r '.stats.expected') | |
FAILED=$(echo $RESULTS | jq -r '.stats.unexpected') | |
FLAKY=$(echo $RESULTS | jq -r '.stats.flaky') | |
SKIPPED=$(echo $RESULTS | jq -r '.stats.skipped') | |
DURATION=$(echo $RESULTS | jq -r '.stats.duration') | |
DURATION_SECONDS=$((DURATION / 1000)) | |
if [ "$FAILED" -gt 0 ]; then | |
if [ "$FAILED" -eq 1 ]; then | |
SUMMARY="❌ **1 test failed**" | |
else | |
SUMMARY="❌ **${FAILED} tests failed**" | |
fi | |
else | |
SUMMARY="✅ **All tests passed**" | |
fi | |
cat >> $GITHUB_OUTPUT << EOF | |
message<<EOD | |
## E2E Test Results | |
${SUMMARY} • ${PASSED} passed • ${SKIPPED} skipped • ${DURATION_SECONDS}s | |
| Status | Count | | |
|--------|-------| | |
| ✅ Passed | ${PASSED} | | |
| ❌ Failed | ${FAILED} | | |
| ⚠️ Flaky | ${FLAKY} | | |
| ⏭️ Skipped | ${SKIPPED} | | |
[View full report →](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
EOD | |
EOF | |
else | |
cat >> $GITHUB_OUTPUT << EOF | |
message<<EOD | |
## E2E Test Results | |
❌ **Test results file not found** | |
[View full report →](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
EOD | |
EOF | |
fi | |
- name: Comment PR with test results | |
uses: mshick/add-pr-comment@v2 | |
if: always() && github.event_name == 'pull_request' | |
with: | |
message: ${{ steps.test-results.outputs.message }} | |
message-id: e2e-test-results |