-
Notifications
You must be signed in to change notification settings - Fork 26
148 lines (122 loc) · 3.52 KB
/
Copy pathpr-ci.yml
File metadata and controls
148 lines (122 loc) · 3.52 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
name: PR CI
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pr-ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-15
- macos-15-intel
runs-on: ${{ matrix.os }}
name: Build and test (${{ matrix.os }})
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Use crates.io in CI
shell: bash
run: |
mkdir -p .cargo
cat > .cargo/config.toml <<'EOF'
[registries.crates-io]
protocol = "sparse"
[net]
git-fetch-with-cli = true
EOF
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libayatana-appindicator3-dev \
libgtk-3-dev \
libxdo-dev \
libxkbcommon-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libssl-dev \
pkg-config
- name: Run library tests
run: cargo test --release --locked --lib
- name: Build app binary
run: cargo build --release --locked --bin linuxdo-accelerator
build-android:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
strategy:
fail-fast: false
matrix:
include:
- abi: arm64-v8a
rust_target: aarch64-linux-android
- abi: x86_64
rust_target: x86_64-linux-android
runs-on: ubuntu-latest
name: Build Android APK (${{ matrix.abi }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- uses: android-actions/setup-android@v3
- uses: gradle/actions/setup-gradle@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Use crates.io in CI
shell: bash
run: |
mkdir -p .cargo
cat > .cargo/config.toml <<'EOF'
[registries.crates-io]
protocol = "sparse"
[net]
git-fetch-with-cli = true
EOF
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
- name: Install Android SDK / NDK
shell: bash
run: |
yes | sdkmanager --licenses > /dev/null || true
sdkmanager --install \
"platform-tools" \
"platforms;android-35" \
"build-tools;35.0.0" \
"ndk;27.2.12479018"
- name: Install cargo-ndk
run: cargo install cargo-ndk --locked
- name: Build Android APK
shell: bash
env:
ANDROID_ABI: ${{ matrix.abi }}
RUST_TARGET: ${{ matrix.rust_target }}
ANDROID_BUILD_TYPE: release
APK_OUTPUT_NAME: linuxdo-accelerator-${{ matrix.abi }}.apk
run: |
export ANDROID_NDK_HOME="${ANDROID_SDK_ROOT}/ndk/27.2.12479018"
./scripts/build-android-apk.sh