|
| 1 | +name: bughunt-npm |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: ['bughunt/npm/**'] |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | +jobs: |
| 8 | + npm-e2e: |
| 9 | + name: ${{ matrix.os }} npm ${{ matrix.npm }} |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + timeout-minutes: 45 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - {os: windows-latest, npm: '6.14.18', node: '16.20.2'} |
| 17 | + - {os: windows-latest, npm: '8.19.4', node: '16.20.2'} |
| 18 | + - {os: windows-latest, npm: '10.9.9', node: '22.22.2'} |
| 19 | + - {os: macos-latest, npm: '6.14.18', node: '16.20.2'} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 22 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 23 | + with: |
| 24 | + node-version: '24.11.1' |
| 25 | + - name: Install npm under test |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + npm install --prefix "$RUNNER_TEMP/npm-tool" --no-audit --no-fund "npm@${{ matrix.npm }}" |
| 29 | + ls "$RUNNER_TEMP/npm-tool/node_modules/.bin" || true |
| 30 | + ls "$RUNNER_TEMP/npm-tool/node_modules/npm/bin" || true |
| 31 | + BIN="" |
| 32 | + for c in node_modules/.bin/npm.cmd node_modules/npm/bin/npm.cmd node_modules/.bin/npm; do |
| 33 | + if [ -f "$RUNNER_TEMP/npm-tool/$c" ]; then BIN="$RUNNER_TEMP/npm-tool/$c"; break; fi |
| 34 | + done |
| 35 | + [ "$RUNNER_OS" = "Windows" ] || BIN="$RUNNER_TEMP/npm-tool/node_modules/.bin/npm" |
| 36 | + echo "BIN=$BIN" |
| 37 | + echo "SOCKET_PATCH_NPM_E2E_BIN=$BIN" >> "$GITHUB_ENV" |
| 38 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 39 | + with: |
| 40 | + node-version: ${{ matrix.node }} |
| 41 | + - name: Real-npm hosted + vendored e2e |
| 42 | + shell: bash |
| 43 | + env: |
| 44 | + SOCKET_PATCH_NPM_E2E_VERSION: ${{ matrix.npm }} |
| 45 | + SOCKET_PATCH_NPM_E2E_REQUIRED: '1' |
| 46 | + run: | |
| 47 | + "$SOCKET_PATCH_NPM_E2E_BIN" --version |
| 48 | + npm --version |
| 49 | + cargo test -p socket-patch-cli --test e2e_redirect_npm_build --test e2e_vendor_npm_build -- --include-ignored --test-threads 2 2>&1 | tee e2e.log |
| 50 | + exit "${PIPESTATUS[0]}" |
| 51 | + - name: Print failures |
| 52 | + if: failure() |
| 53 | + shell: bash |
| 54 | + run: grep -n -E "panicked|FAILED|failures:|assert|left:|right:|Error" e2e.log | head -200 || true |
0 commit comments