Skip to content

Commit

Permalink
Add CI workflows to build the project for all target platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Sep 25, 2024
1 parent d304f0b commit 306c0d2
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-java.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
java: [
21,
]
os: [
macos-14,
ubuntu-24.04,
windows-2022,
]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: setup gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/stardust' }}
- name: build
run: ./gradlew build --warning-mode=all
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }}
uses: actions/upload-artifact@v4
with:
name: battery-artifacts
path: build/libs
if-no-files-found: error
41 changes: 41 additions & 0 deletions .github/workflows/build-natives.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
platform:
- os: macos-14
extension: dylib
target: x86_64-apple-darwin
- os: macos-14
extension: dylib
target: aarch64-apple-darwin
- os: ubuntu-24.04
extension: so
target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04
extension: so
target: aarch64-unknown-linux-gnu
- os: windows-2022
extension: dll
target: x86_64-pc-windows-msvc
- os: windows-2022
extension: dll
target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.platform.os }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: build
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
args: "--release"
target: ${{ matrix.platform.target }}
- name: capture build artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: battery-jni-${{ matrix.platform.os }}-${{ matrix.platform.target }}
path: target/${{ matrix.platform.target }}/release/*.${{ matrix.platform.extension }}
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ publishing {
url = uri("https://maven.lostluma.net/releases")

credentials {
username = project.property("maven.username").toString()
password = project.property("maven.password").toString()
username = project.properties["maven.username"].toString()
password = project.properties["maven.password"].toString()
}
}
}
Expand Down

0 comments on commit 306c0d2

Please sign in to comment.