Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add viewable Matrix test Playwright reports #1169

Merged
merged 74 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
bc090f6
Change workflow to repeat Matrix tests
backspace Apr 15, 2024
1f76db8
Remove test exclusion
backspace Apr 16, 2024
18698fb
Add more iterations
backspace Apr 16, 2024
f48eb0e
Remove repetition for now
backspace Apr 16, 2024
fdbe199
Change to use sharding
backspace Apr 16, 2024
5ecf17e
Remove group from job name
backspace Apr 16, 2024
9cfdbe5
Add missed update
backspace Apr 16, 2024
32df3fc
Add upload to Github pages
backspace Apr 16, 2024
55c118e
Change to four shards
backspace Apr 16, 2024
d095596
Merge branch 'main' into matrix/flaky-cs-6640
backspace Apr 16, 2024
b2b55ae
Add exclusion to cut down test count
backspace Apr 16, 2024
57adafd
Add debug stesp
backspace Apr 16, 2024
71a1776
Remove most tests
backspace Apr 16, 2024
3a9ada0
Add subdirectory
backspace Apr 16, 2024
87aaa50
Remove host tests for now
backspace Apr 16, 2024
b52ada7
Change to use blobs in CI
backspace Apr 16, 2024
1ded875
Remove subdirectory
backspace Apr 16, 2024
bb1cb3c
Change merge approach
backspace Apr 16, 2024
00be0c1
Fix artifact upload directory
backspace Apr 16, 2024
f63b044
Add listing of pre-uploaded artifact
backspace Apr 17, 2024
172c4ac
Update Playwright
backspace Apr 17, 2024
20c6ff0
Add empty commit
backspace Apr 17, 2024
c9bae87
Change how Playwright is called
backspace Apr 17, 2024
32d4369
Add Playwright to root package.json
backspace Apr 17, 2024
4157b6d
Add empty commit
backspace Apr 17, 2024
3116aee
Add more logging
backspace Apr 17, 2024
911c5bd
Add empty commit
backspace Apr 17, 2024
e001680
Fix permissions
backspace Apr 17, 2024
c04ea8c
Add empty commit
backspace Apr 17, 2024
0b598bc
Remove skipped tests
backspace Apr 17, 2024
7b0ec08
Remove test groups
backspace Apr 17, 2024
e9f9ed6
Remove unused variable and import
backspace Apr 17, 2024
f434e09
Change to six shards
backspace Apr 17, 2024
abad8ac
Change to ten shards
backspace Apr 17, 2024
9bbf983
Add check with link to report
backspace Apr 17, 2024
84374ba
Fix indentation
backspace Apr 17, 2024
baf95f5
Add check write permissions
backspace Apr 17, 2024
60a8629
Add status permissions
backspace Apr 17, 2024
a09b6a3
Change to latest dependent action version
backspace Apr 17, 2024
2a3806d
Add note about delay
backspace Apr 17, 2024
06c7f2a
Change to two shards
backspace Apr 18, 2024
2265f2a
Update note about delay
backspace Apr 18, 2024
bcd8da5
Change to six shards
backspace Apr 18, 2024
7d2f1b6
Remove debugging scripts
backspace Apr 18, 2024
38890cd
Change blob retention
backspace Apr 18, 2024
ae7bada
Remove old approaches
backspace Apr 18, 2024
500c09e
Fix status step name
backspace Apr 18, 2024
b264497
Add missing snapshots
backspace Apr 18, 2024
3f42038
Add platform name for Linux snapshots
backspace Apr 18, 2024
b47ed90
Remove tagged duplicate snapshots
backspace Apr 18, 2024
8dde78f
Add delay before posting link
backspace Apr 18, 2024
4095889
Restore host tests
backspace Apr 18, 2024
ff8beff
Merge branch 'main' into matrix/flaky-cs-6640
backspace Apr 18, 2024
fb515be
Remove Github Pages work
backspace Apr 19, 2024
e7addc3
Add S3 setup
backspace Apr 19, 2024
9cd9e9b
Add attempt to sync
backspace Apr 19, 2024
ee59e64
Remove copypaste error
backspace Apr 19, 2024
dc44e11
Remove most tests (again)
backspace Apr 19, 2024
97b0877
Add id-token permissions
backspace Apr 19, 2024
77932b3
Restore link status with new URL
backspace Apr 19, 2024
f35e41b
Remove host tests again
backspace Apr 18, 2024
b188dfd
Add index.html suffix
backspace Apr 19, 2024
8f409b0
Add branch name to report path
backspace Apr 19, 2024
292275e
Remove delay on status
backspace Apr 19, 2024
8b65cc4
Remove trace of Pages approach
backspace Apr 19, 2024
26376db
Add name for sync step
backspace Apr 19, 2024
11c4039
Restore all tests
backspace Apr 19, 2024
0a2e170
Restore host tests
backspace Apr 19, 2024
140dbda
Add empty commit
backspace Apr 19, 2024
3aa9b8c
Fix nesting of sync step
backspace Apr 19, 2024
51e0494
Merge branch 'main' into matrix/flaky-cs-6640
backspace Apr 19, 2024
baa1304
Add empty commit
backspace Apr 19, 2024
d9082d0
Fix status name
backspace Apr 19, 2024
eb5d892
Fix test execution without shards
backspace Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 82 additions & 40 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ jobs:
with:
junit_files: junit/host.xml

matrix-client-test-1:
name: Matrix Client Tests - Group 1
matrix-client-test:
name: Matrix Client Tests
runs-on: ubuntu-latest
concurrency:
group: matrix-client-test-1-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6]
shardTotal: [6]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/init
Expand All @@ -203,50 +205,90 @@ jobs:
run: pnpm start:without-matrix &
working-directory: packages/realm-server
- name: Run Playwright tests
run: pnpm test:group group1
run: pnpm test:group ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
working-directory: packages/matrix
- uses: actions/upload-artifact@v3
if: always()

- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: packages/matrix/playwright-report/
retention-days: 30
name: blob-report-${{ matrix.shardIndex }}
path: packages/matrix/blob-report
retention-days: 1

matrix-client-test-2:
name: Matrix Client Tests - Group 2
matrix-client-merge-reports-and-publish:
name: Merge Matrix reports and publish
if: always()
needs: matrix-client-test
runs-on: ubuntu-latest
concurrency:
group: matrix-client-test-2-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
id-token: write
contents: write
checks: write
statuses: write

outputs:
timestamp: ${{ steps.timestampid.outputs.timestamp }}

steps:
- name: Create a timestamp as a directory to store reports in
id: timestampid
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v3
- uses: ./.github/actions/init
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
working-directory: packages/matrix
- name: Build boxel-ui
run: pnpm build
working-directory: packages/boxel-ui/addon
- name: Build boxel-motion
run: pnpm build
working-directory: packages/boxel-motion/addon
- name: Build host dist/ for fastboot
run: pnpm build

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true

- name: Merge blobs into one single report
run: pnpm exec playwright merge-reports --reporter html ./all-blob-reports

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14

- name: Set up env
env:
NODE_OPTIONS: --max_old_space_size=4096
working-directory: packages/host
- name: Start realm servers
run: pnpm start:without-matrix &
working-directory: packages/realm-server
- name: Run Playwright tests
run: pnpm test:group group2
working-directory: packages/matrix
- uses: actions/upload-artifact@v3
if: always()
INPUT_ENVIRONMENT: ${{ inputs.environment }}
run: |
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
echo "AWS_ROLE_ARN=arn:aws:iam::680542703984:role/boxel-matrix-playwright-reports" >> $GITHUB_ENV
echo "AWS_S3_BUCKET=cardstack-boxel-matrix-playwright-reports-staging" >> $GITHUB_ENV

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
name: playwright-report
path: packages/matrix/playwright-report/
retention-days: 30
role-to-assume: ${{ env.AWS_ROLE_ARN }}
aws-region: us-east-1

- name: Publish consolidated report to S3
run: aws s3 sync ./playwright-report s3://cardstack-boxel-matrix-playwright-reports-staging/${{ github.head_ref || github.ref_name }}/${{ steps.timestampid.outputs.timestamp }}

- name: Store Playwright report URL
shell: bash
run: echo "PLAYWRIGHT_REPORT_URL=https://boxel-matrix-playwright-reports.stack.cards/${{ github.head_ref || github.ref_name }}/${{ steps.timestampid.outputs.timestamp }}/index.html" >> $GITHUB_ENV

- name: Add status with link to Playwright report
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/statuses/$HEAD_SHA \
-d '{"context":"Matrix Playwright tests report","description":"","target_url":"'"$PLAYWRIGHT_REPORT_URL"'","state":"success"}'

realm-server-test:
name: Realm Server Tests
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@glint/core": "1.3.0",
"@glint/environment-ember-loose": "1.3.0",
"@glint/environment-ember-template-imports": "1.3.0",
"@playwright/test": "^1.43.1",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"ember-cli-htmlbars": "^6.3.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/matrix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"@playwright/test": "^1.35.0",
"@playwright/test": "^1.43.1",
"@types/fs-extra": "^9.0.13",
"@types/jsonwebtoken": "^9.0.5",
"@types/node": "^18.18.5",
Expand All @@ -29,11 +29,11 @@
"register-test-admin": "MATRIX_IS_ADMIN=TRUE MATRIX_USERNAME=admin MATRIX_PASSWORD=password ts-node --transpileOnly ./scripts/register-test-user.ts",
"register-test-admin-and-token": "pnpm register-test-admin && ts-node --transpileOnly ./scripts/register-test-token.ts",
"register-all": "pnpm register-test-admin-and-token && pnpm register-realm-users && pnpm register-bot-user",
"test": "./scripts/test.sh all",
"test": "./scripts/test.sh",
"test:group": "./scripts/test.sh",
"wait": "sleep 10000000",
"lint": "glint",
"clean": "rm -rf ./synapse-data"
"clean": "rm -rf ./synapse-data"
},
"volta": {
"extends": "../../package.json"
Expand Down
31 changes: 2 additions & 29 deletions packages/matrix/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { defineConfig, devices } from '@playwright/test';
import { readdirSync } from 'fs';

let tests = readdirSync('./tests');
let middle = Math.floor(tests.length / 2);
let group1 = tests.slice(0, middle);
let group2 = tests.slice(middle);
import { defineConfig } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -15,35 +9,14 @@ export default defineConfig({
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: 'html',
reporter: process.env.CI ? 'blob' : 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL: 'http://localhost:4202/test',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

projects: [
{
name: 'all',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'group1',
testMatch: new RegExp(
`.*(${group1.map((i) => i.replace(/\./g, '\\.')).join('|')})`,
),
use: { ...devices['Desktop Chrome'] },
},
{
name: 'group2',
testMatch: new RegExp(
`.*(${group2.map((i) => i.replace(/\./g, '\\.')).join('|')})`,
),
use: { ...devices['Desktop Chrome'] },
},
],
// General timeout per test
timeout: 30000,

Expand Down
3 changes: 2 additions & 1 deletion packages/matrix/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /bin/sh
shard_flag=${1:+--shard}
echo "running tests: ${1}"
start-server-and-test \
'pnpm run wait' \
'http-get://localhost:4201/base/fields/boolean-field?acceptHeader=application%2Fvnd.card%2Bjson|http-get://localhost:4202/test/hassan?acceptHeader=application%2Fvnd.card%2Bjson' \
'pnpm run start:host-pre-built' \
'http://127.0.0.1:4200' \
"pnpm playwright test --project=${1}"
"pnpm playwright test ${shard_flag} ${1}"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
30 changes: 20 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading