Skip to content

Commit 883619a

Browse files
committed
Add initial .github/workflows/ci.yml
1 parent 340c394 commit 883619a

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

.github/workflows/ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
CARGO_INCREMENTAL: 0
10+
RUSTFLAGS: "-C debuginfo=0 --deny warnings"
11+
RUSTDOCFLAGS: -Dwarnings
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
rust_version: [stable]
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- uses: hecrj/setup-rust-action@v1
24+
with:
25+
rust-version: ${{ matrix.rust_version }}
26+
27+
- name: Install Rust targets
28+
run: >
29+
rustup target add
30+
aarch64-linux-android
31+
armv7-linux-androideabi
32+
x86_64-linux-android
33+
i686-linux-android
34+
35+
- name: Install cargo-ndk
36+
run: cargo install cargo-ndk
37+
38+
- name: Setup Java
39+
uses: actions/setup-java@v3
40+
with:
41+
distribution: 'temurin'
42+
java-version: '17'
43+
44+
- name: Setup Android SDK
45+
uses: android-actions/setup-android@v2
46+
47+
- name: Setup shared Cargo target
48+
# Each example is in a separate workspace but we want to use
49+
# a shared target to speed up builds of all examples
50+
run: mkdir shared-target
51+
52+
- name: Build agdk-mainloop example
53+
working-directory: agdk-mainloop
54+
run: >
55+
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk
56+
-t arm64-v8a
57+
-t armeabi-v7a
58+
-t x86_64
59+
-t x86
60+
-o app/src/main/jniLibs/ -- build
61+
62+
- name: Build na-mainloop example
63+
working-directory: na-mainloop
64+
run: >
65+
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk
66+
-t arm64-v8a
67+
-t armeabi-v7a
68+
-t x86_64
69+
-t x86
70+
-o app/src/main/jniLibs/ -- build
71+
72+
- name: Build agdk-egui example
73+
working-directory: agdk-egui
74+
run: >
75+
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk
76+
-t arm64-v8a
77+
-t armeabi-v7a
78+
-t x86_64
79+
-t x86
80+
-o app/src/main/jniLibs/ -- build
81+
82+
- name: Build agdk-eframe example
83+
working-directory: agdk-eframe
84+
run: >
85+
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk
86+
-t arm64-v8a
87+
-t armeabi-v7a
88+
-t x86_64
89+
-t x86
90+
-o app/src/main/jniLibs/ -- build
91+
92+
format:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v2
96+
97+
- uses: actions-rs/toolchain@v1
98+
with:
99+
profile: minimal
100+
toolchain: stable
101+
override: true
102+
components: rustfmt
103+
104+
- name: Format
105+
run: |
106+
for dir in agdk-* na-*; do
107+
cd $GITHUB_WORKSPACE/$dir
108+
cargo fmt --all -- --check
109+
done

0 commit comments

Comments
 (0)