From 1e3eedd2d14dfd57d909a09c32f854ef65fa214d Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:02:41 +0800 Subject: [PATCH 01/35] ci(work-in-progress): simplify CI matrix and more comprehensive tests --- .github/workflows/ci.yml | 191 +++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 97 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e636917ab..92e9fbe25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: - run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 + CHROMEDRIVER_SKIP_DOWNLOAD: true - run: pnpm build - run: pnpm test:unit @@ -35,72 +36,88 @@ jobs: path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - test: + test-build: + needs: build + strategy: + matrix: + node-version: [22] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.os == 'windows-latest' }} + env: + # Sometimes the Linux runner can't verify Cypress in 30s + CYPRESS_VERIFY_TIMEOUT: 60000 + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - uses: actions/cache/restore@v4 + id: cache-restore + with: + path: | + outfile.cjs + playground + key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Build the package on cache miss + if: steps.cache-restore.outputs.cache-hit != 'true' + run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile + + - name: Run build script in playground + working-directory: ./playground + run: pnpm --filter "*" build + + test-vitest: needs: build strategy: matrix: - flag-for-ts: ['', '--typescript'] - flag-for-jsx: ['', '--jsx'] - flag-for-router: ['', '--router'] - flag-for-pinia: ['', '--pinia'] - flag-for-vitest: ['', '--vitest'] + node-version: [22] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.os == 'windows-latest' }} + env: + CYPRESS_INSTALL_BINARY: 0 + CHROMEDRIVER_SKIP_DOWNLOAD: true + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' - # It's quite costly to install Cypress & Playwright even with cache. - # Maybe we can split them into another job so that all the projects - # can share the same binary installation. - flag-for-e2e: ['', '--cypress', '--playwright'] + - uses: actions/cache/restore@v4 + id: cache-restore + with: + path: | + outfile.cjs + playground + key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Build the package on cache miss + if: steps.cache-restore.outputs.cache-hit != 'true' + run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile + - name: Run test:unit script in vitest projects + working-directory: ./playground + run: pnpm --filter "{*vitest*}" test:unit - # Skip ESLint/Prettier tests as we've reached the limit of job numbers - # TODO: Find a way to test them without adding new jobs + # FIXME: it's failing now + # - name: Run test:unit script in with-tests projects + # working-directory: ./playground + # run: pnpm --filter "{*with-tests*}" test:unit + test-e2e: + needs: build + strategy: + matrix: + e2e-framework: ['cypress', 'playwright'] node-version: [22] - os: [ubuntu-latest] - - # Run a few tests on other systems and Node.js versions - include: - - node-version: 22 - os: windows-latest - flag-for-ts: '--typescript' - flag-for-jsx: '--jsx' - flag-for-router: '--router' - flag-for-pinia: '--pinia' - flag-for-vitest: '--vitest' - flag-for-e2e: '--cypress' - flag-for-eslint: '--eslint' - - - node-version: 22 - os: macos-latest - flag-for-ts: '--typescript' - flag-for-jsx: '--jsx' - flag-for-router: '--router' - flag-for-pinia: '--pinia' - flag-for-vitest: '--vitest' - flag-for-e2e: '--cypress' - flag-for-eslint: '--eslint' - - - node-version: 18 - os: ubuntu-latest - flag-for-ts: '--typescript' - flag-for-jsx: '--jsx' - flag-for-router: '--router' - flag-for-pinia: '--pinia' - flag-for-vitest: '--vitest' - flag-for-e2e: '--cypress' - flag-for-eslint: '--eslint' - - - node-version: 20 - os: ubuntu-latest - flag-for-ts: '--typescript' - flag-for-jsx: '--jsx' - flag-for-router: '--router' - flag-for-pinia: '--pinia' - flag-for-vitest: '--vitest' - flag-for-e2e: '--cypress' - flag-for-eslint: '--eslint' + os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: - FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }} ${{matrix.flag-for-eslint}} # Sometimes the Linux runner can't verify Cypress in 30s CYPRESS_VERIFY_TIMEOUT: 60000 steps: @@ -110,19 +127,20 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'pnpm' + - uses: actions/cache/restore@v4 id: cache-restore with: - path: outfile.cjs + path: | + outfile.cjs + playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build - + run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 # Install playwright's binary under custom directory to cache - name: Set Playwright & Cypress path - if: runner.os != 'Windows' run: | echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV @@ -132,7 +150,7 @@ jobs: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV - - if: ${{ contains(matrix.flag-for-e2e, '--cypress') }} + - if: ${{ contains(matrix.e2e-framework, 'cypress') }} name: Cache Cypress binaries id: cache-cypress uses: actions/cache@v4 @@ -141,7 +159,7 @@ jobs: key: ${{ runner.os }}-cypress-bin path: ${{ env.CYPRESS_CACHE_FOLDER }} - - if: ${{ contains(matrix.flag-for-e2e, '--playwright') }} + - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Cache Playwright's binary uses: actions/cache@v4 with: @@ -150,47 +168,26 @@ jobs: key: ${{ runner.os }}-playwright-bin-v1 path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - - if: ${{ (contains(env.FEATURE_FLAGS, '--')) }} - name: Create the sample project with feature flags - working-directory: ../ - run: node ./create-vue/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} - - - if: ${{ !(contains(env.FEATURE_FLAGS, '--')) }} - name: Create the sample project with default options - working-directory: ../ - run: node ./create-vue/outfile.cjs sample-project --default - - - name: Install dependencies in the sample project - working-directory: ../sample-project - run: pnpm install - - - if: ${{ contains(matrix.flag-for-vitest, '--') }} - name: Run unit test script - working-directory: ../sample-project - run: pnpm test:unit - - - name: Run build script - working-directory: ../sample-project - run: pnpm build - - name: Download Cypress - if: ${{ contains(matrix.flag-for-e2e, '--cypress') }} - working-directory: ../sample-project + if: ${{ contains(matrix.e2e-framework, 'cypress') }} + working-directory: ./playground run: | pnpm exec cypress cache list pnpm exec cypress install - - if: ${{ contains(matrix.flag-for-e2e, '--playwright') }} + - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Install Playwright dependencies - working-directory: ../sample-project + working-directory: ./playground run: npx playwright install --with-deps - - if: ${{ contains(matrix.flag-for-e2e, '--') }} - name: Run e2e test script - working-directory: ../sample-project - run: pnpm test:e2e + # Run `test:e2e` in project folders contain `matrix.e2e-framework` + - name: Run e2e test script + working-directory: ./playground + run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e + + # FIXME: `--with-tests` folders + # FIXME: Cypress component testing for projects without Vitest + - - if: ${{ contains(matrix.flag-for-eslint, '--') }} - name: Run lint script - working-directory: ../sample-project - run: pnpm lint --no-fix --max-warnings=0 + # FIXME: test-lint + # `pnpm lint --no-fix --max-warnings=0` From 7ef4f77b84e18c2413e4f1e1537016a29bd0610d Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:09:56 +0800 Subject: [PATCH 02/35] ci: invoke cypress/playwright commands in their own project directories --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92e9fbe25..4f3ade97d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,14 +170,14 @@ jobs: - name: Download Cypress if: ${{ contains(matrix.e2e-framework, 'cypress') }} - working-directory: ./playground + working-directory: ./playground/cypress run: | pnpm exec cypress cache list pnpm exec cypress install - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Install Playwright dependencies - working-directory: ./playground + working-directory: ./playground/playwright run: npx playwright install --with-deps # Run `test:e2e` in project folders contain `matrix.e2e-framework` From 788e34daa00aa80e79d71a2e62d645f11e87338b Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:20:50 +0800 Subject: [PATCH 03/35] ci: use filter instead of relying on working-directory due to weird behavior --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f3ade97d..98dc6c14e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,15 +170,15 @@ jobs: - name: Download Cypress if: ${{ contains(matrix.e2e-framework, 'cypress') }} - working-directory: ./playground/cypress + working-directory: ./playground run: | - pnpm exec cypress cache list - pnpm exec cypress install + pnpm --filter "{cypress}" exec cypress cache list + pnpm --filter "{cypress}" exec cypress install - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Install Playwright dependencies - working-directory: ./playground/playwright - run: npx playwright install --with-deps + working-directory: ./playground + run: pnpm --filter "{playwright}" exec playwright install --with-deps # Run `test:e2e` in project folders contain `matrix.e2e-framework` - name: Run e2e test script From b7417c186e458f2ad1b745459f019fa1b1a10896 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:27:26 +0800 Subject: [PATCH 04/35] ci: is it because of the `cd` command messed up the working directory? --- .github/workflows/ci.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98dc6c14e..452c2f648 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,10 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile + run: pnpm install && pnpm build && pnpm snapshot + - name: Install dependencies in playground + working-directory: ./playground + run: pnpm install --no-frozen-lockfile - name: Run build script in playground working-directory: ./playground @@ -98,7 +101,10 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile + run: pnpm install && pnpm build && pnpm snapshot + - name: Install dependencies in playground + working-directory: ./playground + run: pnpm install --no-frozen-lockfile - name: Run test:unit script in vitest projects working-directory: ./playground run: pnpm --filter "{*vitest*}" test:unit @@ -137,7 +143,11 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && cd playground && pnpm install --no-frozen-lockfile + run: pnpm install && pnpm build && pnpm snapshot + - name: Install dependencies in playground + working-directory: ./playground + run: pnpm install --no-frozen-lockfile + # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 # Install playwright's binary under custom directory to cache - name: Set Playwright & Cypress path From 93f3eaf06e64fd987027a550a52bb1904cc0e245 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:37:25 +0800 Subject: [PATCH 05/35] ci: move playground to an outside directory to see if it works --- .github/workflows/ci.yml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 452c2f648..909df66eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,12 +65,15 @@ jobs: - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' run: pnpm install && pnpm build && pnpm snapshot + - name: Move playground to an outside directory to work around working-directory issue + if: steps.cache-restore.outputs.cache-hit != 'true' + run: mv playground ../playground - name: Install dependencies in playground - working-directory: ./playground + working-directory: ../playground run: pnpm install --no-frozen-lockfile - name: Run build script in playground - working-directory: ./playground + working-directory: ../playground run: pnpm --filter "*" build test-vitest: @@ -97,21 +100,24 @@ jobs: with: path: | outfile.cjs - playground + ../playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' run: pnpm install && pnpm build && pnpm snapshot + - name: Move playground to an outside directory to work around working-directory issue + if: steps.cache-restore.outputs.cache-hit != 'true' + run: mv playground ../playground - name: Install dependencies in playground - working-directory: ./playground + working-directory: ../playground run: pnpm install --no-frozen-lockfile - name: Run test:unit script in vitest projects - working-directory: ./playground + working-directory: ../playground run: pnpm --filter "{*vitest*}" test:unit # FIXME: it's failing now # - name: Run test:unit script in with-tests projects - # working-directory: ./playground + # working-directory: ../playground # run: pnpm --filter "{*with-tests*}" test:unit test-e2e: @@ -144,8 +150,11 @@ jobs: - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' run: pnpm install && pnpm build && pnpm snapshot + - name: Move playground to an outside directory to work around working-directory issue + if: steps.cache-restore.outputs.cache-hit != 'true' + run: mv playground ../playground - name: Install dependencies in playground - working-directory: ./playground + working-directory: ../playground run: pnpm install --no-frozen-lockfile # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 @@ -180,19 +189,19 @@ jobs: - name: Download Cypress if: ${{ contains(matrix.e2e-framework, 'cypress') }} - working-directory: ./playground + working-directory: ../playground run: | pnpm --filter "{cypress}" exec cypress cache list pnpm --filter "{cypress}" exec cypress install - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Install Playwright dependencies - working-directory: ./playground + working-directory: ../playground run: pnpm --filter "{playwright}" exec playwright install --with-deps # Run `test:e2e` in project folders contain `matrix.e2e-framework` - name: Run e2e test script - working-directory: ./playground + working-directory: ../playground run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e # FIXME: `--with-tests` folders From 8cf9707b0c7a42724767f048e6b573b83c128dc0 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:42:20 +0800 Subject: [PATCH 06/35] ci: add package.json in playground --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 909df66eb..e109a9f0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot + run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - name: Move playground to an outside directory to work around working-directory issue if: steps.cache-restore.outputs.cache-hit != 'true' run: mv playground ../playground @@ -104,7 +104,7 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot + run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - name: Move playground to an outside directory to work around working-directory issue if: steps.cache-restore.outputs.cache-hit != 'true' run: mv playground ../playground @@ -149,7 +149,7 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot + run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - name: Move playground to an outside directory to work around working-directory issue if: steps.cache-restore.outputs.cache-hit != 'true' run: mv playground ../playground From 30e5c0e9bde61bf6b80b7bcda5c5d1e548a8eca1 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:50:26 +0800 Subject: [PATCH 07/35] ci: how about skipping playground cache? --- .github/workflows/ci.yml | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e109a9f0e..4e17a0c0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,16 +58,12 @@ jobs: - uses: actions/cache/restore@v4 id: cache-restore with: - path: | - outfile.cjs - playground + path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss - if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - - name: Move playground to an outside directory to work around working-directory issue - if: steps.cache-restore.outputs.cache-hit != 'true' - run: mv playground ../playground + run: pnpm install && pnpm build + - name: Snapshot + run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - name: Install dependencies in playground working-directory: ../playground run: pnpm install --no-frozen-lockfile @@ -98,16 +94,13 @@ jobs: - uses: actions/cache/restore@v4 id: cache-restore with: - path: | - outfile.cjs - ../playground + path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - - name: Move playground to an outside directory to work around working-directory issue - if: steps.cache-restore.outputs.cache-hit != 'true' - run: mv playground ../playground + run: pnpm install && pnpm build + - name: Snapshot + run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - name: Install dependencies in playground working-directory: ../playground run: pnpm install --no-frozen-lockfile @@ -143,16 +136,13 @@ jobs: - uses: actions/cache/restore@v4 id: cache-restore with: - path: | - outfile.cjs - playground + path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - - name: Move playground to an outside directory to work around working-directory issue - if: steps.cache-restore.outputs.cache-hit != 'true' - run: mv playground ../playground + run: pnpm install && pnpm build + - name: Snapshot + run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - name: Install dependencies in playground working-directory: ../playground run: pnpm install --no-frozen-lockfile From 32fc1d420d74ac5a0554a427f57be23c32e7466c Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:55:00 +0800 Subject: [PATCH 08/35] ci: let's focus on test-build until it passed --- .github/workflows/ci.yml | 267 ++++++++++++++++++++------------------- 1 file changed, 135 insertions(+), 132 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e17a0c0d..3dbb6b68f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,12 +28,15 @@ jobs: - run: pnpm build - run: pnpm test:unit + - run: pnpm snapshot # Use cache to share the output across different jobs # No need to cache node_modules because they are all bundled - uses: actions/cache/save@v4 id: cache with: - path: outfile.cjs + path: | + outfile.cjs + playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} test-build: @@ -61,9 +64,9 @@ jobs: path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss - run: pnpm install && pnpm build - - name: Snapshot - run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + run: pnpm install && pnpm build && pnpm snapshot + - name: Move playground + run: echo "{}" > playground/package.json && mv playground ../playground - name: Install dependencies in playground working-directory: ../playground run: pnpm install --no-frozen-lockfile @@ -72,131 +75,131 @@ jobs: working-directory: ../playground run: pnpm --filter "*" build - test-vitest: - needs: build - strategy: - matrix: - node-version: [22] - os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.os == 'windows-latest' }} - env: - CYPRESS_INSTALL_BINARY: 0 - CHROMEDRIVER_SKIP_DOWNLOAD: true - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - uses: actions/cache/restore@v4 - id: cache-restore - with: - path: outfile.cjs - key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - - name: Build the package on cache miss - if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build - - name: Snapshot - run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - - name: Install dependencies in playground - working-directory: ../playground - run: pnpm install --no-frozen-lockfile - - name: Run test:unit script in vitest projects - working-directory: ../playground - run: pnpm --filter "{*vitest*}" test:unit - - # FIXME: it's failing now - # - name: Run test:unit script in with-tests projects - # working-directory: ../playground - # run: pnpm --filter "{*with-tests*}" test:unit - - test-e2e: - needs: build - strategy: - matrix: - e2e-framework: ['cypress', 'playwright'] - node-version: [22] - os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.os == 'windows-latest' }} - env: - # Sometimes the Linux runner can't verify Cypress in 30s - CYPRESS_VERIFY_TIMEOUT: 60000 - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - uses: actions/cache/restore@v4 - id: cache-restore - with: - path: outfile.cjs - key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - - name: Build the package on cache miss - if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build - - name: Snapshot - run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - - name: Install dependencies in playground - working-directory: ../playground - run: pnpm install --no-frozen-lockfile - - # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 - # Install playwright's binary under custom directory to cache - - name: Set Playwright & Cypress path - run: | - echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV - echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV - - name: Set Playwright & Cypress path (windows) - if: runner.os == 'Windows' - run: | - echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV - echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV - - - if: ${{ contains(matrix.e2e-framework, 'cypress') }} - name: Cache Cypress binaries - id: cache-cypress - uses: actions/cache@v4 - with: - # TODO: avoid snowballing by adding version - key: ${{ runner.os }}-cypress-bin - path: ${{ env.CYPRESS_CACHE_FOLDER }} - - - if: ${{ contains(matrix.e2e-framework, 'playwright') }} - name: Cache Playwright's binary - uses: actions/cache@v4 - with: - # Playwright removes unused browsers automatically - # So does not need to add playwright version to key - key: ${{ runner.os }}-playwright-bin-v1 - path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - - - name: Download Cypress - if: ${{ contains(matrix.e2e-framework, 'cypress') }} - working-directory: ../playground - run: | - pnpm --filter "{cypress}" exec cypress cache list - pnpm --filter "{cypress}" exec cypress install - - - if: ${{ contains(matrix.e2e-framework, 'playwright') }} - name: Install Playwright dependencies - working-directory: ../playground - run: pnpm --filter "{playwright}" exec playwright install --with-deps - - # Run `test:e2e` in project folders contain `matrix.e2e-framework` - - name: Run e2e test script - working-directory: ../playground - run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e - - # FIXME: `--with-tests` folders - # FIXME: Cypress component testing for projects without Vitest - - - # FIXME: test-lint - # `pnpm lint --no-fix --max-warnings=0` + # test-vitest: + # needs: build + # strategy: + # matrix: + # node-version: [22] + # os: [ubuntu-latest, windows-latest, macos-latest] + # runs-on: ${{ matrix.os }} + # continue-on-error: ${{ matrix.os == 'windows-latest' }} + # env: + # CYPRESS_INSTALL_BINARY: 0 + # CHROMEDRIVER_SKIP_DOWNLOAD: true + # steps: + # - uses: actions/checkout@v4 + # - uses: pnpm/action-setup@v3 + # - uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node-version }} + # cache: 'pnpm' + + # - uses: actions/cache/restore@v4 + # id: cache-restore + # with: + # path: outfile.cjs + # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + # - name: Build the package on cache miss + # if: steps.cache-restore.outputs.cache-hit != 'true' + # run: pnpm install && pnpm build + # - name: Snapshot + # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + # - name: Install dependencies in playground + # working-directory: ../playground + # run: pnpm install --no-frozen-lockfile + # - name: Run test:unit script in vitest projects + # working-directory: ../playground + # run: pnpm --filter "{*vitest*}" test:unit + + # # FIXME: it's failing now + # # - name: Run test:unit script in with-tests projects + # # working-directory: ../playground + # # run: pnpm --filter "{*with-tests*}" test:unit + + # test-e2e: + # needs: build + # strategy: + # matrix: + # e2e-framework: ['cypress', 'playwright'] + # node-version: [22] + # os: [ubuntu-latest, windows-latest, macos-latest] + # runs-on: ${{ matrix.os }} + # continue-on-error: ${{ matrix.os == 'windows-latest' }} + # env: + # # Sometimes the Linux runner can't verify Cypress in 30s + # CYPRESS_VERIFY_TIMEOUT: 60000 + # steps: + # - uses: actions/checkout@v4 + # - uses: pnpm/action-setup@v3 + # - uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node-version }} + # cache: 'pnpm' + + # - uses: actions/cache/restore@v4 + # id: cache-restore + # with: + # path: outfile.cjs + # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + # - name: Build the package on cache miss + # if: steps.cache-restore.outputs.cache-hit != 'true' + # run: pnpm install && pnpm build + # - name: Snapshot + # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + # - name: Install dependencies in playground + # working-directory: ../playground + # run: pnpm install --no-frozen-lockfile + + # # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 + # # Install playwright's binary under custom directory to cache + # - name: Set Playwright & Cypress path + # run: | + # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV + # echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV + # - name: Set Playwright & Cypress path (windows) + # if: runner.os == 'Windows' + # run: | + # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV + # echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV + + # - if: ${{ contains(matrix.e2e-framework, 'cypress') }} + # name: Cache Cypress binaries + # id: cache-cypress + # uses: actions/cache@v4 + # with: + # # TODO: avoid snowballing by adding version + # key: ${{ runner.os }}-cypress-bin + # path: ${{ env.CYPRESS_CACHE_FOLDER }} + + # - if: ${{ contains(matrix.e2e-framework, 'playwright') }} + # name: Cache Playwright's binary + # uses: actions/cache@v4 + # with: + # # Playwright removes unused browsers automatically + # # So does not need to add playwright version to key + # key: ${{ runner.os }}-playwright-bin-v1 + # path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + + # - name: Download Cypress + # if: ${{ contains(matrix.e2e-framework, 'cypress') }} + # working-directory: ../playground + # run: | + # pnpm --filter "{cypress}" exec cypress cache list + # pnpm --filter "{cypress}" exec cypress install + + # - if: ${{ contains(matrix.e2e-framework, 'playwright') }} + # name: Install Playwright dependencies + # working-directory: ../playground + # run: pnpm --filter "{playwright}" exec playwright install --with-deps + + # # Run `test:e2e` in project folders contain `matrix.e2e-framework` + # - name: Run e2e test script + # working-directory: ../playground + # run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e + + # # FIXME: `--with-tests` folders + # # FIXME: Cypress component testing for projects without Vitest + + + # # FIXME: test-lint + # # `pnpm lint --no-fix --max-warnings=0` From 4c0479c24dfe7d478d0441e28c347063006298bd Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:55:42 +0800 Subject: [PATCH 09/35] ci: forgot to add playground path --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3dbb6b68f..adcb35085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,9 @@ jobs: - uses: actions/cache/restore@v4 id: cache-restore with: - path: outfile.cjs + path: | + outfile.cjs + playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss run: pnpm install && pnpm build && pnpm snapshot From a2a7a3cdd50182fc9b82047ca7c25b4187236e18 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 15:58:11 +0800 Subject: [PATCH 10/35] ci: recursive install? --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adcb35085..0cf66dccb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: run: echo "{}" > playground/package.json && mv playground ../playground - name: Install dependencies in playground working-directory: ../playground - run: pnpm install --no-frozen-lockfile + run: pnpm install --no-frozen-lockfile -r - name: Run build script in playground working-directory: ../playground From 228b5689b5368711375074e448340a3e6ce6ecdb Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 16:07:48 +0800 Subject: [PATCH 11/35] ci: let's see if it works without moving the directory --- .github/workflows/ci.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cf66dccb..c16095e4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,8 +48,8 @@ jobs: runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: - # Sometimes the Linux runner can't verify Cypress in 30s - CYPRESS_VERIFY_TIMEOUT: 60000 + CYPRESS_INSTALL_BINARY: 0 + CHROMEDRIVER_SKIP_DOWNLOAD: true steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 @@ -66,15 +66,13 @@ jobs: playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss - run: pnpm install && pnpm build && pnpm snapshot - - name: Move playground - run: echo "{}" > playground/package.json && mv playground ../playground + run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json - name: Install dependencies in playground - working-directory: ../playground + working-directory: ./playground run: pnpm install --no-frozen-lockfile -r - name: Run build script in playground - working-directory: ../playground + working-directory: ./playground run: pnpm --filter "*" build # test-vitest: From 7f3aa21b44e046a55b5baea8e75ecc41e60c8f42 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 16:14:02 +0800 Subject: [PATCH 12/35] ci: must move playground; but does it work without empty package.json? --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c16095e4f..8f4f30bf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,13 +66,15 @@ jobs: playground key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss - run: pnpm install && pnpm build && pnpm snapshot && echo "{}" > playground/package.json + run: pnpm install && pnpm build && pnpm snapshot + - name: Move playground to work around weird working-directory issue + run: mv playground ../playground - name: Install dependencies in playground - working-directory: ./playground + working-directory: ../playground run: pnpm install --no-frozen-lockfile -r - name: Run build script in playground - working-directory: ./playground + working-directory: ../playground run: pnpm --filter "*" build # test-vitest: From 53c4572be4c3a9f4d5fa85418b016619064015f7 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 16:31:05 +0800 Subject: [PATCH 13/35] ci: is there a difference between pnpm -r i and pnpm recursive install? --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f4f30bf8..892cfb300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: strategy: matrix: node-version: [22] - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: @@ -71,7 +71,7 @@ jobs: run: mv playground ../playground - name: Install dependencies in playground working-directory: ../playground - run: pnpm install --no-frozen-lockfile -r + run: pnpm recursive install --no-frozen-lockfile - name: Run build script in playground working-directory: ../playground From b10ddc75d712d58d19114f8aeb92260742b4c248 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:01:43 +0800 Subject: [PATCH 14/35] ci: i feel it could be an pnpm issue, so change working-directory to pnpm -C --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 892cfb300..949f20ea7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,12 +70,10 @@ jobs: - name: Move playground to work around weird working-directory issue run: mv playground ../playground - name: Install dependencies in playground - working-directory: ../playground - run: pnpm recursive install --no-frozen-lockfile + run: pnpm -C ../playground install --no-frozen-lockfile - name: Run build script in playground - working-directory: ../playground - run: pnpm --filter "*" build + run: pnpm -C ../playground --filter "*" build # test-vitest: # needs: build From 113f84f905371ddda8f355d4e98d47e5dd6f69a5 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:08:55 +0800 Subject: [PATCH 15/35] ci: try work without pnpm-lock.yaml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 949f20ea7..dc8044175 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - name: Build the package on cache miss run: pnpm install && pnpm build && pnpm snapshot - name: Move playground to work around weird working-directory issue - run: mv playground ../playground + run: rm playgroun/pnpm-lock.yaml && mv playground ../playground - name: Install dependencies in playground run: pnpm -C ../playground install --no-frozen-lockfile From f1ddf349e80941207da29c93d1cffd2a0e633920 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:10:40 +0800 Subject: [PATCH 16/35] chore: typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc8044175..30189559e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - name: Build the package on cache miss run: pnpm install && pnpm build && pnpm snapshot - name: Move playground to work around weird working-directory issue - run: rm playgroun/pnpm-lock.yaml && mv playground ../playground + run: rm playground/pnpm-lock.yaml && mv playground ../playground - name: Install dependencies in playground run: pnpm -C ../playground install --no-frozen-lockfile From 4a81afaeabb2deb9a1ec9ed39aecb8be334407ed Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:13:31 +0800 Subject: [PATCH 17/35] ci: try not moving playground again --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30189559e..4fa8ee57d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,13 +67,12 @@ jobs: key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss run: pnpm install && pnpm build && pnpm snapshot - - name: Move playground to work around weird working-directory issue - run: rm playground/pnpm-lock.yaml && mv playground ../playground + - run: echo "{}" > playground/package.json - name: Install dependencies in playground - run: pnpm -C ../playground install --no-frozen-lockfile + run: pnpm -C ./playground install --no-frozen-lockfile - name: Run build script in playground - run: pnpm -C ../playground --filter "*" build + run: pnpm -C ./playground --filter "*" build # test-vitest: # needs: build From 361adc08cb4b308daaeeda98b804672a0fd9ced4 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:30:20 +0800 Subject: [PATCH 18/35] ci: see what happens when we remove the cache --- .github/workflows/ci.yml | 72 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fa8ee57d..7f9acc607 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,36 +11,36 @@ on: branches: - '**' jobs: - build: - runs-on: ubuntu-latest - name: Build the package - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - run: pnpm install - env: - CYPRESS_INSTALL_BINARY: 0 - CHROMEDRIVER_SKIP_DOWNLOAD: true - - run: pnpm build - - run: pnpm test:unit - - - run: pnpm snapshot - # Use cache to share the output across different jobs - # No need to cache node_modules because they are all bundled - - uses: actions/cache/save@v4 - id: cache - with: - path: | - outfile.cjs - playground - key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + # build: + # runs-on: ubuntu-latest + # name: Build the package + # steps: + # - uses: actions/checkout@v4 + # - uses: pnpm/action-setup@v3 + # - uses: actions/setup-node@v4 + # with: + # node-version: 22 + # cache: 'pnpm' + # - run: pnpm install + # env: + # CYPRESS_INSTALL_BINARY: 0 + # CHROMEDRIVER_SKIP_DOWNLOAD: true + # - run: pnpm build + # - run: pnpm test:unit + + # - run: pnpm snapshot + # # Use cache to share the output across different jobs + # # No need to cache node_modules because they are all bundled + # - uses: actions/cache/save@v4 + # id: cache + # with: + # path: | + # outfile.cjs + # playground + # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} test-build: - needs: build + # needs: build strategy: matrix: node-version: [22] @@ -58,14 +58,14 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'pnpm' - - uses: actions/cache/restore@v4 - id: cache-restore - with: - path: | - outfile.cjs - playground - key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - - name: Build the package on cache miss + # - uses: actions/cache/restore@v4 + # id: cache-restore + # with: + # path: | + # outfile.cjs + # playground + # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Build the package run: pnpm install && pnpm build && pnpm snapshot - run: echo "{}" > playground/package.json - name: Install dependencies in playground From ca961e0d537687545c89d73c9210864a418a2b1e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:31:34 +0800 Subject: [PATCH 19/35] ci: is it related to the submodule thing? --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f9acc607..990523a5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,11 +68,12 @@ jobs: - name: Build the package run: pnpm install && pnpm build && pnpm snapshot - run: echo "{}" > playground/package.json + - run: mv playground playground-tmp - name: Install dependencies in playground - run: pnpm -C ./playground install --no-frozen-lockfile + run: pnpm -C ./playground-tmp install --no-frozen-lockfile - name: Run build script in playground - run: pnpm -C ./playground --filter "*" build + run: pnpm -C ./playground-tmp --filter "*" build # test-vitest: # needs: build From 76ba294feca9a86fc780e847aaf511695c66dd6d Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 17:35:33 +0800 Subject: [PATCH 20/35] ci: use standalone pnpm installation --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 990523a5f..94bef9864 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 + with: + standalone: true - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} From 92a38181574709188cc2951e617b48006f58fd8e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:12:11 +0800 Subject: [PATCH 21/35] ci: got it! it's because not checking out submodules leading to missing pnpm-workspace.yaml --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94bef9864..d9b55689c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,8 @@ jobs: CHROMEDRIVER_SKIP_DOWNLOAD: true steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: pnpm/action-setup@v3 with: standalone: true From 6433f0b5432e283d718d45f21412411209e79021 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:30:51 +0800 Subject: [PATCH 22/35] ci: use artifact to share output --- .github/workflows/ci.yml | 109 ++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9b55689c..fbd27a396 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,40 +11,43 @@ on: branches: - '**' jobs: - # build: - # runs-on: ubuntu-latest - # name: Build the package - # steps: - # - uses: actions/checkout@v4 - # - uses: pnpm/action-setup@v3 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # cache: 'pnpm' - # - run: pnpm install - # env: - # CYPRESS_INSTALL_BINARY: 0 - # CHROMEDRIVER_SKIP_DOWNLOAD: true - # - run: pnpm build - # - run: pnpm test:unit - - # - run: pnpm snapshot - # # Use cache to share the output across different jobs - # # No need to cache node_modules because they are all bundled - # - uses: actions/cache/save@v4 - # id: cache - # with: - # path: | - # outfile.cjs - # playground - # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + build: + runs-on: ubuntu-latest + name: Build the package + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + - run: pnpm install + env: + CYPRESS_INSTALL_BINARY: 0 + CHROMEDRIVER_SKIP_DOWNLOAD: true + - run: pnpm build + - run: pnpm test:unit + + - run: pnpm snapshot + + # Use artifact to share the output across different jobs + # No need to save node_modules because they are all bundled + - uses: actions/upload-artifact@v2 + with: + name: build-output + path: | + outfile.cjs + playground + retention-days: 3 test-build: - # needs: build + needs: build strategy: matrix: node-version: [22] - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: @@ -54,33 +57,27 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - uses: pnpm/action-setup@v3 - with: - standalone: true + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - # - uses: actions/cache/restore@v4 - # id: cache-restore - # with: - # path: | - # outfile.cjs - # playground - # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - - name: Build the package - run: pnpm install && pnpm build && pnpm snapshot - - run: echo "{}" > playground/package.json - - run: mv playground playground-tmp + # use artifacts to share the playground across different jobs + - uses: actions/download-artifact@v2 + with: + name: build-output + - name: Install dependencies in playground - run: pnpm -C ./playground-tmp install --no-frozen-lockfile + working-directory: ./playground + run: pnpm install --no-frozen-lockfile - name: Run build script in playground - run: pnpm -C ./playground-tmp --filter "*" build + working-directory: ./playground + run: pnpm --filter "*" build # test-vitest: - # needs: build + # # needs: build # strategy: # matrix: # node-version: [22] @@ -92,25 +89,21 @@ jobs: # CHROMEDRIVER_SKIP_DOWNLOAD: true # steps: # - uses: actions/checkout@v4 - # - uses: pnpm/action-setup@v3 + # with: + # submodules: true + # - uses: pnpm/action-setup@v4 # - uses: actions/setup-node@v4 # with: # node-version: ${{ matrix.node-version }} # cache: 'pnpm' - # - uses: actions/cache/restore@v4 - # id: cache-restore - # with: - # path: outfile.cjs - # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - # - name: Build the package on cache miss - # if: steps.cache-restore.outputs.cache-hit != 'true' - # run: pnpm install && pnpm build - # - name: Snapshot - # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + # # FIXME: use artifacts to share the playground across different jobs + # - name: Build the package + # run: pnpm install && pnpm build && pnpm snapshot # - name: Install dependencies in playground - # working-directory: ../playground + # working-directory: ./playground # run: pnpm install --no-frozen-lockfile + # - name: Run test:unit script in vitest projects # working-directory: ../playground # run: pnpm --filter "{*vitest*}" test:unit From 4adfadc22b5cf3b133cf04510435a3a106b4b260 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:32:47 +0800 Subject: [PATCH 23/35] ci: copilot generated an outdated action version!!! --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbd27a396..412bd8306 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: # Use artifact to share the output across different jobs # No need to save node_modules because they are all bundled - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: build-output path: | @@ -64,7 +64,7 @@ jobs: cache: 'pnpm' # use artifacts to share the playground across different jobs - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: build-output From fa11155e15e6177ccff82f2a5311be3b64319b60 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:37:17 +0800 Subject: [PATCH 24/35] ci: always install deps in root directory to avoid tsconfig warnings as ts tries to search upwards and found the depended `tsconfig/node22` dep missing --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 412bd8306..d1892c810 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,8 @@ jobs: with: name: build-output + - name: Install dependencies to avoid tsconfig warnings + run: pnpm install - name: Install dependencies in playground working-directory: ./playground run: pnpm install --no-frozen-lockfile From e53aa87ecd1cc47d9177317356f92ca7cd16a8db Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:38:12 +0800 Subject: [PATCH 25/35] ci: it's more like 'verify' than 'test' --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1892c810..d18efdd61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: playground retention-days: 3 - test-build: + verify-build: needs: build strategy: matrix: @@ -78,7 +78,7 @@ jobs: working-directory: ./playground run: pnpm --filter "*" build - # test-vitest: + # verify-vitest: # # needs: build # strategy: # matrix: @@ -115,7 +115,7 @@ jobs: # # working-directory: ../playground # # run: pnpm --filter "{*with-tests*}" test:unit - # test-e2e: + # verify-e2e: # needs: build # strategy: # matrix: @@ -200,5 +200,5 @@ jobs: # # FIXME: Cypress component testing for projects without Vitest - # # FIXME: test-lint + # # FIXME: verify-lint # # `pnpm lint --no-fix --max-warnings=0` From 1ae6114a35dadebbb72b639fba156a3d822729b0 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:39:01 +0800 Subject: [PATCH 26/35] ci: skip typescript build in playground to speed up CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d18efdd61..a88daffb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: - name: Run build script in playground working-directory: ./playground - run: pnpm --filter "*" build + run: pnpm --filter "\!*typescript*" build # verify-vitest: # # needs: build From 217386cd4507d1e854a72146b60eb06923905c9e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:54:32 +0800 Subject: [PATCH 27/35] ci: use a single job to verify various scripts --- .github/workflows/ci.yml | 218 +++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 126 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a88daffb2..24d782b4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,12 +42,19 @@ jobs: playground retention-days: 3 - verify-build: + verify-scripts: needs: build strategy: matrix: - node-version: [22] + node-version: [18, 20, 22] os: [ubuntu-latest, windows-latest, macos-latest] + verification-script: + - pnpm --filter "\!*typescript*" build + - pnpm --filter "*typescript*" build + - pnpm --filter "*vitest*" test:unit + # FIXME: it's failing now + # - pnpm --filter "*with-tests*" test:unit + # TODO: lint runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: @@ -76,129 +83,88 @@ jobs: - name: Run build script in playground working-directory: ./playground - run: pnpm --filter "\!*typescript*" build - - # verify-vitest: - # # needs: build - # strategy: - # matrix: - # node-version: [22] - # os: [ubuntu-latest, windows-latest, macos-latest] - # runs-on: ${{ matrix.os }} - # continue-on-error: ${{ matrix.os == 'windows-latest' }} - # env: - # CYPRESS_INSTALL_BINARY: 0 - # CHROMEDRIVER_SKIP_DOWNLOAD: true - # steps: - # - uses: actions/checkout@v4 - # with: - # submodules: true - # - uses: pnpm/action-setup@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - # cache: 'pnpm' - - # # FIXME: use artifacts to share the playground across different jobs - # - name: Build the package - # run: pnpm install && pnpm build && pnpm snapshot - # - name: Install dependencies in playground - # working-directory: ./playground - # run: pnpm install --no-frozen-lockfile - - # - name: Run test:unit script in vitest projects - # working-directory: ../playground - # run: pnpm --filter "{*vitest*}" test:unit - - # # FIXME: it's failing now - # # - name: Run test:unit script in with-tests projects - # # working-directory: ../playground - # # run: pnpm --filter "{*with-tests*}" test:unit - - # verify-e2e: - # needs: build - # strategy: - # matrix: - # e2e-framework: ['cypress', 'playwright'] - # node-version: [22] - # os: [ubuntu-latest, windows-latest, macos-latest] - # runs-on: ${{ matrix.os }} - # continue-on-error: ${{ matrix.os == 'windows-latest' }} - # env: - # # Sometimes the Linux runner can't verify Cypress in 30s - # CYPRESS_VERIFY_TIMEOUT: 60000 - # steps: - # - uses: actions/checkout@v4 - # - uses: pnpm/action-setup@v3 - # - uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - # cache: 'pnpm' - - # - uses: actions/cache/restore@v4 - # id: cache-restore - # with: - # path: outfile.cjs - # key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - # - name: Build the package on cache miss - # if: steps.cache-restore.outputs.cache-hit != 'true' - # run: pnpm install && pnpm build - # - name: Snapshot - # run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground - # - name: Install dependencies in playground - # working-directory: ../playground - # run: pnpm install --no-frozen-lockfile - - # # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 - # # Install playwright's binary under custom directory to cache - # - name: Set Playwright & Cypress path - # run: | - # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV - # echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV - # - name: Set Playwright & Cypress path (windows) - # if: runner.os == 'Windows' - # run: | - # echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV - # echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV - - # - if: ${{ contains(matrix.e2e-framework, 'cypress') }} - # name: Cache Cypress binaries - # id: cache-cypress - # uses: actions/cache@v4 - # with: - # # TODO: avoid snowballing by adding version - # key: ${{ runner.os }}-cypress-bin - # path: ${{ env.CYPRESS_CACHE_FOLDER }} - - # - if: ${{ contains(matrix.e2e-framework, 'playwright') }} - # name: Cache Playwright's binary - # uses: actions/cache@v4 - # with: - # # Playwright removes unused browsers automatically - # # So does not need to add playwright version to key - # key: ${{ runner.os }}-playwright-bin-v1 - # path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - - # - name: Download Cypress - # if: ${{ contains(matrix.e2e-framework, 'cypress') }} - # working-directory: ../playground - # run: | - # pnpm --filter "{cypress}" exec cypress cache list - # pnpm --filter "{cypress}" exec cypress install - - # - if: ${{ contains(matrix.e2e-framework, 'playwright') }} - # name: Install Playwright dependencies - # working-directory: ../playground - # run: pnpm --filter "{playwright}" exec playwright install --with-deps - - # # Run `test:e2e` in project folders contain `matrix.e2e-framework` - # - name: Run e2e test script - # working-directory: ../playground - # run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e - - # # FIXME: `--with-tests` folders - # # FIXME: Cypress component testing for projects without Vitest + run: ${{ matrix.verification-script }} + + verify-e2e: + needs: build + strategy: + matrix: + e2e-framework: ['cypress', 'playwright'] + node-version: [22] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.os == 'windows-latest' }} + env: + # Sometimes the Linux runner can't verify Cypress in 30s + CYPRESS_VERIFY_TIMEOUT: 60000 + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - uses: actions/cache/restore@v4 + id: cache-restore + with: + path: outfile.cjs + key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Build the package on cache miss + if: steps.cache-restore.outputs.cache-hit != 'true' + run: pnpm install && pnpm build + - name: Snapshot + run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + - name: Install dependencies in playground + working-directory: ../playground + run: pnpm install --no-frozen-lockfile + + # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 + # Install playwright's binary under custom directory to cache + - name: Set Playwright & Cypress path + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV + echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV + - name: Set Playwright & Cypress path (windows) + if: runner.os == 'Windows' + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV + echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV + + - if: ${{ contains(matrix.e2e-framework, 'cypress') }} + name: Cache Cypress binaries + id: cache-cypress + uses: actions/cache@v4 + with: + # TODO: avoid snowballing by adding version + key: ${{ runner.os }}-cypress-bin + path: ${{ env.CYPRESS_CACHE_FOLDER }} - # # FIXME: verify-lint - # # `pnpm lint --no-fix --max-warnings=0` + - if: ${{ contains(matrix.e2e-framework, 'playwright') }} + name: Cache Playwright's binary + uses: actions/cache@v4 + with: + # Playwright removes unused browsers automatically + # So does not need to add playwright version to key + key: ${{ runner.os }}-playwright-bin-v1 + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + + - name: Download Cypress + if: ${{ contains(matrix.e2e-framework, 'cypress') }} + working-directory: ../playground + run: | + pnpm --filter "{cypress}" exec cypress cache list + pnpm --filter "{cypress}" exec cypress install + + - if: ${{ contains(matrix.e2e-framework, 'playwright') }} + name: Install Playwright dependencies + working-directory: ../playground + run: pnpm --filter "{playwright}" exec playwright install --with-deps + + # Run `test:e2e` in project folders contain `matrix.e2e-framework` + - name: Run e2e test script + working-directory: ../playground + run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e + + # FIXME: `--with-tests` folders + # FIXME: Cypress component testing for projects without Vitest From db07bd209a000178d6b1efb511692aaff3ef193a Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 22:57:52 +0800 Subject: [PATCH 28/35] ci: update e2e job to latest implementations --- .github/workflows/ci.yml | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24d782b4c..f27e20470 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,24 +99,23 @@ jobs: CYPRESS_VERIFY_TIMEOUT: 60000 steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 + with: + submodules: true + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - - uses: actions/cache/restore@v4 - id: cache-restore + # use artifacts to share the playground across different jobs + - uses: actions/download-artifact@v4 with: - path: outfile.cjs - key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - - name: Build the package on cache miss - if: steps.cache-restore.outputs.cache-hit != 'true' - run: pnpm install && pnpm build - - name: Snapshot - run: pnpm snapshot && echo "{}" > playground/package.json && mv playground ../playground + name: build-output + + - name: Install dependencies to avoid tsconfig warnings + run: pnpm install - name: Install dependencies in playground - working-directory: ../playground + working-directory: ./playground run: pnpm install --no-frozen-lockfile # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 @@ -151,19 +150,19 @@ jobs: - name: Download Cypress if: ${{ contains(matrix.e2e-framework, 'cypress') }} - working-directory: ../playground + working-directory: ./playground/cypress run: | - pnpm --filter "{cypress}" exec cypress cache list - pnpm --filter "{cypress}" exec cypress install + pnpm exec cypress cache list + pnpm exec cypress install - if: ${{ contains(matrix.e2e-framework, 'playwright') }} name: Install Playwright dependencies - working-directory: ../playground - run: pnpm --filter "{playwright}" exec playwright install --with-deps + working-directory: ./playground/playwright + run: pnpm exec playwright install --with-deps # Run `test:e2e` in project folders contain `matrix.e2e-framework` - name: Run e2e test script - working-directory: ../playground + working-directory: ./playground run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e # FIXME: `--with-tests` folders From 98a9a264c3ab7a1f8c319e9994f28933ab12d88a Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 23:01:14 +0800 Subject: [PATCH 29/35] ci: run build before test:e2e --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f27e20470..35bb83210 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,10 +160,13 @@ jobs: working-directory: ./playground/playwright run: pnpm exec playwright install --with-deps - # Run `test:e2e` in project folders contain `matrix.e2e-framework` + - name: Run build script + working-directory: ./playground + run: pnpm --filter "*${{ matrix.e2e-framework }}*" build + - name: Run e2e test script working-directory: ./playground - run: pnpm --filter "{*${{ matrix.e2e-framework }}*}" test:e2e + run: pnpm --filter "*${{ matrix.e2e-framework }}*" test:e2e # FIXME: `--with-tests` folders # FIXME: Cypress component testing for projects without Vitest From c8b8b803dd780250ebf2bc1a365d0b6cee911322 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 23:10:38 +0800 Subject: [PATCH 30/35] ci: work-concurrency 1 for e2e test in case of race condition --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35bb83210..833c6f152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,7 +166,7 @@ jobs: - name: Run e2e test script working-directory: ./playground - run: pnpm --filter "*${{ matrix.e2e-framework }}*" test:e2e + run: pnpm --filter --workspace-concurrency 1 "*${{ matrix.e2e-framework }}*" test:e2e # FIXME: `--with-tests` folders # FIXME: Cypress component testing for projects without Vitest From 3dc1e2da5fb3d764eaf60ac0d65489c7a9f232b7 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 18 Dec 2024 23:14:01 +0800 Subject: [PATCH 31/35] ci: typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 833c6f152..f2029b6bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,7 +166,7 @@ jobs: - name: Run e2e test script working-directory: ./playground - run: pnpm --filter --workspace-concurrency 1 "*${{ matrix.e2e-framework }}*" test:e2e + run: pnpm --filter "*${{ matrix.e2e-framework }}*" --workspace-concurrency 1 test:e2e # FIXME: `--with-tests` folders # FIXME: Cypress component testing for projects without Vitest From f1b66841cadd50c7351d06d9ed7cfdceffb123be Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 19 Dec 2024 16:23:07 +0800 Subject: [PATCH 32/35] ci: add Cypress component testing for projects without Vitest --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2029b6bb..1703826c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,5 +168,8 @@ jobs: working-directory: ./playground run: pnpm --filter "*${{ matrix.e2e-framework }}*" --workspace-concurrency 1 test:e2e - # FIXME: `--with-tests` folders - # FIXME: Cypress component testing for projects without Vitest + - name: Cypress component testing for projects without Vitest + if: ${{ contains(matrix.e2e-framework, 'cypress') }} + run: pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit + + # FIXME: `--with-tests` folders. It's failing now. From 04af4bb0c1668a3a8789f8f15b033ab0d6f6828c Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 19 Dec 2024 16:39:51 +0800 Subject: [PATCH 33/35] ci: also test nightwatch --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1703826c6..0691447c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: needs: build strategy: matrix: - e2e-framework: ['cypress', 'playwright'] + e2e-framework: ['cypress', 'playwright', 'nightwatch'] node-version: [22] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} @@ -169,7 +169,7 @@ jobs: run: pnpm --filter "*${{ matrix.e2e-framework }}*" --workspace-concurrency 1 test:e2e - name: Cypress component testing for projects without Vitest - if: ${{ contains(matrix.e2e-framework, 'cypress') }} + if: ${{ contains(matrix.e2e-framework, 'cypress') || contains(matrix.e2e-framework, 'nightwatch') }} run: pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit # FIXME: `--with-tests` folders. It's failing now. From bc0bf0d43e0f75fbddcec3a173a6dc34ff1694e4 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 19 Dec 2024 16:58:00 +0800 Subject: [PATCH 34/35] Revert "ci: also test nightwatch" This reverts commit 04af4bb0c1668a3a8789f8f15b033ab0d6f6828c. It would took too much effort to make it work. We can revisit it later. It's never tested before anyway. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0691447c6..1703826c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: needs: build strategy: matrix: - e2e-framework: ['cypress', 'playwright', 'nightwatch'] + e2e-framework: ['cypress', 'playwright'] node-version: [22] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} @@ -169,7 +169,7 @@ jobs: run: pnpm --filter "*${{ matrix.e2e-framework }}*" --workspace-concurrency 1 test:e2e - name: Cypress component testing for projects without Vitest - if: ${{ contains(matrix.e2e-framework, 'cypress') || contains(matrix.e2e-framework, 'nightwatch') }} + if: ${{ contains(matrix.e2e-framework, 'cypress') }} run: pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit # FIXME: `--with-tests` folders. It's failing now. From 34f0f0b9d8e42d3c8fa5edcdb7162d788f64197f Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 19 Dec 2024 17:06:40 +0800 Subject: [PATCH 35/35] ci: we can add lint & format check to the CI even the snapshots aren't comprehensive yet --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1703826c6..32046f255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,9 +52,10 @@ jobs: - pnpm --filter "\!*typescript*" build - pnpm --filter "*typescript*" build - pnpm --filter "*vitest*" test:unit + - pnpm --filter "*eslint*" lint --no-fix --max-warnings=0 + - pnpm --filter "*prettier*" format --write --check # FIXME: it's failing now # - pnpm --filter "*with-tests*" test:unit - # TODO: lint runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.os == 'windows-latest' }} env: