Repository navigation
239 lines (218 loc) · 13.2 KB
/
Copy pathpackage-native-validation.yml
File metadata and controls
239 lines (218 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Package-native validation
on:
push:
branches:
- main
paths:
- 'dsl/camel-jbang/camel-launcher/**'
- 'dsl/camel-jbang/camel-jbang-run/src/main/resources/camel-wrapper/camelw.cmd'
- 'tooling/camel-exe/**'
- '.github/workflows/package-native-validation.yml'
pull_request:
branches:
- main
paths:
- 'dsl/camel-jbang/camel-launcher/**'
- 'dsl/camel-jbang/camel-jbang-run/src/main/resources/camel-wrapper/camelw.cmd'
- 'tooling/camel-exe/**'
- '.github/workflows/package-native-validation.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# the jbang plugins that camel-launcher bundles (its pom.xml dependencies)
LAUNCHER_PLUGINS: dsl/camel-jbang/camel-jbang-plugin-generate,dsl/camel-jbang/camel-jbang-plugin-test,dsl/camel-jbang/camel-jbang-plugin-kubernetes,dsl/camel-jbang/camel-jbang-plugin-mcp,dsl/camel-jbang/camel-jbang-plugin-tui,dsl/camel-jbang/camel-jbang-plugin-validate
# Use the project Maven wrapper throughout: runner-provided Maven versions can differ
# from the version supported by this branch's build extensions.
jobs:
# ── macOS / Linux (POSIX validators) ──────────────────────────────
posix-validator:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# ubuntu-latest ships Homebrew (Linuxbrew) preinstalled but not on PATH (confirmed
# via actions/runner-images' Ubuntu readme: "Homebrew is preinstalled on image but
# not added to PATH", installed under /home/linuxbrew). Without this, `command -v
# brew` in camel-validate.sh's host-gate fails on Linux and the Homebrew validator
# silently SKIPs there, leaving macos-latest as the only leg that actually exercises
# it. macos-latest already has Homebrew on PATH by default, so this step is a no-op
# there.
- name: Add Linuxbrew to PATH (preinstalled but not on PATH on ubuntu-latest)
if: runner.os == 'Linux'
shell: bash
run: |
{
echo "/home/linuxbrew/.linuxbrew/bin"
echo "/home/linuxbrew/.linuxbrew/sbin"
} >> "$GITHUB_PATH"
{
echo "HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew"
echo "HOMEBREW_CELLAR=/home/linuxbrew/.linuxbrew/Cellar"
echo "HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew"
} >> "$GITHUB_ENV"
- name: Set up JDK 21
uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
# Packaging scripts invoke mvn themselves, so pin their PATH entry as well as
# the direct workflow commands. Keep the snapshot profile active in subprocesses.
- name: Pin Maven for packaging subprocesses
shell: bash
run: |
CAMEL_CI_MAVEN_HOME=$(./mvnw -q -B -P apache-snapshots -ntp -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
-Dexpression=maven.home -DforceStdout)
echo "$CAMEL_CI_MAVEN_HOME/bin" >> "$GITHUB_PATH"
echo "MAVEN_ARGS=${MAVEN_ARGS:-} -P apache-snapshots" >> "$GITHUB_ENV"
# camel-repackager-maven-plugin builds the launcher's self-executing JAR. It is not in the
# -pl list below, so without this step Maven resolves it from the Apache snapshot repository.
# This workflow only triggers on dsl/camel-jbang/camel-launcher and tooling/camel-exe changes
# (see the `paths:` filters above), so the plugin's own sources are never what's under test here.
- name: Install camel-repackager-maven-plugin (build-time plugin, unresolvable from this reactor pass)
shell: bash
run: |
./mvnw -B -P apache-snapshots -ntp \
-pl tooling/maven/camel-repackager-maven-plugin install -DskipTests
- name: Build camel-launcher distribution
shell: bash
# No -am: build only the listed modules. camel-launcher's other in-repo dependencies
# (camel-core, ...) resolve as the current version's published snapshot instead of being
# rebuilt from source, which is what previously turned this into a ~626-module reactor
# build. -P apache-snapshots is required for that resolution.
# camel-jbang-run, camel-jbang-core and the jbang plugins bundled in the launcher are
# built from source: a PR may have changed (or moved) classes of camel-jbang-core after the
# last snapshot, and plugins of that snapshot compiled against the old ones fail at runtime.
# camel-yaml-dsl-validator is built from source too: camel-jbang-core calls its API, and a
# change on main to both fails to compile against the snapshot until the next deploy.
# -Dcamel.skipDocSamples: camel-jbang-core checks the YAML examples of the docs against the
# YAML DSL schema of the snapshot, which lags behind a new DSL option on main until the next
# deploy. The main build checks them.
run: |
./mvnw -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-yaml-dsl/camel-yaml-dsl-validator,dsl/camel-jbang/camel-jbang-run,dsl/camel-jbang/camel-jbang-core,${{ env.LAUNCHER_PLUGINS }},dsl/camel-jbang/camel-launcher install -DskipTests -Dcamel.skipDocSamples=true
- name: Stage a synthetic release version for offline validation
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
REAL_VERSION=$(../../../mvnw -q -B -P apache-snapshots -ntp org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
-Dexpression=project.version -DforceStdout)
TEST_VERSION="${REAL_VERSION%-SNAPSHOT}"
echo "TEST_VERSION=$TEST_VERSION" >> "$GITHUB_ENV"
cp -p "target/camel-launcher-$REAL_VERSION-bin.tar.gz" "target/camel-launcher-$TEST_VERSION-bin.tar.gz"
cp -p "target/camel-launcher-$REAL_VERSION-bin.zip" "target/camel-launcher-$TEST_VERSION-bin.zip"
# camel-package.sh prepare requires a WinGet release ZIP (camel-launcher-<v>-winget-bin.zip), but
# that artifact is only built by the -Dcamel.exe.build=true profile (native camel-exe), which this
# validation build does not run. The POSIX validators never consume the WinGet payload, so stage
# the already-built bin.zip under the WinGet name as an offline stand-in. Two names are needed:
# camel-package.sh's own existence check and cmp look for the stripped TEST_VERSION name (and
# CAMEL_PACKAGE_TEST_WINGET_REMOTE below points at the same bytes so the cmp passes without a
# network fetch to archive.apache.org), while JReleaser resolves the artifact from the real
# -SNAPSHOT POM version, so it needs the REAL_VERSION name too.
cp -p "target/camel-launcher-$REAL_VERSION-bin.zip" "target/camel-launcher-$TEST_VERSION-winget-bin.zip"
cp -p "target/camel-launcher-$REAL_VERSION-bin.zip" "target/camel-launcher-$REAL_VERSION-winget-bin.zip"
- name: Prepare packages (stable, offline, synthetic release version)
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
CAMEL_PACKAGE_TEST_MODE=true CAMEL_PACKAGE_TEST_VERSION="$TEST_VERSION" \
CAMEL_PACKAGE_TEST_WINGET_REMOTE="target/camel-launcher-$TEST_VERSION-winget-bin.zip" \
bash src/jreleaser/bin/camel-package.sh prepare --channel stable
- name: Validate local archive + Homebrew + SDKMAN (host-gated)
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
CAMEL_PACKAGE_TEST_MODE=true CAMEL_PACKAGE_TEST_VERSION="$TEST_VERSION" \
bash src/jreleaser/bin/camel-validate.sh all
- name: Run POSIX validator unit tests
shell: bash
# WebsiteInstallTest's PosixShell suite only gets targeted CI coverage today as a side
# effect of the generic incremental-build check noticing a direct change under
# dsl/camel-jbang/camel-launcher; a PR that only touches an upstream dependency wouldn't
# trigger it. Run it here explicitly, together with the POSIX launcher script tests.
run: |
cd dsl/camel-jbang/camel-launcher
../../../mvnw -B -P apache-snapshots -ntp test -pl . -Dtest=PackageNativeValidationTest,WebsiteInstallTest,CamelShDiscoveryTest,FakeJavaTest
# ── Windows (installer and launcher script unit tests) ──────────────────────────────
windows-validator:
runs-on: windows-latest
# Caps a genuine hang well below GitHub's 6h default; a passing run has taken up to ~25 minutes.
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up JDK 21
uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
# camel-repackager-maven-plugin builds the launcher's self-executing JAR. It is not in the
# -pl list below, so without this step Maven resolves it from the Apache snapshot repository.
# This workflow only triggers on dsl/camel-jbang/camel-launcher and tooling/camel-exe changes
# (see the `paths:` filters above), so the plugin's own sources are never what's under test here.
- name: Install camel-repackager-maven-plugin (build-time plugin, unresolvable from this reactor pass)
shell: bash
run: |
./mvnw -B -P apache-snapshots -ntp \
-pl tooling/maven/camel-repackager-maven-plugin install -DskipTests
- name: Build camel-launcher module
shell: bash
# No -am: build only the listed modules. camel-launcher's other in-repo dependencies
# (camel-core, ...) resolve as the current version's published snapshot instead of being
# rebuilt from source, which is what previously turned this into a ~626-module reactor
# build. -P apache-snapshots is required for that resolution.
# camel-jbang-run, camel-jbang-core and the jbang plugins bundled in the launcher are
# built from source: a PR may have changed (or moved) classes of camel-jbang-core after the
# last snapshot, and plugins of that snapshot compiled against the old ones fail at runtime.
# camel-yaml-dsl-validator is built from source too: camel-jbang-core calls its API, and a
# change on main to both fails to compile against the snapshot until the next deploy.
# -Dcamel.skipDocSamples: camel-jbang-core checks the YAML examples of the docs against the
# YAML DSL schema of the snapshot, which lags behind a new DSL option on main until the next
# deploy. The main build checks them.
run: |
./mvnw -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-yaml-dsl/camel-yaml-dsl-validator,dsl/camel-jbang/camel-jbang-run,dsl/camel-jbang/camel-jbang-core,${{ env.LAUNCHER_PLUGINS }},dsl/camel-jbang/camel-launcher install -DskipTests -Dcamel.skipDocSamples=true
- name: Run Windows installer and launcher script unit tests
shell: bash
# The PowerShell suite has taken 10-20 minutes on windows-latest, straddling camel-launcher's 1200s
# surefire fork timeout, so slow-but-passing runs were killed. Give this job's fork more room.
run: |
cd dsl/camel-jbang/camel-launcher
../../../mvnw -B -P apache-snapshots -ntp test -pl . -Dtest=WebsiteInstallTest,CamelBatDiscoveryTest,CamelwCmdTest,FakeJavaTest -Dcamel.surefire.forkTimeout=2700
# Per-test timings for the PowerShell suite, which runs close to camel-launcher's surefire fork timeout.
# A fork killed on that timeout writes no XML report; the per-process timings the fixture prints to the
# build log cover that case.
- name: Archive surefire reports
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: windows-validator-surefire-reports
path: dsl/camel-jbang/camel-launcher/target/surefire-reports
retention-days: 7
if-no-files-found: ignore