|
| 1 | +name: pnpm Tests |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request_target: |
| 8 | + types: [labeled] |
| 9 | + branches: |
| 10 | + - "master" |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-pnpm-matrix: |
| 18 | + name: Build pnpm version matrix |
| 19 | + runs-on: ubuntu-latest |
| 20 | + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'safe to test') |
| 21 | + outputs: |
| 22 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 23 | + steps: |
| 24 | + - name: Fetch supported pnpm versions and build matrix |
| 25 | + id: set-matrix |
| 26 | + run: | |
| 27 | + # Fetch active (non-EOL) pnpm versions with major > 9 from endoflife.date API |
| 28 | + PNPM_VERSIONS=$(curl -sf https://endoflife.date/api/pnpm.json) |
| 29 | +
|
| 30 | + ACTIVE_MATRIX=$(echo "$PNPM_VERSIONS" | jq -c ' |
| 31 | + [ |
| 32 | + .[] |
| 33 | + | select(.eol == false) |
| 34 | + | .cycle as $cycle |
| 35 | + | select(($cycle | tonumber) > 9) |
| 36 | + | { |
| 37 | + pnpm_version: .latest, |
| 38 | + pnpm_major: $cycle, |
| 39 | + node_version: (if ($cycle | tonumber) >= 11 then "22" else "20" end), |
| 40 | + experimental: false |
| 41 | + } |
| 42 | + ] |
| 43 | + ') |
| 44 | +
|
| 45 | + # Dynamically detect the next pre-release (alpha/beta/rc) pnpm version from npm dist-tags |
| 46 | + DIST_TAGS=$(curl -sf https://registry.npmjs.org/pnpm | jq -r '."dist-tags" | to_entries[] | select(.key | test("^next-")) | "\(.key)=\(.value)"') |
| 47 | +
|
| 48 | + # Find the highest next-* tag that is beyond the current active versions |
| 49 | + HIGHEST_ACTIVE=$(echo "$ACTIVE_MATRIX" | jq -r '[.[].pnpm_major | tonumber] | max') |
| 50 | + NEXT_ENTRY="[]" |
| 51 | +
|
| 52 | + while IFS='=' read -r tag version; do |
| 53 | + [ -z "$tag" ] && continue |
| 54 | + NEXT_MAJOR=$(echo "$tag" | sed 's/next-//') |
| 55 | + if [ "$NEXT_MAJOR" -gt "$HIGHEST_ACTIVE" ] 2>/dev/null; then |
| 56 | + NEXT_ENTRY=$(jq -n -c --arg tag "$tag" --arg major "$NEXT_MAJOR" '[{ |
| 57 | + pnpm_version: $tag, |
| 58 | + pnpm_major: $major, |
| 59 | + node_version: "22", |
| 60 | + experimental: true |
| 61 | + }]') |
| 62 | + break |
| 63 | + fi |
| 64 | + done <<< "$DIST_TAGS" |
| 65 | +
|
| 66 | + # Combine active versions + next alpha/beta |
| 67 | + MATRIX=$(jq -n -c --argjson active "$ACTIVE_MATRIX" --argjson next "$NEXT_ENTRY" '$active + $next') |
| 68 | +
|
| 69 | + echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" |
| 70 | + echo "Generated matrix:" |
| 71 | + echo "$MATRIX" | jq . |
| 72 | +
|
| 73 | + pnpm-Tests: |
| 74 | + name: "pnpm ${{ matrix.pnpm.pnpm_major }} tests (${{ matrix.os.name }})" |
| 75 | + needs: build-pnpm-matrix |
| 76 | + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'safe to test') |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + os: |
| 81 | + - name: ubuntu |
| 82 | + version: 24.04 |
| 83 | + - name: windows |
| 84 | + version: 2022 |
| 85 | + - name: macos |
| 86 | + version: 14 |
| 87 | + pnpm: ${{ fromJson(needs.build-pnpm-matrix.outputs.matrix) }} |
| 88 | + runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }} |
| 89 | + steps: |
| 90 | + - name: Skip macOS - JGC-413 |
| 91 | + if: matrix.os.name == 'macos' |
| 92 | + run: | |
| 93 | + echo "::warning::JGC-413 - Skip until artifactory bootstrap in osx is fixed" |
| 94 | + exit 0 |
| 95 | +
|
| 96 | + - name: Checkout code |
| 97 | + if: matrix.os.name != 'macos' |
| 98 | + uses: actions/checkout@v5 |
| 99 | + with: |
| 100 | + ref: ${{ github.event.pull_request.head.sha || github.ref }} |
| 101 | + |
| 102 | + - name: Setup FastCI |
| 103 | + if: matrix.os.name != 'macos' |
| 104 | + uses: jfrog-fastci/fastci@v0 |
| 105 | + with: |
| 106 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + fastci_otel_token: ${{ secrets.FASTCI_TOKEN }} |
| 108 | + |
| 109 | + - name: Install Node.js |
| 110 | + if: matrix.os.name != 'macos' |
| 111 | + uses: actions/setup-node@v5 |
| 112 | + with: |
| 113 | + node-version: ${{ matrix.pnpm.node_version }} |
| 114 | + |
| 115 | + - name: Install pnpm |
| 116 | + if: matrix.os.name != 'macos' |
| 117 | + run: npm install -g pnpm@${{ matrix.pnpm.pnpm_version }} |
| 118 | + |
| 119 | + - name: Validate pnpm and Node.js versions |
| 120 | + if: matrix.os.name != 'macos' |
| 121 | + run: | |
| 122 | + echo "=== Version Validation ===" |
| 123 | + PNPM_VER=$(pnpm --version) |
| 124 | + NODE_VER=$(node --version | sed 's/^v//') |
| 125 | + echo "pnpm version: ${PNPM_VER}" |
| 126 | + echo "Node.js version: ${NODE_VER}" |
| 127 | +
|
| 128 | + # Validate pnpm major version >= 10 |
| 129 | + PNPM_MAJOR=$(echo "$PNPM_VER" | cut -d. -f1) |
| 130 | + if [ "$PNPM_MAJOR" -lt 10 ]; then |
| 131 | + echo "::error::pnpm version ${PNPM_VER} is below minimum required (10.x). Only pnpm >= 10 is supported." |
| 132 | + exit 1 |
| 133 | + fi |
| 134 | + echo "✓ pnpm version ${PNPM_VER} meets minimum requirement (>= 10)" |
| 135 | +
|
| 136 | + # Validate Node.js version >= 18.12 (required by pnpm 10+) |
| 137 | + NODE_MAJOR=$(echo "$NODE_VER" | cut -d. -f1) |
| 138 | + NODE_MINOR=$(echo "$NODE_VER" | cut -d. -f2) |
| 139 | + if [ "$NODE_MAJOR" -lt 18 ] || { [ "$NODE_MAJOR" -eq 18 ] && [ "$NODE_MINOR" -lt 12 ]; }; then |
| 140 | + echo "::error::Node.js version ${NODE_VER} is below minimum required (18.12) for pnpm ${PNPM_MAJOR}.x" |
| 141 | + exit 1 |
| 142 | + fi |
| 143 | + echo "✓ Node.js version ${NODE_VER} meets minimum requirement (>= 18.12)" |
| 144 | +
|
| 145 | + - name: Setup Go with cache |
| 146 | + if: matrix.os.name != 'macos' |
| 147 | + uses: jfrog/.github/actions/install-go-with-cache@main |
| 148 | + |
| 149 | + - name: Install local Artifactory |
| 150 | + if: matrix.os.name != 'macos' |
| 151 | + uses: jfrog/.github/actions/install-local-artifactory@main |
| 152 | + with: |
| 153 | + RTLIC: ${{ secrets.RTLIC }} |
| 154 | + RT_CONNECTION_TIMEOUT_SECONDS: ${{ env.RT_CONNECTION_TIMEOUT_SECONDS || '1200' }} |
| 155 | + |
| 156 | + - name: Run pnpm tests |
| 157 | + if: matrix.os.name != 'macos' |
| 158 | + env: |
| 159 | + YARN_IGNORE_NODE: 1 |
| 160 | + run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.pnpm |
0 commit comments