Skip to content

Commit

Permalink
Rewrite pull request action
Browse files Browse the repository at this point in the history
  • Loading branch information
atextor committed Jan 19, 2024
1 parent 326e58d commit 46b087b
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 264 deletions.
264 changes: 0 additions & 264 deletions .github/workflows/build.yml

This file was deleted.

122 changes: 122 additions & 0 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Build Pull Request
on:
pull_request:
branches:
- main
jobs:
build-and-test:
name: ${{ matrix.os }} build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [windows-latest, ubuntu-20.04, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies
# - 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: Setup JDK
uses: graalvm/setup-graalvm@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@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure Pagefile (Windows)
if: matrix.os == 'windows-latest'
# 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: matrix.os == 'ubuntu-20.04'
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
shell: bash

- name: Switch to Temurin JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
overwrite-settings: false

- name: Test executable jar on Temurin
if: matrix.os == 'ubuntu-20.04'
run: |
mvn -B -Dskip.maven.surefire -pl ret-cli failsafe:integration-test@default
- name: Run UPX (Linux)
# UPX doesn't work on mac
if: matrix.os == 'ubuntu-20.04'
uses: crazy-max/ghaction-upx@0fc45e912669ba9e8fa2b430e97c8da2a632e29b # v3.0.0
with:
version: latest
files: ret-cli/target/ret
args: -9

- name: Run UPX (Windows)
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-upx@0fc45e912669ba9e8fa2b430e97c8da2a632e29b # v3.0.0
with:
version: latest
files: ret-cli/target/ret.exe
args: -9

- name: Upload executable jar
# We only need one OS job to upload the jar
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: ret-cli-jar
path: ret-cli/target/ret-cli-DEV-SNAPSHOT.jar

- name: Upload binary (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: ret-cli-${{ matrix.os }}
path: |
ret-cli/target/ret.exe
ret-cli/target/*.dll
- name: Upload binary (Linux/Mac)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: ret-cli-${{ matrix.os }}
path: |
ret-cli/target/ret

0 comments on commit 46b087b

Please sign in to comment.