-
Notifications
You must be signed in to change notification settings - Fork 3
179 lines (161 loc) · 5.75 KB
/
build.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
169
170
171
172
173
174
175
176
177
178
179
name: "build"
on:
workflow_dispatch:
jobs:
build_linux:
runs-on: ubuntu-latest
container:
image: ubuntu:23.10
volumes:
- /lib/modules:/lib/modules
options: --privileged
steps:
- name: Install basic requirements
run: |
apt-get update
apt-get upgrade -y
apt-get install -y git curl unzip
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
apt-get install -y libdbus-1-dev pkg-config libgtk-4-dev libadwaita-1-dev gettext libfuse2
- name: Install cargo-make
run: cargo install cargo-make
- name: Install appimage-builder
run: |
curl --location -o appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
chmod +x appimage-builder
mv appimage-builder /usr/bin/
- name: Build cli
run: cargo build --release --package openscq30_cli
- name: Build AppImage
working-directory: ./packaging/appimage
run: appimage-builder --skip-tests
- name: Move to artifacts directory
run: |
mkdir artifacts
mv target/release/openscq30_cli artifacts/openscq30_cli-linux-x86_64
mv packaging/appimage/openscq30_gui-*.AppImage* artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux
path: artifacts/*
build_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- run: brew install gtk4 libadwaita
- name: Build gui
run: cargo build --release --package openscq30_gui
- name: Build cli
run: cargo build --release --package openscq30_cli
- name: Move to artifacts directory
run: |
mkdir artifacts
mv target/release/openscq30_cli artifacts/openscq30_cli-macos-x86_64
mv target/release/openscq30_gui artifacts/openscq30_gui-macos-x86_64
- name: Upload gui
uses: actions/upload-artifact@v4
with:
name: macos
path: artifacts/*
build_windows_gui:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
update: true
install: >-
base-devel
pacboy: >-
libadwaita:p
rust:p
pkg-config:p
# cargo-make does not use the current shell to run "cargo build". It spawns a new shell, and on Windows, that's cmd.
# Rather than trying to get cargo-make to conditionally use the msys2 shell, we can just get anything that would
# interfere out of the path.
# We want to use the msys2 cargo and linker, so that means cargo and visual studio need to be removed from the path.
- name: Remove Visual Studio and cargo from path
run: |
Move-Item -Path "C:\Program Files\Microsoft Visual Studio" -Destination "C:\Program Files\_Microsoft Visual Studio"
Move-Item -Path "~\.cargo" -Destination "~\._cargo"
- name: Install cargo-make
shell: msys2 {0}
run: |
cargo install cargo-make
- name: Build gui
shell: msys2 {0}
run: |
./packaging/windows/build.sh
- name: Build installer
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ".\packaging\windows\setup.iss"
- name: Move to artifacts directory
run: |
New-Item -Type Directory -Path artifacts
Move-Item .\packaging\windows\Output\OpenSCQ30_Setup.exe artifacts\openscq30_gui_setup-windows-x86_64.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-gui
path: artifacts/*
build_windows_cli:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: Build cli
run: cargo build --release --package openscq30_cli
- name: Move to artifacts directory
run: |
New-Item -Type Directory -Path artifacts
Move-Item .\target\release\openscq30_cli.exe artifacts\openscq30_cli-windows-x86_64.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-cli
path: artifacts/*
build_android:
runs-on: ubuntu-latest
steps:
- name: Set ANDROID_NDK_HOME to latest NDK version
run: |
echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: armv7-linux-androideabi,aarch64-linux-android,i686-linux-android,x86_64-linux-android
- name: Install protobuf compiler
run: sudo apt-get install protobuf-compiler
- uses: actions/setup-java@v4
with:
distribution: temurin # See 'Supported distributions' for available options
java-version: 17
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Build
run: ./gradlew --no-daemon assembleBluetoothRelease
working-directory: android
- name: Rename apk
run: mv android/app/build/outputs/apk/bluetooth/release/app-bluetooth-release-unsigned.apk openscq30_android.apk
- name: Upload apk
uses: actions/upload-artifact@v4
with:
name: android
path: openscq30_android.apk