ci: activate downloaded Ant home #22
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Maven tests (Java ${{ matrix.java }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ['17', '25'] | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v6 | |
| - name: Set up Java ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: ${{ matrix.java }} | |
| cache: maven | |
| - name: Build and test | |
| run: mvn --batch-mode --no-transfer-progress clean verify | |
| ant: | |
| name: Ant package contract (Java ${{ matrix.java }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ['17', '25'] | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v6 | |
| - name: Set up Java ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: ${{ matrix.java }} | |
| - name: Set up Apache Ant 1.10.17 | |
| run: | | |
| ant_version=1.10.17 | |
| ant_archive="$RUNNER_TEMP/apache-ant-${ant_version}-bin.zip" | |
| ant_home="$RUNNER_TEMP/apache-ant-${ant_version}" | |
| expected_checksum=5205a3c87902dd356a6bfcfc5d07659361d1c74627716662d7b31ab47817388dd1d985cfc27ca81a607827cb58d9e36d2d2fbf87a961a5dd4eeabfbde380aa71 | |
| verified=false | |
| for base_url in \ | |
| https://dlcdn.apache.org/ant/binaries \ | |
| https://archive.apache.org/dist/ant/binaries; do | |
| for attempt in 1 2 3; do | |
| echo "Downloading Ant from $base_url (attempt $attempt)" | |
| if curl --fail --location --retry 3 --retry-all-errors \ | |
| --output "$ant_archive" \ | |
| "$base_url/apache-ant-${ant_version}-bin.zip"; then | |
| actual_checksum=$(sha512sum "$ant_archive" | awk '{print $1}') | |
| if [[ "$actual_checksum" == "$expected_checksum" ]]; then | |
| echo "Verified Apache Ant ${ant_version} archive" | |
| verified=true | |
| break 2 | |
| fi | |
| echo "::warning::Ant download failed verification; SHA-512=$actual_checksum" | |
| else | |
| echo "::warning::Unable to download Ant from $base_url" | |
| fi | |
| done | |
| done | |
| if [[ "$verified" != true ]]; then | |
| echo "::error::Unable to download a verified Apache Ant ${ant_version} archive" | |
| exit 1 | |
| fi | |
| echo "Extracting Apache Ant ${ant_version}" | |
| unzip -q "$ant_archive" -d "$RUNNER_TEMP" | |
| export ANT_HOME="$ant_home" | |
| export PATH="$ant_home/bin:$PATH" | |
| echo "ANT_HOME=$ant_home" >> "$GITHUB_ENV" | |
| echo "$ant_home/bin" >> "$GITHUB_PATH" | |
| if ant_version_output=$(ant -version 2>&1); then | |
| echo "$ant_version_output" | |
| else | |
| echo "::error::Apache Ant failed to start" | |
| echo "$ant_version_output" | |
| exit 1 | |
| fi | |
| if ! grep -Fq "version ${ant_version}" <<< "$ant_version_output"; then | |
| echo "::error::Unexpected Apache Ant version" | |
| exit 1 | |
| fi | |
| - name: Set up DTDDoc 1.1.0 | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/dtddoc" | |
| for artifact in \ | |
| net.sf.dtddoc:DTDDoc:1.1.0 \ | |
| net.sf.dtddoc:dtdparser:1.20-dtddoc \ | |
| regexp:regexp:1.2 \ | |
| com.uwyn:jhighlight:1.0; do | |
| mvn --batch-mode --no-transfer-progress \ | |
| org.apache.maven.plugins:maven-dependency-plugin:3.7.0:copy \ | |
| -Dartifact="$artifact" \ | |
| -DoutputDirectory="$RUNNER_TEMP/dtddoc" | |
| done | |
| - name: Build, test, and package Ant artifacts | |
| run: ant -noinput -Ddtddoc.dir="$RUNNER_TEMP/dtddoc" clean test test-distribution |