test: gha #40
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: Baboon Build | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
# 1) don't forget about os entry in prepare-release | |
# 2) see : https://github.com/actions/runner-images | |
include: | |
- target: linux-amd64 | |
os: ubuntu-latest | |
runs-on: [ ] | |
java-version: '23' | |
- target: linux-aarch64 | |
os: self-hosted | |
runs-on: [ "ARM64" ] | |
preconfigured: true | |
- target: windows-amd64 | |
os: windows-2022 | |
runs-on: [ ] | |
java-version: '23' | |
notunix: true | |
- target: macos-aarch64-14 | |
runs-on: [ ] | |
os: macos-14 # yes, this is aarch64 | |
java-version: '23' | |
nix-impure: true | |
- target: macos-amd64-13 | |
os: macos-13 # this is amd64 | |
runs-on: [ ] | |
java-version: '23' | |
nix-impure: true | |
name: ${{ matrix.target }} | |
runs-on: | |
- ${{ matrix.os }} | |
- ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
if: matrix.preconfigured != true && matrix.notunix != true | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/nix/store | |
key: nix-${{ matrix.target }} | |
- name: Set up GraalVM (Java ${{ matrix.java-version }}) | |
uses: graalvm/setup-graalvm@v1 | |
if: matrix.preconfigured != true | |
with: | |
java-version: '${{ matrix.java-version }}' | |
distribution: 'graalvm-community' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache: 'sbt' | |
native-image-job-reports: true | |
# - name: Install SBT | |
# if: startsWith( matrix.os, 'macos' ) | |
# run: | | |
# brew install sbt | |
- name: Install Nix | |
if: matrix.preconfigured != true && matrix.notunix != true | |
uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Build NI (linux) | |
if: matrix.notunix != true && matrix.nix-impure != true | |
run: nix-shell --pure ./shell.nix --run "sbt GraalVMNativeImage/packageBin" | |
- name: Build NI (macos) | |
if: matrix.notunix != true && matrix.nix-impure == true | |
run: nix-shell --impure ./shell.nix --run "sbt GraalVMNativeImage/packageBin" | |
- name: Build NI (windows) | |
if: matrix.notunix == true | |
run: sbt GraalVMNativeImage/packageBin | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: baboon-${{ matrix.target }} | |
path: | | |
target/graalvm-native-image/** | |
- name: Test (linux) | |
if: matrix.notunix != true && matrix.nix-impure != true | |
run: nix-shell --pure ./shell.nix --run ./test.sh | |
- name: Test (macos) | |
if: matrix.notunix != true && matrix.nix-impure == true | |
run: nix-shell --impure ./shell.nix --run ./test.sh | |
- name: Test (windows) | |
if: matrix.notunix == true | |
shell: bash | |
run: bash ./test.sh | |
prepare-release: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: binaries | |
pattern: baboon-* | |
- name: Prepare layout | |
run: | | |
bash prepare-dist.sh ./binaries | |
- uses: softprops/action-gh-release@v2 | |
id: create-release | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
dist-bin/** | |
dist-zip/** |