Skip to content

Commit

Permalink
Merge pull request #7308 from QwikDev/fix-ci-pnpm
Browse files Browse the repository at this point in the history
fix(ci): cli e2e test
  • Loading branch information
wmertens authored Feb 4, 2025
2 parents f520e69 + be6f9ac commit c98f44c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ jobs:
hash-insights: ${{ steps.cache-insights.outputs.cache-primary-key }}
hash-unit: ${{ steps.cache-unit.outputs.cache-primary-key }}
hash-e2e: ${{ steps.cache-e2e.outputs.cache-primary-key }}
hash-cli-e2e: ${{ steps.cache-cli-e2e.outputs.cache-primary-key }}
build-qwik: ${{ steps.cache-qwik.outputs.cache-hit != 'true' }}
build-rust: ${{ steps.cache-rust.outputs.cache-hit != 'true' }}
build-others: ${{ steps.cache-others.outputs.cache-hit != 'true' }}
build-docs: ${{ steps.cache-docs.outputs.cache-hit != 'true' }}
build-insights: ${{ steps.cache-insights.outputs.cache-hit != 'true' }}
build-unit: ${{ steps.cache-unit.outputs.cache-hit != 'true' }}
build-e2e: ${{ steps.cache-e2e.outputs.cache-hit != 'true' }}
build-cli-e2e: ${{ steps.cache-cli-e2e.outputs.cache-hit != 'true' }}
disttag: ${{ steps.set_dist_tag.outputs.disttag }}

steps:
Expand Down Expand Up @@ -189,6 +191,13 @@ jobs:
lookup-only: true
path: e2e-tests-completed.txt
key: ${{ hashfiles('others-key.txt', 'starters/**/*') }}
- name: 'check cache: cli e2e tests'
id: cache-cli-e2e
uses: actions/cache/restore@v4
with:
lookup-only: true
path: cli-e2e-tests-completed.txt
key: ${{ hashfiles('others-key.txt', 'e2e/**/*') }}

############ BUILD Qwik ############
build-qwik:
Expand Down Expand Up @@ -382,6 +391,7 @@ jobs:
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
if: needs.changes.outputs.build-others == 'true'
- name: Setup Node
if: needs.changes.outputs.build-others == 'true'
uses: actions/setup-node@v4
Expand Down Expand Up @@ -717,7 +727,7 @@ jobs:
############ E2E CLI TEST ############
test-cli-e2e:
name: E2E CLI Tests
if: always() && needs.changes.outputs.build-e2e == 'true'
if: always() && needs.changes.outputs.build-cli-e2e == 'true'

needs:
- build-other-packages
Expand Down Expand Up @@ -806,6 +816,7 @@ jobs:
- changes
- test-unit
- test-e2e
- test-cli-e2e
# test-unit runs when any packages changes, so we have to release
# on "upcoming", we always check if we have something to release
# don't run on forks
Expand All @@ -832,6 +843,21 @@ jobs:
key: ${{ needs.changes.outputs.hash-e2e }}
path: e2e-tests-completed.txt

- name: Verify test-cli-e2e
if: needs.test-cli-e2e.result != 'skipped'
run: |
if [ "${{ needs.test-cli-e2e.result }}" != success ] ; then
exit 1
else
echo ok > cli-e2e-tests-completed.txt
fi
- name: Save cli-e2e tests cache
if: needs.test-cli-e2e.result != 'skipped'
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-cli-e2e }}
path: cli-e2e-tests-completed.txt

- name: Checkout
uses: actions/checkout@v4

Expand Down Expand Up @@ -915,6 +941,7 @@ jobs:
needs:
- test-unit
- test-e2e
- test-cli-e2e
- lint-package
- build-docs
- build-insights
Expand All @@ -925,6 +952,7 @@ jobs:
!(
(needs.test-unit.result == 'success' || needs.test-unit.result == 'skipped') &&
(needs.test-e2e.result == 'success' || needs.test-e2e.result == 'skipped') &&
(needs.test-cli-e2e.result == 'success' || needs.test-cli-e2e.result == 'skipped') &&
(needs.lint-package.result == 'success' || needs.lint-package.result == 'skipped') &&
(needs.build-docs.result == 'success' || needs.build-docs.result == 'skipped') &&
(needs.build-insights.result == 'success' || needs.build-insights.result == 'skipped')
Expand Down
2 changes: 1 addition & 1 deletion e2e/qwik-cli-e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function replacePackagesWithLocalOnes(tmpDir: string) {
execSync('pnpm i', {
cwd: tmpDir,
// only output errors
stdio: ['ignore', 'ignore', 'inherit'],
stdio: ['ignore', 'inherit', 'inherit'],
});
}

Expand Down
10 changes: 10 additions & 0 deletions e2e/qwik-cli-e2e/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { defineConfig } from 'vitest/config';
import tsconfigPaths from 'vite-tsconfig-paths';
import { resolve } from 'path';
import { mkdirSync } from 'fs';

// if we're running in github CI
if (process.env.CI) {
// Workaround for npm/pnpm crashing in scaffoldQwikProject because "name is too long"
const testPath = resolve(process.cwd(), 'e2e-test-tmp');
mkdirSync(testPath);
process.env.TEMP_E2E_PATH = testPath;
}

export default defineConfig({
plugins: [tsconfigPaths({ ignoreConfigErrors: true, root: '../../' })],
Expand Down

0 comments on commit c98f44c

Please sign in to comment.