Skip to content

Commit efaeff7

Browse files
committed
Tests and validations
1 parent 804b06a commit efaeff7

File tree

18 files changed

+946
-6
lines changed

18 files changed

+946
-6
lines changed

.github/workflows/pnpmTests.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ node_modules
3636
# Class files
3737
*.class
3838
**/testdata/**/bin
39+
testdata/**/.gradle
3940

4041
.cursor

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ require (
248248

249249
// replace github.com/jfrog/jfrog-cli-artifactory => github.com/reshmifrog/jfrog-cli-artifactory v0.0.0-20260303084642-b208fbba798b
250250

251-
replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260311125605-d3731795ec05
251+
replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260313172139-c4ff104c0ae4
252252

253253
//replace github.com/jfrog/build-info-go => github.com/fluxxBot/build-info-go v1.10.10-0.20260105070825-d3f36f619ba5
254254

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
419419
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
420420
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df h1:raSyae8/h1y8HtzFLf7vZZj91fP/qD94AX+biwBJiqs=
421421
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df/go.mod h1:xum2HquWO5uExa/A7MQs3TgJJVEeoqTR+6Z4mfBr1Xw=
422-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260311125605-d3731795ec05 h1:TN9XIVdj0nV/VaRqAijezreez6wxtv5qDGQqCc2SSsQ=
423-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260311125605-d3731795ec05/go.mod h1:zjbDerW+Pin6VExtlgwRtpnvtI/ySJTnmqnOwXbsrmc=
422+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260313172139-c4ff104c0ae4 h1:Snicq70G82I+NjnH1gdxxPOTG50IAPbR7w2Rm+UrQEE=
423+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260313172139-c4ff104c0ae4/go.mod h1:kgw6gIQvJx9bCcOdtAGSUEiCz7nNQmaFbFvNg6byZ6I=
424424
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260225195817-bc599cec3973 h1:awB01Y4m0cWzmXuR3waf5IQnoQxDlbUmqT+FMWOpjbs=
425425
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260225195817-bc599cec3973/go.mod h1:yhi+XpiEx18a3t8CZ6M2VpAf3EGqKpBhTzoPBTFe0dk=
426426
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20260202100913-d9ee9476845a h1:lTOAhUjKcOmM/0Kbj4V+I/VHPlW7YNAhIEVpGnCM5mI=

main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func setupIntegrationTests() {
6767
InitArtifactoryTests()
6868
}
6969

70-
if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
70+
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
7171
InitBuildToolsTests()
7272
}
7373
if *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan {
@@ -103,7 +103,7 @@ func tearDownIntegrationTests() {
103103
if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
104104
CleanArtifactoryTests()
105105
}
106-
if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
106+
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
107107
CleanBuildToolsTests()
108108
}
109109
if *tests.TestDistribution {

0 commit comments

Comments
 (0)