-
Notifications
You must be signed in to change notification settings - Fork 22
168 lines (143 loc) · 5.91 KB
/
ci.yml
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: ci
on:
push:
pull_request:
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --deny warnings"
RUSTDOCFLAGS: -Dwarnings
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust_version: [stable]
cargo_ndk_args: [-t arm64-v8a -t armeabi-v7a -t x86_64 -t x86 -o app/src/main/jniLibs/]
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust_version }}
- name: Install Rust targets
run: >
rustup target add
aarch64-linux-android
armv7-linux-androideabi
x86_64-linux-android
i686-linux-android
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Setup shared Cargo target
# Each example is in a separate workspace but we want to use
# a shared target to speed up builds of all examples
run: mkdir shared-target
- name: Build na-mainloop example
working-directory: na-mainloop
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-mainloop example
working-directory: agdk-mainloop
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build na-subclass-jni
working-directory: na-subclass-jni
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build na-winit-wgpu
working-directory: na-winit-wgpu
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build na-winit-glutin
working-directory: na-winit-glutin
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-winit-glutin
working-directory: na-winit-glutin
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-cpal
working-directory: agdk-cpal
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-oboe
working-directory: agdk-oboe
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build na-egui example
working-directory: na-egui
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-egui example
working-directory: agdk-egui
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
- name: Build agdk-eframe example
working-directory: agdk-eframe
run: >
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
./gradlew build &&
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
# We don't currently build the OpenXR examples on Android because I
# haven't found a nice nice way to pull in libopenxr_loader binaries that
# we can link against. Normally I would use the binaries as part of the
# Oculus SDK
#
# TODO: maybe we can look at using the 'prefab' `.aar`s from Khronos here:
# https://search.maven.org/artifact/org.khronos.openxr/openxr_loader_for_android
#
#- name: Build na-openxr-info example
# working-directory: na-openxr-info
# run: >
# CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build --features=android &&
# ./gradlew build &&
# find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
#- name: Build na-openxr-wgpu
# working-directory: na-openxr-wgpu
# run: >
# CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build &&
# ./gradlew build &&
# find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \;
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Format
run: |
for dir in agdk-* na-*; do
cd $GITHUB_WORKSPACE/$dir
cargo fmt --all -- --check
done