|
| 1 | +name: Test vp create |
| 2 | + |
| 3 | +permissions: {} |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + paths: |
| 11 | + - 'packages/cli/src/create/**' |
| 12 | + - 'packages/cli/templates/**' |
| 13 | + - 'packages/cli/src/migration/**' |
| 14 | + - '.github/workflows/test-vp-create.yml' |
| 15 | + pull_request: |
| 16 | + types: [opened, synchronize, labeled] |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 20 | + cancel-in-progress: ${{ github.ref_name != 'main' }} |
| 21 | + |
| 22 | +defaults: |
| 23 | + run: |
| 24 | + shell: bash |
| 25 | + |
| 26 | +jobs: |
| 27 | + detect-changes: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + pull-requests: read |
| 32 | + outputs: |
| 33 | + related-files-changed: ${{ steps.filter.outputs.related-files }} |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 36 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 37 | + id: filter |
| 38 | + with: |
| 39 | + filters: | |
| 40 | + related-files: |
| 41 | + - 'packages/cli/src/create/**' |
| 42 | + - 'packages/cli/templates/**' |
| 43 | + - 'packages/cli/src/migration/**' |
| 44 | + - .github/workflows/test-vp-create.yml |
| 45 | +
|
| 46 | + download-previous-rolldown-binaries: |
| 47 | + needs: detect-changes |
| 48 | + runs-on: ubuntu-latest |
| 49 | + # Run if: not a PR, OR PR has 'test: create-e2e' label, OR create-related files changed |
| 50 | + if: >- |
| 51 | + github.event_name != 'pull_request' || |
| 52 | + contains(github.event.pull_request.labels.*.name, 'test: create-e2e') || |
| 53 | + needs.detect-changes.outputs.related-files-changed == 'true' |
| 54 | + permissions: |
| 55 | + contents: read |
| 56 | + packages: read |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 59 | + - uses: ./.github/actions/download-rolldown-binaries |
| 60 | + with: |
| 61 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + |
| 63 | + build: |
| 64 | + name: Build vite-plus packages |
| 65 | + runs-on: ubuntu-latest |
| 66 | + permissions: |
| 67 | + contents: read |
| 68 | + packages: read |
| 69 | + needs: |
| 70 | + - download-previous-rolldown-binaries |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 73 | + - uses: ./.github/actions/clone |
| 74 | + |
| 75 | + - uses: oxc-project/setup-rust@23f38cfb0c04af97a055f76acee94d5be71c7c82 # v1.0.16 |
| 76 | + with: |
| 77 | + save-cache: ${{ github.ref_name == 'main' }} |
| 78 | + cache-key: create-e2e-build |
| 79 | + |
| 80 | + - uses: oxc-project/setup-node@4c26e7cb3605b6bdef5450dacd02c434b10fd8ba # v1.2.0 |
| 81 | + |
| 82 | + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 83 | + with: |
| 84 | + name: rolldown-binaries |
| 85 | + path: ./rolldown/packages/rolldown/src |
| 86 | + merge-multiple: true |
| 87 | + |
| 88 | + - name: Build with upstream |
| 89 | + uses: ./.github/actions/build-upstream |
| 90 | + with: |
| 91 | + target: x86_64-unknown-linux-gnu |
| 92 | + |
| 93 | + - name: Pack packages into tgz |
| 94 | + run: | |
| 95 | + mkdir -p tmp/tgz |
| 96 | + cd packages/core && pnpm pack --pack-destination ../../tmp/tgz && cd ../.. |
| 97 | + cd packages/test && pnpm pack --pack-destination ../../tmp/tgz && cd ../.. |
| 98 | + cd packages/cli && pnpm pack --pack-destination ../../tmp/tgz && cd ../.. |
| 99 | + # Copy vp binary for test jobs |
| 100 | + cp target/x86_64-unknown-linux-gnu/release/vp tmp/tgz/vp |
| 101 | + ls -la tmp/tgz |
| 102 | +
|
| 103 | + - name: Upload tgz artifacts |
| 104 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 105 | + with: |
| 106 | + name: vite-plus-packages |
| 107 | + path: tmp/tgz/ |
| 108 | + retention-days: 1 |
| 109 | + |
| 110 | + test-vp-create: |
| 111 | + name: vp create ${{ matrix.template.name }} (${{ matrix.package-manager }}) |
| 112 | + runs-on: ubuntu-latest |
| 113 | + permissions: |
| 114 | + contents: read |
| 115 | + needs: |
| 116 | + - build |
| 117 | + timeout-minutes: 15 |
| 118 | + strategy: |
| 119 | + fail-fast: false |
| 120 | + matrix: |
| 121 | + template: |
| 122 | + - name: monorepo |
| 123 | + create-args: vite:monorepo --directory test-project |
| 124 | + verify-command: vp run ready |
| 125 | + - name: application |
| 126 | + create-args: vite:application --directory test-project -- --template vanilla-ts |
| 127 | + verify-command: vp run build |
| 128 | + - name: library |
| 129 | + create-args: vite:library --directory test-project |
| 130 | + verify-command: vp run build |
| 131 | + package-manager: |
| 132 | + - pnpm |
| 133 | + - npm |
| 134 | + - yarn |
| 135 | + - bun |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 138 | + |
| 139 | + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 140 | + with: |
| 141 | + node-version: 24 |
| 142 | + |
| 143 | + - name: Download vite-plus packages |
| 144 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 145 | + with: |
| 146 | + name: vite-plus-packages |
| 147 | + path: tmp/tgz |
| 148 | + |
| 149 | + - name: Install vp CLI |
| 150 | + run: | |
| 151 | + mkdir -p target/release |
| 152 | + cp tmp/tgz/vp target/release/vp |
| 153 | + chmod +x target/release/vp |
| 154 | + node $GITHUB_WORKSPACE/packages/tools/src/install-global-cli.ts --tgz $GITHUB_WORKSPACE/tmp/tgz/vite-plus-0.0.0.tgz |
| 155 | + echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH |
| 156 | +
|
| 157 | + - name: Verify vp installation |
| 158 | + run: | |
| 159 | + which vp |
| 160 | + vp --version |
| 161 | +
|
| 162 | + - name: Run vp create ${{ matrix.template.name }} with ${{ matrix.package-manager }} |
| 163 | + working-directory: ${{ runner.temp }} |
| 164 | + env: |
| 165 | + VP_OVERRIDE_PACKAGES: '{"vite":"file:${{ github.workspace }}/tmp/tgz/voidzero-dev-vite-plus-core-0.0.0.tgz","vitest":"file:${{ github.workspace }}/tmp/tgz/voidzero-dev-vite-plus-test-0.0.0.tgz","@voidzero-dev/vite-plus-core":"file:${{ github.workspace }}/tmp/tgz/voidzero-dev-vite-plus-core-0.0.0.tgz","@voidzero-dev/vite-plus-test":"file:${{ github.workspace }}/tmp/tgz/voidzero-dev-vite-plus-test-0.0.0.tgz"}' |
| 166 | + VP_VERSION: 'file:${{ github.workspace }}/tmp/tgz/vite-plus-0.0.0.tgz' |
| 167 | + run: | |
| 168 | + vp create ${{ matrix.template.create-args }} \ |
| 169 | + --no-interactive \ |
| 170 | + --no-agent \ |
| 171 | + --package-manager ${{ matrix.package-manager }} |
| 172 | +
|
| 173 | + - name: Verify project structure |
| 174 | + working-directory: ${{ runner.temp }}/test-project |
| 175 | + run: | |
| 176 | + # package.json must exist |
| 177 | + test -f package.json |
| 178 | + echo "✓ package.json exists" |
| 179 | + cat package.json |
| 180 | +
|
| 181 | + # Check correct lockfile exists |
| 182 | + case "${{ matrix.package-manager }}" in |
| 183 | + pnpm) |
| 184 | + test -f pnpm-lock.yaml |
| 185 | + echo "✓ pnpm-lock.yaml exists" |
| 186 | + ;; |
| 187 | + npm) |
| 188 | + test -f package-lock.json |
| 189 | + echo "✓ package-lock.json exists" |
| 190 | + ;; |
| 191 | + yarn) |
| 192 | + test -f yarn.lock |
| 193 | + echo "✓ yarn.lock exists" |
| 194 | + ;; |
| 195 | + bun) |
| 196 | + if [ -f bun.lock ]; then |
| 197 | + echo "✓ bun.lock exists" |
| 198 | + elif [ -f bun.lockb ]; then |
| 199 | + echo "✓ bun.lockb exists" |
| 200 | + else |
| 201 | + echo "✗ No bun lockfile found" |
| 202 | + exit 1 |
| 203 | + fi |
| 204 | + ;; |
| 205 | + esac |
| 206 | +
|
| 207 | + # node_modules must exist (vp install ran successfully) |
| 208 | + test -d node_modules |
| 209 | + echo "✓ node_modules exists" |
| 210 | +
|
| 211 | + # Monorepo-specific checks |
| 212 | + if [ "${{ matrix.template.name }}" = "monorepo" ]; then |
| 213 | + test -d apps/website |
| 214 | + echo "✓ apps/website exists" |
| 215 | + test -d packages/utils |
| 216 | + echo "✓ packages/utils exists" |
| 217 | +
|
| 218 | + case "${{ matrix.package-manager }}" in |
| 219 | + pnpm) |
| 220 | + test -f pnpm-workspace.yaml |
| 221 | + echo "✓ pnpm-workspace.yaml exists" |
| 222 | + ;; |
| 223 | + yarn) |
| 224 | + test -f .yarnrc.yml |
| 225 | + echo "✓ .yarnrc.yml exists" |
| 226 | + ;; |
| 227 | + esac |
| 228 | + fi |
| 229 | +
|
| 230 | + - name: Verify local tgz packages installed |
| 231 | + working-directory: ${{ runner.temp }}/test-project |
| 232 | + run: | |
| 233 | + node -e " |
| 234 | + const path = require('path'); |
| 235 | + const pkg = require(path.resolve('node_modules/vite-plus/package.json')); |
| 236 | + if (pkg.version !== '0.0.0') { |
| 237 | + console.error('Expected vite-plus@0.0.0, got ' + pkg.version); |
| 238 | + process.exit(1); |
| 239 | + } |
| 240 | + console.log('✓ vite-plus@' + pkg.version + ' installed correctly'); |
| 241 | + " |
| 242 | +
|
| 243 | + - name: Verify project builds |
| 244 | + working-directory: ${{ runner.temp }}/test-project |
| 245 | + run: ${{ matrix.template.verify-command }} |
0 commit comments