Skip to content

chore(deps): update dependency knip to v5.41.0 #1971

chore(deps): update dependency knip to v5.41.0

chore(deps): update dependency knip to v5.41.0 #1971

Workflow file for this run

name: E2E Test
on:
pull_request:
workflow_call:
workflow_dispatch:
schedule:
- cron: '0 0 * * SUN'
permissions: {}
defaults:
run:
shell: bash
jobs:
list-astro-versions:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read # for checkout
outputs:
astro-versions: ${{ steps.list.outputs.versions }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
experimental: true
install: false
- name: Install mise tools
# cspell:ignore reshim
# reshim is required to avoid "No such file or directory" error
# ref: https://github.com/jdx/mise/issues/2260
run: mise install || (mise reshim && mise install)
- name: Install package.json dependencies
run: mise run buni
- name: List astro versions for E2E tests
id: list
run: |
versions=$(bun run .github/workflows/scripts/list-astro-versions.ts)
echo "versions=$versions" >> "$GITHUB_OUTPUT"
test-e2e-general:
needs:
- list-astro-versions
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read # for checkout
name: test-e2e-general-astro-${{ matrix.version }}
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.list-astro-versions.outputs.astro-versions) }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
experimental: true
install: false
- name: Install mise tools
# cspell:ignore reshim
# reshim is required to avoid "No such file or directory" error
# ref: https://github.com/jdx/mise/issues/2260
run: mise install || (mise reshim && mise install)
- name: Install package.json dependencies
run: mise run buni
- name: Build Package
run: mise run build
- name: Install E2E Test Fixtures Dependencies
run: bun install astro@${{ matrix.version }}
working-directory: tests/e2e/fixtures
- name: Build E2E Test Fixtures with astro-better-image-service
run: bun run build
working-directory: tests/e2e/fixtures
- name: Store Dependency Versions
id: dependency-versions
run: |
playwright_version=$(bun pm ls | sed -nE 's/.*@playwright\/test@(.+)/\1/p')
echo "playwright=$playwright_version" >> "$GITHUB_OUTPUT"
- name: Restore Playwright Browsers Cache
id: restore-browsers-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ steps.dependency-versions.outputs.playwright }}
- name: Install Playwright Browsers and Dependencies
id: playwright-install
if: steps.restore-browsers-cache.outputs.cache-hit != 'true'
run: bun run playwright install chromium --with-deps
- name: Save Playwright Browsers Cache
if: steps.restore-browsers-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/ms-playwright
key: ${{ steps.restore-browsers-cache.outputs.cache-primary-key }}
- name: Install Playwright Dependencies
if: steps.playwright-install.outcome == 'skipped'
run: bun run playwright install-deps chromium
- name: Playwright Test
id: playwright-test
run: mise run test:e2e
- name: Upload the Playwright Report
# use failure() because success() is used implicitly
# ref: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
if: failure() && steps.playwright-test.outcome == 'failure'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: playwright-report-astro-${{ matrix.version }}-${{ github.sha }}
path: playwright-report/
test-e2e-conversion:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read # for checkout
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
experimental: true
install: false
- name: Install mise tools
# cspell:ignore reshim
# reshim is required to avoid "No such file or directory" error
# ref: https://github.com/jdx/mise/issues/2260
run: mise install || (mise reshim && mise install)
- name: Install package.json dependencies
run: mise run buni
- name: Build Package
run: mise run build
- name: Store Dependency Versions
id: dependency-versions
run: |
playwright_version=$(bun pm ls | sed -nE 's/.*@playwright\/test@(.+)/\1/p')
astro_version=$(bun pm ls | sed -nE 's/.*astro@(.+)/\1/p' | uniq)
# throw error if several versions are found
if [[ $(echo "$astro_version" | wc -l) -gt 1 ]]; then
echo "Multiple versions of Astro found: $astro_version"
exit 1
fi
echo "playwright=$playwright_version" >> "$GITHUB_OUTPUT"
echo "astro=$astro_version" >> "$GITHUB_OUTPUT"
- name: Restore Playwright Browsers Cache
id: restore-browsers-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ steps.dependency-versions.outputs.playwright }}
- name: Install Playwright Browsers and Dependencies
id: playwright-install
if: steps.restore-browsers-cache.outputs.cache-hit != 'true'
run: bun run playwright install chromium --with-deps
- name: Save Playwright Browsers Cache
if: steps.restore-browsers-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/ms-playwright
key: ${{ steps.restore-browsers-cache.outputs.cache-primary-key }}
- name: Install Playwright Dependencies
if: steps.playwright-install.outcome == 'skipped'
run: bun run playwright install-deps chromium
- name: Store Hash of E2E Test Fixtures and Image Service Consistency Test
id: fixtures-hash
run: echo "hash=${{ hashFiles('tests/e2e/fixtures/**/*', 'tests/e2e/conversion.test.ts') }}" >> "$GITHUB_OUTPUT"
- name: Install E2E Test Fixtures Dependencies
run: bun install --frozen-lockfile
working-directory: tests/e2e/fixtures
- name: Restore Snapshots Cache
id: restore-snapshots-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: tests/e2e/conversion.test.ts-snapshots
key: "default-service-snapshots-${{ runner.os }}-${{ steps.dependency-versions.outputs.astro }}-${{ steps.dependency-versions.outputs.playwright }}-${{ steps.fixtures-hash.outputs.hash }}"
- name: Build E2E Test Fixtures with the Default Image Service
if: steps.restore-snapshots-cache.outputs.cache-hit != 'true'
run: bun run build
working-directory: tests/e2e/fixtures
env:
USE_DEFAULT_IMAGE_SERVICE: true
- name: Take Snapshots with the Default Image Service
if: steps.restore-snapshots-cache.outputs.cache-hit != 'true'
run: bun run playwright test conversion --update-snapshots
env:
USE_DEFAULT_IMAGE_SERVICE: true
- name: Save Snapshots Cache
if: steps.restore-snapshots-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: tests/e2e/conversion.test.ts-snapshots
key: ${{ steps.restore-snapshots-cache.outputs.cache-primary-key }}
- name: Build E2E Test Fixtures with astro-better-image-service
run: bun run build
working-directory: tests/e2e/fixtures
- name: Playwright Image Services Consistency Test
id: playwright-test-conversion
run: bun run playwright test conversion
- name: Upload the Playwright Report of Image Services Consistency Test
# use failure() because success() is used implicitly
# ref: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
if: failure() && steps.playwright-test-conversion.outcome == 'failure'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: playwright-report-conversion-${{ github.sha }}
path: playwright-report/
test-e2e-status:
needs:
- test-e2e-general
- test-e2e-conversion
# skip if the workflow is called from another workflow
if: ${{ !cancelled() && contains(github.workflow_ref, '/e2e.yml') }}
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check the status of the jobs
run: |
if [[ $(echo '${{ toJson(needs.*.result) }}' | jq 'all(. == "success")') == "false" ]]; then
echo 'Some jobs are failed, cancelled, or skipped.'
exit 1
fi
echo 'All jobs are successful.'
actions-timeline:
needs:
- test-e2e-status
if: needs.test-e2e-status.result == 'success' || needs.test-e2e-status.result == 'failure'
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
actions: read
steps:
- name: actions-timeline
# cspell:ignore kesin
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1