Switch to maven multi module #1
This file contains 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: Build Pull Request | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build-and-test: | ||
name: ${{ runner.os }} build | ||
Check failure on line 8 in .github/workflows/pull-request.yml GitHub Actions / Build Pull RequestInvalid workflow file
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ windows-latest, ubuntu-20.04, macos-latest ] | ||
include: | ||
- os: windows-latest | ||
binary-file-extension: .exe | ||
- os: ubuntu-20.04 | ||
binary-file-extension: '' | ||
- os: macos-latest | ||
binary-file-extension: '' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies (Linux) | ||
if: runner.os == 'Linux' | ||
# - Install msttcorefonts, so we have the Verdana font available for diagram generation | ||
# - Install graphviz, so we have the dot binary available for diagram generation | ||
run: |- | ||
find /etc/apt -type f -name '*.list' -exec sed -i -e '/dl.bintray.com\/sbt/d' "{}" \; | ||
sudo apt-get update | ||
echo msttcorefonts msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections | ||
sudo apt-get install ttf-mscorefonts-installer | ||
sudo apt-get install -y graphviz | ||
sudo apt-get install -y build-essential libz-dev | ||
- name: Install dependencies (Windows) | ||
if: runner.os == 'Windows' | ||
# - Install graphviz, so we have the dot binary available for diagram generation | ||
run: |- | ||
choco install zip --execution-timeout=600 | ||
choco install unzip --execution-timeout=600 | ||
choco install graphviz --execution-timeout=600 | ||
shell: bash | ||
- name: Install dependencies (MacOs) | ||
if: runner.os == 'macOS' | ||
# - Install graphviz, so we have the dot binary available for diagram generation | ||
run: |- | ||
brew install graphviz | ||
- name: Setup JDK | ||
uses: graalvm/setup-graalvm@b8dc5fccfbc65b21dd26e8341e7b21c86547f61b # v1 | ||
with: | ||
java-version: '17.0.10' | ||
distribution: 'graalvm' | ||
components: 'native-image,js' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
native-image-job-reports: 'true' | ||
- name: Cache Maven packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Configure Pagefile (Windows) | ||
if: runner.os == 'Windows' | ||
# Fix for "LINK : fatal error LNK1171: unable to load mspdbcore.dll (error code: 1455)": | ||
# This seems to be caused by running out of memory; increasing page file | ||
# size suggested here: | ||
# https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418 | ||
uses: al-cheb/configure-pagefile-action@86589fd789a4de3e62ba628dda2cb10027b66d67 # v1.3 | ||
with: | ||
minimum-size: 32GB | ||
maximum-size: 32GB | ||
disk-root: "C:" | ||
- name: Set Swap Space (Linux) | ||
if: runner.os == 'Linux' | ||
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c # master | ||
with: | ||
swap-size-gb: 12 | ||
- name: Build and run tests | ||
run: | | ||
mvn -B clean install | ||
mvn -B clean verify -pl ret-cli -Pnative | ||
mv ret-cli/target/ret${{ matrix.binary-file-extension }} ret-cli/target/ret-${{ runner.os }}-${{ runner.arch }}${{ matrix.binary-file-extension }} | ||
shell: bash | ||
- name: Switch to Temurin JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
overwrite-settings: false | ||
- name: Test executable jar on Temurin | ||
if: runner.os == 'Linux' | ||
run: | | ||
mvn -B -Dskip.maven.surefire -pl ret-cli failsafe:integration-test@default | ||
- name: Compress executable | ||
# UPX doesn't work on mac | ||
if: runner.os != 'macOS' | ||
uses: crazy-max/ghaction-upx@0fc45e912669ba9e8fa2b430e97c8da2a632e29b # v3.0.0 | ||
with: | ||
version: latest | ||
files: ret-cli/target/ret-${{ runner.os }}-${{ runner.arch }}${{ matrix.binary-file-extension }} | ||
args: -9 | ||
- name: Upload jar | ||
# We only need one OS job to upload the jar | ||
if: runner.os == 'Linux' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ret-cli-jar | ||
path: ret-cli/target/ret-cli-DEV-SNAPSHOT.jar | ||
- name: Upload executable | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ret-cli-${{ runner.os }} | ||
# .dlls only exist on Windows of course | ||
path: | | ||
ret-cli/target/ret-${{ runner.os }}-${{ runner.arch }}${{ matrix.binary-file-extension }} | ||
ret-cli/target/*.dll |