-
Notifications
You must be signed in to change notification settings - Fork 86
149 lines (147 loc) · 5.89 KB
/
Copy pathci.yml
File metadata and controls
149 lines (147 loc) · 5.89 KB
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
on: [push, pull_request]
name: CI
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Regular CI matrix for all Rust versions
- os: windows-latest
rust: stable
- os: windows-latest
rust: beta
- os: windows-latest
rust: nightly
- os: windows-latest
rust: 1.86.0 # MSRV
- os: ubuntu-latest
rust: stable
- os: ubuntu-latest
rust: beta
- os: ubuntu-latest
rust: nightly
- os: ubuntu-latest
rust: 1.86.0 # MSRV
- os: macos-latest
rust: stable
- os: macos-latest
rust: beta
- os: macos-latest
rust: nightly
- os: macos-latest
rust: 1.86.0 # MSRV
# Release artifact builds (stable only, with targets)
- os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
artifact_name: cargo-ndk_linux_x86_64
- os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
artifact_name: cargo-ndk_linux_aarch64
- os: macos-latest
rust: stable
target: x86_64-apple-darwin
artifact_name: cargo-ndk_macos_x86_64
- os: macos-latest
rust: stable
target: aarch64-apple-darwin
artifact_name: cargo-ndk_macos_aarch64
- os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
artifact_name: cargo-ndk_windows_x86_64
- os: windows-latest
rust: stable
target: aarch64-pc-windows-msvc
artifact_name: cargo-ndk_windows_arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install MSYS (Windows only)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
path-type: inherit
msystem: UCRT64
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target && matrix.target || 'aarch64-linux-android,armv7-linux-androideabi' }}
components: rustfmt, clippy
- name: Install cross-compilation dependencies (Linux aarch64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Run build
run: cargo install --locked --path .
- name: Smoke test `ndk-env`
run: cargo ndk-env --target armeabi-v7a
- name: Run basic example
working-directory: example/basic
run: cargo ndk -t armeabi-v7a -o jniLibs build
- name: Run openssl example (Windows)
if: runner.os == 'Windows'
shell: 'msys2 {0}'
working-directory: example/openssl
run: cargo ndk -t arm64-v8a --platform 28 build
- name: Run openssl example (Unix)
if: runner.os != 'Windows'
working-directory: example/openssl
run: cargo ndk -t arm64-v8a --platform 28 build
- name: Check code formatting
continue-on-error: true
run: cargo fmt --all -- --check
- name: Run clippy
continue-on-error: true
run: cargo clippy -- -D warnings
# Artifact creation steps (only for release builds with targets)
- name: Build release binary
if: matrix.target
run: cargo build --release --target ${{ matrix.target }}
- name: Create artifact directory
if: matrix.target
run: mkdir -p artifacts
- name: Copy binary (Unix)
if: matrix.target && runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/cargo-ndk artifacts/cargo-ndk
cp target/${{ matrix.target }}/release/cargo-ndk-env artifacts/cargo-ndk-env
cp target/${{ matrix.target }}/release/cargo-ndk-test artifacts/cargo-ndk-test
cp target/${{ matrix.target }}/release/cargo-ndk-runner artifacts/cargo-ndk-runner
- name: Copy binary (Windows)
if: matrix.target && runner.os == 'Windows'
run: |
cp target/${{ matrix.target }}/release/cargo-ndk.exe artifacts/cargo-ndk.exe
cp target/${{ matrix.target }}/release/cargo-ndk-env.exe artifacts/cargo-ndk-env.exe
cp target/${{ matrix.target }}/release/cargo-ndk-test.exe artifacts/cargo-ndk-test.exe
cp target/${{ matrix.target }}/release/cargo-ndk-runner.exe artifacts/cargo-ndk-runner.exe
- name: Get version
if: matrix.target
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create tar.gz archive (Unix)
if: matrix.target && runner.os != 'Windows'
run: |
cd artifacts
tar -czf ../${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}.tar.gz *
- name: Create zip archive (Windows)
if: matrix.target && runner.os == 'Windows'
run: |
cd artifacts
7z a -mx=9 ../${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}.zip *
- name: Upload artifacts (Unix)
uses: actions/upload-artifact@v4
if: matrix.target && runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.')
with:
name: ${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}
path: ${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}.tar.gz
- name: Upload artifacts (Windows)
uses: actions/upload-artifact@v4
if: matrix.target && runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.')
with:
name: ${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}
path: ${{ matrix.artifact_name }}_${{ steps.version.outputs.VERSION }}.zip