Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disabled Macos ARM64 build, only do release-fast on releases, reduce LLVM version duplication #241

Merged
merged 13 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 92 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
JAVA_OPTS: "-Xmx4G"
JVM_OPTS: "-Xmx4G"
SBT_OPTS: "-Xmx4G"
LLVM_VERSION: 14

jobs:
macos_build:
Expand All @@ -18,7 +19,6 @@ jobs:
fail-fast: true
runs-on: macos-11
env:
SN_RELEASE: fast
LLVM_VERSION: 14
LLVM_BIN: /usr/local/opt/llvm@14/bin
steps:
Expand All @@ -35,6 +35,15 @@ jobs:
- 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: Sets env vars for LLVM
run: |
echo "LLVM_BIN=/usr/local/opt/llvm@$LLVM_VERSION/bin" >> $GITHUB_ENV

- name: CI and build the binary
run: sbt ci 'buildBinary sn-bindgen-x86_64-apple-darwin'

Expand All @@ -44,31 +53,84 @@ jobs:
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
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: Sets env vars for LLVM
run: |
echo "LLVM_BIN=/opt/homebrew/opt/llvm@$LLVM_VERSION/bin" >> $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
name: Linux
runs-on: ubuntu-20.04
steps:
- uses: earthly/actions/setup-earthly@v1
with:
version: v0.7.2

- uses: actions/checkout@v3
with:
fetch-depth: 0
- 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: Setup Unix-like
run: ./build/setup_unix.sh

- name: Upload Intel artifacts
uses: actions/upload-artifact@master
with:
path: bin/sn-bindgen-*
name: binaries
if-no-files-found: error
- name: Sets env vars for release
run: |
echo "SN_RELEASE=fast" >> $GITHUB_ENV

- name: Sets env vars for LLVM
run: |
echo "LLVM_BIN=/usr/lib/llvm-$LLVM_VERSION/bin" >> $GITHUB_ENV

- name: CI and build the binary
run: sbt ci 'buildBinary sn-bindgen-x86_64-pc-linux'

- name: Build site
run: sbt buildWebsite

- 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)
Expand Down Expand Up @@ -108,7 +170,6 @@ jobs:
fail-fast: false
runs-on: windows-2019
env:
SN_RELEASE: fast
LLVM_BIN: 'C:\Program Files\LLVM\bin'
LLVM_VERSION: "14.0.6"
steps:
Expand Down Expand Up @@ -138,11 +199,17 @@ jobs:
- run: clang -v
shell: cmd

- name: Install clang
- 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.8.0
choco install sbt --version=1.9.7
clang --version

- name: SBT remote cache
Expand All @@ -169,7 +236,7 @@ jobs:
if-no-files-found: error

release:
needs: [linux_build, linux_arm64_build, windows_build, macos_build]
needs: [linux_build, linux_arm64_build, windows_build, macos_build, macos_arm_build]
name: Release
runs-on: ubuntu-20.04
env:
Expand Down Expand Up @@ -204,6 +271,7 @@ jobs:
./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
Expand Down
34 changes: 0 additions & 34 deletions Earthfile

This file was deleted.

7 changes: 6 additions & 1 deletion modules/bindgen/src/main/scala/ClangDetector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.indoorvivants.detective.Platform
import Platform.OS.*
import java.lang.ProcessBuilder.Redirect
import scala.sys.process.ProcessLogger
import scala.util.Try

case class ClangInfo(
includePaths: List[String]
Expand Down Expand Up @@ -49,7 +50,11 @@ object ClangDetector:
end process

def detect(path: Path, args: String*): Either[ProcessResult, ClangInfo] =
val tempFolder = Files.createTempDirectory("sn-bindgen-clang")
val tempFolder = LazyList
.fill(5)(Try(Files.createTempDirectory("sn-bindgen-clang")))
.dropWhile(_.isFailure)
.head
.get
val destination = tempFolder.resolve("output.o").toString
val tempC = Files.createTempFile(tempFolder, "test", ".c").toString()

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

addSbtPlugin(
"com.indoorvivants" % "subatomic-plugin" % "0.0.7+111-b6459692-SNAPSHOT"
"com.indoorvivants" % "subatomic-plugin" % "0.0.7+162-f9b59ad1-SNAPSHOT"
)

addSbtPlugin(
Expand Down
Loading