Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 23 additions & 4 deletions .github/workflows/e2e-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,57 @@ jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ionic-major: 8
ionic-version: 8.8.19
- ionic-major: 9
ionic-version: 9.0.0
container:
image: mcr.microsoft.com/playwright:v1.58.2-noble
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- if: matrix.ionic-major == 8
run: npm install --no-save --package-lock=false @ionic/angular@${{ matrix.ionic-version }} @ionic/core@${{ matrix.ionic-version }}
- run: npm run build

- run: npm ci
working-directory: './demo'
- if: matrix.ionic-major == 8
run: npm install --no-save --package-lock=false @ionic/angular@${{ matrix.ionic-version }} @ionic/core@${{ matrix.ionic-version }}
working-directory: './demo'

- name: Run Playwright tests
run: npm run test:e2e
working-directory: ./demo
env:
IONIC_MAJOR: ${{ matrix.ionic-major }}

- name: Upload test results
uses: actions/upload-artifact@v5
if: always()
with:
name: playwright-report
name: playwright-report-ionic${{ matrix.ionic-major }}
path: demo/playwright-report/
retention-days: 3

- name: Upload screenshots on failure
uses: actions/upload-artifact@v5
if: failure()
with:
name: test-results
name: test-results-ionic${{ matrix.ionic-major }}
path: demo/test-results/
retention-days: 3
95 changes: 73 additions & 22 deletions .github/workflows/e2e-pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,119 @@ on:
types: [opened, synchronize, closed]

permissions:
contents: write
pull-requests: write
pages: write
id-token: write
contents: read

jobs:
test:
if: github.event.action != 'closed'
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- ionic-major: 8
ionic-version: 8.8.19
- ionic-major: 9
ionic-version: 9.0.0
container:
image: mcr.microsoft.com/playwright:v1.58.2-noble
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- if: matrix.ionic-major == 8
run: npm install --no-save --package-lock=false @ionic/angular@${{ matrix.ionic-version }} @ionic/core@${{ matrix.ionic-version }}
- run: npm run build

- run: npm ci
working-directory: './demo'
- if: matrix.ionic-major == 8
run: npm install --no-save --package-lock=false @ionic/angular@${{ matrix.ionic-version }} @ionic/core@${{ matrix.ionic-version }}
working-directory: './demo'

- name: Run Playwright tests
run: PLAYWRIGHT_JSON_OUTPUT_NAME=e2e/screenshot.spec.ts.json npm run test:e2e -- --reporter=json,html
run: PLAYWRIGHT_JSON_OUTPUT_NAME=e2e/screenshot.spec.ts-ionic${{ matrix.ionic-major }}.json npm run test:e2e -- --reporter=json,html
working-directory: ./demo
env:
IONIC_MAJOR: ${{ matrix.ionic-major }}

- name: Upload test results
uses: actions/upload-artifact@v5
if: always()
with:
name: playwright-report
name: playwright-report-ionic${{ matrix.ionic-major }}
path: demo/playwright-report/
retention-days: 3

- name: Upload screenshots on failure
uses: actions/upload-artifact@v5
if: failure()
with:
name: test-results
name: test-results-ionic${{ matrix.ionic-major }}
path: demo/test-results/
retention-days: 3

- name: Comment PR with test results
uses: daun/playwright-report-comment@v3
if: always()
- name: Upload Ionic 9 JSON report artifact
uses: actions/upload-artifact@v5
if: always() && matrix.ionic-major == 9
with:
report-file: demo/e2e/screenshot.spec.ts.json
job-summary: true
custom-info: 'Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. And if you want to update the screenshots, please comment with `/update-screenshots`.'
name: json-report-${{ github.event.pull_request.number }}
path: demo/e2e/screenshot.spec.ts-ionic9.json
retention-days: 3

- name: Upload HTML report artifact
- name: Upload Ionic 9 HTML report artifact
uses: actions/upload-artifact@v5
if: always()
if: always() && matrix.ionic-major == 9
with:
name: html-report-${{ github.event.pull_request.number }}
path: demo/playwright-report/
retention-days: 30

comment-results:
needs: test
if: >-
always() &&
github.event.action != 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Download JSON report
uses: actions/download-artifact@v5
with:
name: json-report-${{ github.event.pull_request.number }}
path: report

- name: Comment PR with Ionic 9 test results
uses: daun/playwright-report-comment@v3
with:
report-file: report/screenshot.spec.ts-ionic9.json
job-summary: true
custom-info: 'This detailed result covers Ionic 9 only. Ionic 8 runs against the same screenshots in a separate matrix job; check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for both results. To update the screenshots, comment with `/update-screenshots`.'

deploy-report:
needs: test
if: always() && github.event.action != 'closed'
if: >-
always() &&
github.event.action != 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Download HTML report
uses: actions/download-artifact@v5
Expand All @@ -91,7 +138,7 @@ jobs:
if [ ! -d "gh-pages" ]; then
mkdir -p gh-pages
fi

# PR用のディレクトリを作成(既存の場合は削除して再作成)
rm -rf gh-pages/pr-${{ github.event.pull_request.number }}
mkdir -p gh-pages/pr-${{ github.event.pull_request.number }}
Expand All @@ -114,17 +161,21 @@ jobs:
script: |
const prNumber = context.payload.pull_request.number;
const reportUrl = `https://${context.repo.owner}.github.io/${context.repo.repo}/pr-${prNumber}/`;

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `📊 **Playwright Test Report**\n\nView the detailed test report: ${reportUrl}`
body: `📊 **Ionic 9 Playwright Test Report**\n\nView the detailed Ionic 9 report: ${reportUrl}\n\nIonic 8 runs against the same screenshots in a separate matrix job. View both results in the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).`
});

cleanup-report:
if: github.event.action == 'closed'
if: >-
github.event.action == 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages
uses: actions/checkout@v5
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:
types: [opened, synchronize, reopened]
push:
branches: [main]

concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
prettier:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,8 +38,8 @@ jobs:
restore-keys: |
${{ runner.os }}-angular-${{ hashFiles('demo/package-lock.json') }}-
${{ runner.os }}-angular-
# The demo depends on this package via `file:..`, so the root package
# must be installed and built (dist/) before the demo can compile.
# The demo compiles the theme source directly, so install the root
# dependencies and verify the package build before checking the demo.
- run: npm ci
- run: npm run build
- run: npm ci
Expand Down
Loading
Loading