Skip to content

Bump actions/download-artifact from 3 to 4 in /.github/workflows (#229) #458

Bump actions/download-artifact from 3 to 4 in /.github/workflows (#229)

Bump actions/download-artifact from 3 to 4 in /.github/workflows (#229) #458

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
validate:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Validate version files
# Make sure we still know how to edit the version files. (But discard the changes.)
run: .github/set-versions.sh -n 0.0.1
java-test:
strategy:
matrix:
runs-on: ["ubuntu-22.04", "macos-12"]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: olafurpg/setup-scala@v14
with:
java-version: 11
- name: Install llvm (ubuntu)
# Not installing llvm for Mac because https://stackoverflow.com/a/35753922/107357
if: startsWith(matrix.runs-on, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -y llvm
- uses: IronCoreLabs/rust-toolchain@v1
with:
toolchain: stable
- name: Cargo fmt and build
run: cargo fmt -- --check && cargo build -p ironoxide-java
- name: Scala tests
run: sbt test
working-directory: java/tests
android-build:
runs-on: ubuntu-22.04
strategy:
matrix:
arch: [i686-linux-android, x86_64-linux-android, aarch64-linux-android]
# These folder names will be used as the names of artifacts uploaded by this job.
# In order to delete these artifacts, the same names must go into the list in the `android-delete-artifacts` job.
include:
- arch: i686-linux-android
folder-name: x86
- arch: x86_64-linux-android
folder-name: x86_64
- arch: aarch64-linux-android
folder-name: arm64-v8a
steps:
- uses: actions/checkout@v4
- uses: IronCoreLabs/rust-toolchain@v1
- name: Build
run: |
cargo install cargo-ndk
rustup target install ${{ matrix.arch }}
cargo ndk -t ${{ matrix.arch }} build -p ironoxide-android
cp -r target/${{ matrix.arch }}/debug/build/ironoxide-android*/out/java android/ironoxide-android/src/main/
mkdir -p android/ironoxide-android/src/main/jniLibs/${{ matrix.folder-name }}/
cp -r target/${{ matrix.arch }}/debug/libironoxide_android.so android/ironoxide-android/src/main/jniLibs/${{ matrix.folder-name }}/
- name: Zip src/main
run: |
cd android/ironoxide-android/src/main
zip -r android_build.zip *
# Uploads the src/main as an artifact with the provided folder name as its name.
# In order to delete this artifact, the same name must go into the list in the `android-delete-artifacts` job.
- name: Upload src/main as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.folder-name }}
path: android/ironoxide-android/src/main/android_build.zip
# As the currently available emulators cannot use arm64-v8a architecture, we are currently only testing x86/x86_64.
# This can be added in when either of the following happens:
# - reactivecircus/android-emulator-runner@v2 supports the arm64-v8a architecture for testing
# - api-level 30 is stabilized, as that allows x86_64 to run arm64-v8a
android-test:
needs: android-build
# reactivecircus/android-emulator-runner@v2 only works on Mac.
runs-on: macos-12
strategy:
matrix:
api-level: [24, 29]
arch: [x86, x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download android build
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Unzip Android build
run: unzip -o android_build.zip -d android/ironoxide-android/src/main
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
working-directory: ./android
arch: ${{ matrix.arch }}
api-level: ${{ matrix.api-level }}
script: ./gradlew connectedAndroidTest
# This tests that gradle can build ironoxide-android so we can catch issues before release.
android-release-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run build script
run: ./build.sh
working-directory: android
# This will test that we're able to build the .aar file required for release.
# In particular, it will catch if the NDK version we have specified is different than the one installed on the machine.
- name: Run gradle build
run: ./gradlew build
working-directory: android
cpp-build:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- uses: IronCoreLabs/rust-toolchain@v1
with:
toolchain: stable
- name: Setup iOS build
run: |
rustup target add x86_64-apple-ios aarch64-apple-ios
cargo install cargo-lipo
- name: Build for iOS
run: cargo lipo -p ironoxide-cpp
cpp-test:
# Cmake on macos fails to find TargetConditionals.h
# See https://github.com/IronCoreLabs/ironoxide-swig-bindings/issues/222
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: IronCoreLabs/rust-toolchain@v1
with:
toolchain: stable
- name: Build and test
run: |
cargo build -p ironoxide-cpp
cd cpp/
cmake .
make
./cpp-tests