chore(repo): switch package manager references from pnpm to utoo #1173
Workflow file for this run
This file contains hidden or 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: E2E Test | |
| on: | |
| push: | |
| branches: | |
| - next | |
| paths-ignore: | |
| - '**/*.md' | |
| pull_request: | |
| branches: | |
| - next | |
| paths-ignore: | |
| - '**/*.md' | |
| concurrency: | |
| group: ${{ github.workflow }}-#${{ github.event.pull_request.number || github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| e2e-test: | |
| name: ${{ matrix.project.name }} E2E test | |
| permissions: | |
| contents: read | |
| packages: read | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:5.7 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: true | |
| MYSQL_DATABASE: cnpmcore | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project: | |
| - name: cnpmcore | |
| node-version: 24 | |
| command: | | |
| npm install --legacy-peer-deps | |
| npm run typecheck | |
| npm run build | |
| npm run prepublishOnly | |
| # Clean build artifacts to avoid double-loading (src + dist) | |
| npm run clean | |
| # Run the full test suite | |
| echo "Preparing databases..." | |
| mysql -h 127.0.0.1 -u root -e "CREATE DATABASE IF NOT EXISTS cnpmcore_unittest" | |
| CNPMCORE_DATABASE_NAME=cnpmcore_unittest bash ./prepare-database-mysql.sh | |
| CNPMCORE_DATABASE_NAME=cnpmcore bash ./prepare-database-mysql.sh | |
| npm run test:local | |
| # Deployment test: start the app and verify it boots correctly | |
| npm run clean | |
| npm run tsc:prod | |
| # Overlay compiled .js onto source locations so both egg loader | |
| # and tegg module scanner find .js files at the expected paths | |
| cp -r dist/* . | |
| rm -rf dist | |
| echo "Preparing database for deployment test..." | |
| mysql -h 127.0.0.1 -u root -e "CREATE DATABASE IF NOT EXISTS cnpmcore_unittest" | |
| CNPMCORE_DATABASE_NAME=cnpmcore_unittest bash ./prepare-database-mysql.sh | |
| CNPMCORE_DATABASE_NAME=cnpmcore bash ./prepare-database-mysql.sh | |
| EGG_TS_ENABLE=false npx eggctl start --port=7001 --env=unittest --daemon | |
| HEALTH_URL="http://127.0.0.1:7001/" | |
| START_TIME=$(date +%s) | |
| TIMEOUT=120 | |
| STATUS="" | |
| READY=0 | |
| echo "Waiting for application to become healthy at ${HEALTH_URL} (timeout: ${TIMEOUT}s)..." | |
| while true; do | |
| # Capture response body and status code | |
| STATUS=$(curl -s -o /tmp/cnpmcore-health-response -w "%{http_code}" "${HEALTH_URL}" || echo "000") | |
| echo "Health check attempt at $(date): status=${STATUS}" | |
| if [ "${STATUS}" = "200" ]; then | |
| echo "Health check succeeded with status 200" | |
| READY=1 | |
| break | |
| fi | |
| NOW=$(date +%s) | |
| ELAPSED=$((NOW - START_TIME)) | |
| if [ "${ELAPSED}" -ge "${TIMEOUT}" ]; then | |
| echo "Health check timed out after ${ELAPSED}s with last status ${STATUS}" | |
| break | |
| fi | |
| sleep 5 | |
| done | |
| npx eggctl stop | |
| if [ "${READY}" != "1" ]; then | |
| echo "Health check failed; last HTTP status: ${STATUS}" | |
| echo "Last health endpoint response body (if any):" | |
| cat /tmp/cnpmcore-health-response 2>/dev/null || echo "<no response body captured>" | |
| echo "Recent error logs (if any):" | |
| cat logs/cnpmcore/common-error.log 2>/dev/null || true | |
| exit 1 | |
| fi | |
| - name: examples | |
| node-version: 24 | |
| command: | | |
| # examples/helloworld https://github.com/eggjs/examples/blob/master/helloworld/package.json | |
| cd helloworld | |
| npm install | |
| npm run lint | |
| npm run test | |
| npm run prepublishOnly | |
| cd .. | |
| # examples/hello-tegg https://github.com/eggjs/examples/blob/master/hello-tegg/package.json | |
| cd hello-tegg | |
| npm install | |
| npm run lint | |
| npm run test | |
| npm run prepublishOnly | |
| # Manifest E2E: generate, validate, boot with manifest, clean | |
| node ../../scripts/verify-manifest.mjs | |
| cd .. | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| - uses: ./.github/actions/clone | |
| with: | |
| ecosystem-ci-project: ${{ matrix.project.name }} | |
| - name: Install utoo | |
| uses: utooland/setup-utoo@3a51006d0b66afcc32d1b9177a4b200b74f4a8cb # main | |
| - name: Set up Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6 | |
| with: | |
| node-version: ${{ matrix.project.node-version }} | |
| - name: Install dependencies | |
| run: ut install --from pnpm || (sleep 5 && ut install --from pnpm) || (sleep 10 && ut install --from pnpm) | |
| - name: Build all packages | |
| run: ut run build | |
| - name: Install pnpm (for `pnpm -r pack`) | |
| # utoo's `ut pm-pack` does not resolve `workspace:` / `catalog:` | |
| # protocols inside the packed manifests, so downstream `npm install` | |
| # in the ecosystem-ci projects fails with EUNSUPPORTEDPROTOCOL. | |
| # Keep pnpm available just for the pack step. The explicit `version` | |
| # is required because `packageManager` in package.json now points at | |
| # utoo, so the action can't infer the pnpm version itself. | |
| # Setup must come AFTER `ut install`: action-setup exports PNPM_HOME, | |
| # which makes utoo's install path read pnpm config and crash with | |
| # exit 141 (SIGPIPE). | |
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 | |
| with: | |
| version: 10 | |
| - name: Pack packages into tgz | |
| # `pnpm -r pack` resolves workspace:/catalog: deps in the emitted | |
| # manifests, which `ut pm-pack` does not yet do. pnpm refuses to | |
| # run when `packageManager` points at another tool, so disable | |
| # that strict check for just this step. pnpm needs its own | |
| # node_modules layout to resolve `workspace:` versions, so run | |
| # `pnpm install --no-frozen-lockfile` first (cheap on top of the | |
| # ut install since the deps are already in the global store). | |
| env: | |
| NPM_CONFIG_PACKAGE_MANAGER_STRICT: 'false' | |
| run: | | |
| pnpm install --no-frozen-lockfile --ignore-scripts | |
| pnpm -r pack | |
| - name: Override dependencies from tgz in ${{ matrix.project.name }} | |
| working-directory: ecosystem-ci/${{ matrix.project.name }} | |
| run: | | |
| node ../patch-project.ts ${{ matrix.project.name }} | |
| - name: Run e2e test commands in ${{ matrix.project.name }} | |
| working-directory: ecosystem-ci/${{ matrix.project.name }} | |
| run: ${{ matrix.project.command }} |