-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (142 loc) · 5.29 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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@v3
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@v3
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