blob: 91092d0727cdd938691f18877d7ca7fb13620256 [file]
#
# 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/**'
- 'tooling/camel-exe/**'
- '.github/workflows/package-native-validation.yml'
pull_request:
branches:
- main
paths:
- 'dsl/camel-jbang/camel-launcher/**'
- 'tooling/camel-exe/**'
- '.github/workflows/package-native-validation.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
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@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.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: |
mvn -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-jbang-core, its jbang plugins, 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.
run: |
mvn -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-jbang/camel-launcher install -DskipTests
- name: Stage a synthetic release version for offline validation
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
REAL_VERSION=$(mvn -q -B -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 so this dedicated validation workflow covers it too.
run: |
cd dsl/camel-jbang/camel-launcher
mvn -B -ntp test -pl . -Dtest=PackageNativeValidationTest,WebsiteInstallTest
# ── Windows (install.ps1 unit tests) ──────────────────────────────
windows-validator:
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up JDK 21
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.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: |
mvn -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-jbang-core, its jbang plugins, 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.
run: |
mvn -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-jbang/camel-launcher install -DskipTests
- name: Run Windows installer unit tests
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
mvn -B -ntp test -pl . -Dtest=WebsiteInstallTest