01 17 feat highly unlikely to work attempt to speed up integration tests #22649
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
# we call `pnpm playwright install` instead | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' | |
# cancel in-progress runs on new commits to same PR (gitub.event.number) | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
pkg-pr-new: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: pnpm | |
- run: pnpm install --frozen-lockfile | |
- run: pnpx pkg-pr-new publish --comment=off ./packages/* | |
lint-all: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: pnpm | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm run lint | |
- run: cd packages/kit && pnpm prepublishOnly && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please run prepublishOnly locally and commit the changes after you have reviewed them"; git diff; exit 1); } | |
- run: pnpm run check | |
list-kit-test-packages: | |
runs-on: ubuntu-latest | |
outputs: | |
package_groups: ${{ steps.set-package-groups.outputs.package_groups }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
- name: List and group test packages | |
id: set-package-groups | |
run: | | |
packages=$( | |
pnpm -r --filter="./packages/kit/test/**" exec sh -c ' | |
if [ -n "$(pnpm pkg get scripts.test 2>/dev/null)" ]; then | |
echo "$(basename $PWD)" | |
fi | |
' | sort | uniq | |
) | |
package_groups=$(echo "$packages" | jq -Rsc ' | |
[inputs | select(length>0)] | |
| _nwise(4) | |
| map(join(",")) | |
| to_entries | |
| map({key: "group\(.key)", value: .value}) | |
| from_entries | |
') | |
echo "package_groups=$package_groups" >> $GITHUB_OUTPUT | |
test-kit: | |
needs: list-kit-test-packages | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
package_group: ${{ fromJson(needs.list-kit-test-packages.outputs.package_groups) }} | |
node-version: [18, 20, 22] | |
include: | |
- os: ubuntu-latest | |
e2e-browser: 'chromium' | |
env: | |
KIT_E2E_BROWSER: ${{matrix.e2e-browser}} | |
steps: | |
- run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Install Playwright | |
run: pnpm playwright install ${{ matrix.e2e-browser }} | |
- name: Run tests | |
run: | | |
pnpm run sync-all | |
pnpm --filter="${{ matrix.package_group }}" test | |
- name: Print flaky test report | |
run: node scripts/print-flaky-test-report.js | |
- name: Archive test results | |
if: failure() | |
shell: bash | |
run: find packages -type d -name test-results -not -empty | tar -czf test-results.tar.gz --files-from=- | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 3 | |
name: test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}-${{ matrix.package_group }} | |
path: test-results.tar.gz | |
test-kit-results: | |
if: always() | |
needs: test-kit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check test results | |
run: | | |
if [ "${{ needs.test-kit.result }}" = "success" ]; then | |
echo "All tests passed successfully!" | |
exit 0 | |
else | |
echo "Some tests failed. Please check the individual job results." | |
exit 1 | |
fi | |
test-kit-cross-browser: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- node-version: 18 | |
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166 | |
e2e-browser: 'chromium' | |
mode: 'dev' | |
- node-version: 18 | |
os: ubuntu-latest | |
e2e-browser: 'firefox' | |
mode: 'dev' | |
- node-version: 18 | |
os: macOS-latest | |
e2e-browser: 'webkit' | |
mode: 'dev' | |
- node-version: 18 | |
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166 | |
e2e-browser: 'chromium' | |
mode: 'build' | |
- node-version: 18 | |
os: ubuntu-latest | |
e2e-browser: 'firefox' | |
mode: 'build' | |
- node-version: 18 | |
os: macOS-latest | |
e2e-browser: 'webkit' | |
mode: 'build' | |
env: | |
KIT_E2E_BROWSER: ${{matrix.e2e-browser}} | |
steps: | |
- run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm playwright install ${{ matrix.e2e-browser }} | |
- run: pnpm run sync-all | |
- run: pnpm test:cross-platform:${{ matrix.mode }} | |
- name: Print flaky test report | |
run: node scripts/print-flaky-test-report.js | |
- name: Archive test results | |
if: failure() | |
shell: bash | |
run: find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.mode }}.tar.gz --files-from=- | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 3 | |
name: test-failure-cross-platform-${{ matrix.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }} | |
path: test-results-cross-platform-${{ matrix.mode }}.tar.gz | |
test-others: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/[email protected] | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm playwright install chromium | |
- run: cd packages/kit && pnpm prepublishOnly | |
- run: pnpm run test:others |