Skip to content

Commit

Permalink
Merge pull request #4859 from evolvedbinary/improve/githubactions
Browse files Browse the repository at this point in the history
Use mvnd in GitHub Actions
  • Loading branch information
dizzzz committed May 31, 2023
2 parents 4f7bc7e + 7020674 commit 9ec8832
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 4 deletions.
89 changes: 89 additions & 0 deletions .github/actions/install-mvnd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'install-mvnd'
description: 'Install the Maven Daemon'
inputs:
version:
description: 'The version of the Maven Daemon to install'
required: true
default: '0.9.0'
file-version-suffix:
description: 'A suffix to append to the version of the download file of Maven Daemon to install'
required: false
default: ''
install-path:
description: 'The folder in which Maven Daemon will be installed as a sub-folder'
required: true
default: '/tmp'
cache:
description: 'Set to true to cache Maven Daemon artifacts per-platform-architecture'
required: true
default: 'true'
mvnd-connect-timeout:
description: 'The timeout (as a duration, e.g. `90 seconds`) for connecting to the Maven Daemon'
required: true
default: '90 seconds'
outputs:
mvnd-dir:
description: "The directory where the command mvnd is located"
value: ${{ steps.mvnd-location.outputs.mvnd-dir }}
runs:
using: "composite"
steps:
- name: Determine mvnd platform and architecture
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
MVND_PLATFORM="linux"
elif [ "$RUNNER_OS" == "macOS" ]; then
MVND_PLATFORM="darwin"
elif [ "$RUNNER_OS" == "Windows" ]; then
MVND_PLATFORM="windows"
else
"echo Unknown platform: $RUNNER_OS"
exit 1
fi
MVND_ARCHITECTURE="amd64"
echo "MVND_PLATFORM=${MVND_PLATFORM}" >> $GITHUB_ENV
echo "MVND_ARCHITECTURE=${MVND_ARCHITECTURE}" >> $GITHUB_ENV
echo "MVND_NAME=maven-mvnd-${{ inputs.version }}${{ inputs.file-version-suffix }}-${MVND_PLATFORM}-${MVND_ARCHITECTURE}" >> $GITHUB_ENV
- name: Cache mvnd
if: inputs.cache == 'true'
id: cache-mvnd
uses: actions/cache@v3
with:
path: |
${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip
${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip.sha256
${{ inputs.install-path }}/${{ env.MVND_NAME }}
key: setup-${{ env.MVND_NAME }}
- name: Download mvnd
if: steps.cache-mvnd.outputs.cache-hit != 'true'
shell: bash
run: |
curl -fsSL -o ${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip https://archive.apache.org/dist/maven/mvnd/${{ inputs.version }}/${{ env.MVND_NAME }}.zip
curl -fsSL -o ${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip.sha256 https://archive.apache.org/dist/maven/mvnd/${{ inputs.version }}/${{ env.MVND_NAME }}.zip.sha256
- name: Install sha256sum (macOS)
if: ${{ runner.os == 'macOS' }}
shell: bash
run: brew install coreutils
- name: Verify mvnd sha256 checksum
shell: bash
run: echo "$(cat ${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip.sha256) ${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip" | sha256sum --check
- name: Unzip mvnd
if: steps.cache-mvnd.outputs.cache-hit != 'true'
shell: bash
run: unzip ${{ inputs.install-path }}/${{ env.MVND_NAME }}.zip -d ${{ inputs.install-path }}/
- name: Show Maven Daemon version
shell: bash
run: |
${{ inputs.install-path }}/${{ env.MVND_NAME }}/bin/mvnd -D'mvnd.connectTimeout=${{ inputs.mvnd-connect-timeout }}' --version
${{ inputs.install-path }}/${{ env.MVND_NAME }}/bin/mvnd -D'mvnd.connectTimeout=${{ inputs.mvnd-connect-timeout }}' --status
- name: Set mvnd-dir
id: mvnd-location
shell: bash
run: |
MVND_BIN_DIR="${{ inputs.install-path }}/${{ env.MVND_NAME }}/bin"
if [ "$RUNNER_OS" == "Windows" ]; then
MVND_BIN_DIR="$(cygpath --absolute --long-name --windows $MVND_BIN_DIR)"
fi
echo "MVND_BIN_DIR=${MVND_BIN_DIR}" >> $GITHUB_ENV
echo "mvnd-dir=${MVND_BIN_DIR}" >> $GITHUB_OUTPUT
15 changes: 11 additions & 4 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,22 @@ jobs:
distribution: temurin
java-version: ${{ env.DEV_JDK }}
cache: 'maven'
- name: Install Maven Daemon
id: install-mvnd
uses: ./.github/actions/install-mvnd
with:
version: '1.0-m6'
file-version-suffix: '-m40'
cache: 'true'
- name: Maven Build
timeout-minutes: 10
run: mvn -V -B -T 1C compile test-compile -DtrimStackTrace=false -D'dependency-check.skip' -D'license.skip'
run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -V -B -T 1C compile test-compile -DtrimStackTrace=false -D'dependency-check.skip' -D'license.skip'
- name: Maven Test
timeout-minutes: 60
run: mvn -V -B verify -DtrimStackTrace=false -D'dependency-check.skip' -D'license.skip'
run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -V -B verify -DtrimStackTrace=false -D'dependency-check.skip' -D'license.skip'
- name: Javadoc (Linux only)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mvn -V -B -q -T 1C install javadoc:javadoc -DskipTests -D'dependency-check.skip' -D'license.skip' --projects '!exist-distribution,!exist-installer' --also-make
run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -V -B -q -T 1C install javadoc:javadoc -DskipTests -D'dependency-check.skip' -D'license.skip' --projects '!exist-distribution,!exist-installer' --also-make
- name: Maven Code Coverage (Develop branch on Linux only)
if: ${{ github.ref == 'refs/heads/develop' && matrix.os == 'ubuntu-latest' }}
env:
Expand All @@ -62,7 +69,7 @@ jobs:
CI_BUILD_NUMBER: ${{ github.run_id }}
CI_BUILD_URL: https://github.com/${{ github.repository }}/commit/${{ github.event.after }}/checks
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: mvn -V -B jacoco:report coveralls:report
run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -V -B jacoco:report coveralls:report
- name: Archive build logs
if: always()
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 9ec8832

Please sign in to comment.