build #119
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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 |