Add disabled Macos ARM64 build, only do release-fast on releases, reduce LLVM version duplication #596
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: ["main"] | |
tags: ["v*"] | |
pull_request: | |
branches: ["*"] | |
env: | |
JAVA_OPTS: "-Xmx4G" | |
JVM_OPTS: "-Xmx4G" | |
SBT_OPTS: "-Xmx4G" | |
jobs: | |
macos_build: | |
name: MacOS | |
strategy: | |
fail-fast: true | |
runs-on: macos-11 | |
env: | |
LLVM_VERSION: 14 | |
LLVM_BIN: /usr/local/opt/llvm@14/bin | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'sbt' | |
- name: Install LLVM | |
run: brew install llvm@$LLVM_VERSION | |
- name: Sets env vars for release | |
run: | | |
echo "SN_RELEASE=fast" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') | |
- name: CI and build the binary | |
run: sbt ci 'buildBinary sn-bindgen-x86_64-apple-darwin' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
path: bin/sn-bindgen-* | |
name: binaries | |
if-no-files-found: error | |
macos_arm_build: | |
name: MacOS (Arm64) | |
strategy: | |
fail-fast: true | |
runs-on: macos-aarch64 | |
if: startsWith(github.ref, 'refs/tags/v') | |
continue-on-error: true | |
env: | |
LLVM_VERSION: 14 | |
LLVM_BIN: /opt/homebrew/opt/llvm@14/bin | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'sbt' | |
- name: Install LLVM | |
run: brew install llvm@$LLVM_VERSION | |
- name: Install SBT | |
run: brew install sbt | |
- name: Sets env vars for release | |
run: | | |
echo "SN_RELEASE=fast" >> $GITHUB_ENV | |
- name: CI and build the binary | |
run: sbt ci 'buildBinary sn-bindgen-aarch64-apple-darwin' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
path: bin/sn-bindgen-* | |
name: binaries | |
if-no-files-found: error | |
linux_build: | |
name: Linux | |
runs-on: ubuntu-20.04 | |
env: | |
FORCE_COLOR: 1 | |
steps: | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.2 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Intel build | |
run: earthly --ci --platform linux/amd64 --output +bindgen --BINARY_NAME="sn-bindgen-x86_64-pc-linux" | |
- name: Upload Intel artifacts | |
uses: actions/upload-artifact@master | |
with: | |
path: bin/sn-bindgen-* | |
name: binaries | |
if-no-files-found: error | |
linux_arm64_build: | |
name: Linux (Arm64) | |
runs-on: ubuntu-20.04 | |
env: | |
FORCE_COLOR: 1 | |
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: earthly/actions/setup-earthly@v1 | |
with: | |
version: v0.7.2 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# - name: Arm64 build | |
# run: earthly --ci --platform linux/arm64 --output +bindgen --BUILD_COMMAND="buildBinary" --BINARY_NAME="sn-bindgen-aarch64-pc-linux" | |
# - name: Upload Arm64 artifacts | |
# uses: actions/upload-artifact@master | |
# with: | |
# path: bin/sn-bindgen-* | |
# name: binaries | |
# if-no-files-found: error | |
windows_build: | |
name: Windows (Intel) | |
strategy: | |
fail-fast: false | |
runs-on: windows-2019 | |
env: | |
LLVM_BIN: 'C:\Program Files\LLVM\bin' | |
LLVM_VERSION: "14.0.6" | |
steps: | |
# This step is important to make sure scalafmt | |
# checks don't fail | |
- name: Setup git config | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'sbt' | |
# See https://github.com/scala-native/scala-native/blob/master/.github/actions/windows-setup-env/action.yml#L14 | |
# for details | |
- name: Configure Pagefile | |
uses: al-cheb/[email protected] | |
with: | |
minimum-size: 4GB | |
maximum-size: 16GB | |
- run: clang -v | |
shell: cmd | |
- name: Sets env vars for release | |
run: | | |
echo "SN_RELEASE=fast" >> $env:GITHUB_ENV | |
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') | |
shell: pwsh | |
- name: Install clang and SBT | |
shell: pwsh | |
run: | | |
choco install llvm --version="$Env:LLVM_VERSION" --allow-downgrade | |
choco install sbt --version=1.9.7 | |
clang --version | |
- name: SBT remote cache | |
id: remote-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./target/remote-cache | |
key: ${{ runner.os }}-remote-cache | |
- name: Pull cache | |
run: sbt pullRemoteCache || echo 'remote cache not found' | |
# Can't make shell type come from a matrix parameter: | |
# https://github.community/t/using-matrix-to-specify-shell-is-it-possible/17065/2 | |
- name: CI (windows) | |
run: sbt ci "buildBinary sn-bindgen-x86_64-pc-win32.exe" | |
shell: cmd | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
path: bin/sn-bindgen-* | |
name: binaries | |
if-no-files-found: error | |
release: | |
needs: [linux_build, linux_arm64_build, windows_build, macos_build, macos_arm_build] | |
name: Release | |
runs-on: ubuntu-20.04 | |
env: | |
BINARIES: binaries/ | |
LLVM_BIN: /usr/lib/llvm-14/bin | |
LLVM_VERSION: 14 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'sbt' | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
id: download | |
with: | |
path: binaries | |
- name: Check published artifacts | |
run: | | |
set -e | |
ls -R binaries/ | |
sbt checkDetectedArtifacts versionDump binaryArtifacts/publishLocal iface3/publishLocal iface/publishLocal iface2_12/publishLocal | |
curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)" | |
chmod +x cs | |
./cs resolve com.indoorvivants:bindgen-interface_2.13:$(cat version) | |
./cs resolve com.indoorvivants:bindgen-interface_3:$(cat version) | |
./cs resolve com.indoorvivants:bindgen-interface_2.12:$(cat version) | |
./cs fetch com.indoorvivants:bindgen_native0.4_3:$(cat version) --classifier osx-x86_64 --artifact-type jar | |
./cs fetch com.indoorvivants:bindgen_native0.4_3:$(cat version) --classifier osx-aarch64 --artifact-type jar | |
./cs fetch com.indoorvivants:bindgen_native0.4_3:$(cat version) --classifier linux-x86_64 --artifact-type jar | |
./cs fetch com.indoorvivants:bindgen_native0.4_3:$(cat version) --classifier linux-aarch64 --artifact-type jar | |
./cs fetch com.indoorvivants:bindgen_native0.4_3:$(cat version) --classifier windows-x86_64 --artifact-type jar | |
- name: Setup Unix-like | |
run: ./build/setup_unix.sh | |
- name: Publish | |
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') | |
run: | | |
sbt ci-release | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
- name: Build site | |
run: sbt buildWebsite | |
- name: Publish gh-pages | |
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site | |
- name: Upload release binaries | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: "${{steps.download.outputs.download-path}}/**/sn-bindgen-*" |