Skip to content

Native Library Builder #50

Native Library Builder

Native Library Builder #50

Workflow file for this run

name: Native Library Builder
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: write
actions: write
jobs:
build_native:
name: Cross build with Scala Native
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x64
name: linux
# TODO This works, but binary signing and notarization is required
# - os: macos-latest
# arch: arm64
# name: mac
# TODO It seems arm64 is not available yet (2024-11)
# - os: ubuntu-latest
# arch: arm64
# name: linux
# TODO Need some tweaks to run sbt on Windows
# - os: windows-latest
# arch: x64
# name: windows
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
repository: wvlet/wvlet
- uses: actions/checkout@v4
with:
path: local
- name: Local Patches for Library -x
run: |
cp local/_patches/WvcMain.scala wvc/src/main/scala/wvlet/lang/native/WvcMain.scala
cp local/_patches/WvcLib.scala wvc/src/main/scala/wvlet/lang/native/WvcLib.scala
cp local/_patches/Makefile wvc-lib/Makefile
cp local/_patches/build.sbt build.sbt
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '23'
cache: sbt
- name: Set SCALA_VERSION env
run: |
SCALA_VERSION=$(cat SCALA_VERSION)
echo SCALA_VERSION: $SCALA_VERSION
echo "SCALA_VERSION=$SCALA_VERSION" >> $GITHUB_ENV
- name: Build native binary for ${{ matrix.name }}-${{ matrix.arch }}
run: |
./sbt 'wvcLib/nativeLink'
./sbt 'wvcLibStatic/nativeLink'
FILEPATH=$(find . -name 'libwvlet.*')
echo "Found $FILEPATH"
mkdir -p out
cp $FILEPATH ./out/
ls -alFh ./out
- name: Upload native library for ${{ matrix.name }}-${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: libwvlet_${{ matrix.name }}-${{ matrix.arch }}
path: ./out/libwvlet.*
- name: Upload library to release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./out/libwvlet.*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
collect_artifact:
name: Collect wvc binaries
runs-on: ubuntu-latest
needs: build_native
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
name: wvc-binaries
delete-merged: true