Release smoke test #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release smoke test | |
| # Verifies a PUBLISHED release on Maven Central actually loads and runs on every | |
| # supported OS/arch — one runner per native classifier. Pulls the release jars | |
| # from Central (no source build, no submodule, no zig), so it tests exactly what | |
| # users consume. Trigger manually and pass the version to check. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version to smoke-test. Leave blank to use the latest release on Maven Central. | |
| required: false | |
| default: "" | |
| schedule: | |
| # Weekly, Mondays 06:00 UTC. No input on scheduled runs, so the resolve job | |
| # picks the latest release on Maven Central — catches Central / runner-image | |
| # drift against the published release without a manual trigger. | |
| - cron: "0 6 * * 1" | |
| jobs: | |
| resolve: | |
| name: resolve version | |
| runs-on: ubuntu-latest | |
| permissions: {} | |
| outputs: | |
| version: ${{ steps.pick.outputs.version }} | |
| steps: | |
| - name: Resolve version (input, else latest on Maven Central) | |
| id: pick | |
| shell: bash | |
| env: | |
| INPUT_VERSION: ${{ inputs.version }} | |
| run: | | |
| version="$INPUT_VERSION" | |
| if [ -z "$version" ]; then | |
| # <release> in maven-metadata.xml is the latest non-snapshot release. | |
| version=$(curl -fsSL --proto '=https' --tlsv1.2 https://repo1.maven.org/maven2/io/github/dfa1/zstd/zstd/maven-metadata.xml \ | |
| | grep -oE '<release>[^<]+</release>' | sed -E 's/<\/?release>//g') | |
| fi | |
| if [ -z "$version" ]; then | |
| echo "could not resolve a version from Maven Central" >&2 | |
| exit 1 | |
| fi | |
| echo "Smoke-testing version: $version" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| smoke: | |
| name: ${{ matrix.classifier }}${{ matrix.container && ' (musl)' || '' }} | |
| needs: resolve | |
| # musl legs are a probe (glibc natives on Alpine, expected to fail until musl | |
| # natives ship), so they don't gate the workflow; the six native legs do. | |
| continue-on-error: ${{ matrix.experimental || false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # distribution is per-leg for clarity and easy override. Zulu ships JDK 25 | |
| # for all targets (incl. Windows/ARM64, which Temurin does not yet) and | |
| # matches publish.yml. Legs with `container` run the linux native inside an | |
| # Alpine/musl JDK to probe musl support. | |
| include: | |
| - { os: ubuntu-latest, classifier: linux-x86_64, distribution: zulu } | |
| - { os: ubuntu-24.04-arm, classifier: linux-aarch64, distribution: zulu } | |
| - { os: macos-13, classifier: osx-x86_64, distribution: zulu } | |
| - { os: macos-14, classifier: osx-aarch64, distribution: zulu } | |
| - { os: windows-latest, classifier: windows-x86_64, distribution: zulu } | |
| - { os: windows-11-arm, classifier: windows-aarch64, distribution: zulu } | |
| - { os: ubuntu-latest, classifier: linux-x86_64, distribution: zulu, container: "amazoncorretto:25-alpine", experimental: true } | |
| - { os: ubuntu-24.04-arm, classifier: linux-aarch64, distribution: zulu, container: "amazoncorretto:25-alpine", experimental: true } | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout (smoke sources only) | |
| uses: actions/checkout@v7 | |
| - name: Set up JDK 25 (host) | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: ${{ matrix.distribution }} | |
| java-version: '25' | |
| # --- native runner path (glibc / macOS / Windows): run via JBang on the host --- | |
| - name: Set up JBang | |
| if: ${{ !matrix.container }} | |
| uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1 | |
| - name: Smoke-test ${{ needs.resolve.outputs.version }} on ${{ matrix.classifier }} | |
| if: ${{ !matrix.container }} | |
| shell: bash | |
| env: | |
| VERSION: ${{ needs.resolve.outputs.version }} | |
| run: | | |
| jbang --java 25 \ | |
| --deps "io.github.dfa1.zstd:zstd:${VERSION},io.github.dfa1.zstd:zstd-native-${{ matrix.classifier }}:${VERSION}" \ | |
| .github/smoke/Smoke.java | |
| # --- musl probe: fetch + compile on the glibc host, run inside an Alpine/musl | |
| # JDK container, so node-based actions never run under musl --- | |
| - name: Fetch released jars and compile the smoke (musl) | |
| if: ${{ matrix.container }} | |
| shell: bash | |
| env: | |
| VERSION: ${{ needs.resolve.outputs.version }} | |
| run: | | |
| mvn -q org.apache.maven.plugins:maven-dependency-plugin:3.8.1:copy \ | |
| -Dartifact="io.github.dfa1.zstd:zstd:${VERSION}" \ | |
| -DoutputDirectory=libs -Dmdep.stripVersion=true | |
| mvn -q org.apache.maven.plugins:maven-dependency-plugin:3.8.1:copy \ | |
| -Dartifact="io.github.dfa1.zstd:zstd-native-${{ matrix.classifier }}:${VERSION}" \ | |
| -DoutputDirectory=libs -Dmdep.stripVersion=true | |
| mkdir -p out | |
| javac -cp libs/zstd.jar -d out .github/smoke/Smoke.java | |
| - name: Smoke-test ${{ needs.resolve.outputs.version }} on ${{ matrix.classifier }} (musl/Alpine) | |
| if: ${{ matrix.container }} | |
| shell: bash | |
| run: | | |
| docker run --rm -v "$PWD:/w" -w /w "${{ matrix.container }}" \ | |
| java --enable-native-access=ALL-UNNAMED \ | |
| -cp "libs/zstd.jar:libs/zstd-native-${{ matrix.classifier }}.jar:out" \ | |
| Smoke |