Build Piton apphost binaries #1
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 Piton apphost binaries | |
on: | |
workflow_call: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
MACOSX_DEPLOYMENT_TARGET: 10.12 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- name: win_x86 | |
os: windows-latest | |
target: i686-pc-windows-msvc | |
exec_suffix: .exe | |
- name: win_x64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
exec_suffix: .exe | |
- name: linux_x64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
container: quay.io/pypa/manylinux_2_28_x86_64 #https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html | |
- name: macos_x64 | |
os: macos-13 | |
target: x86_64-apple-darwin | |
- name: macos_arm64 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
ui: | |
- none | |
- cli | |
- gui | |
include: | |
# Linux GUI support needs gtk3-devel to be installed | |
- target: | |
name: linux_x64 | |
ui: gui | |
rpm_deps: gtk3-devel | |
runs-on: ${{ matrix.target.os }} | |
container: ${{ matrix.target.container }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup environment variables | |
run: | | |
echo "RUSTUP_HOME=$HOME/.rustup" >> "$GITHUB_ENV" | |
echo "CARGO_HOME=$HOME/.cargo" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
if: ${{ matrix.rpm_deps }} | |
run: yum install -y ${{ matrix.rpm_deps }} | |
- name: Cache toolchain / dependencies | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
~/.rustup | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
apphost/target/ | |
key: ${{ runner.os }}-${{ runner.container }}-apphost-${{ matrix.ui }}-cargo-${{ hashFiles('apphost/Cargo.toml') }} | |
restore-keys: | |
${{ runner.os }}-${{ runner.container }}-apphost-cargo- | |
- name: Setup Rust toolchain | |
if: ${{ !steps.cache.outputs.cache-hit }} | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal -y | |
- name: Build Piton binary | |
working-directory: apphost | |
run: ~/.cargo/bin/cargo build --verbose --release --target ${{ matrix.target.target }} -F ui-${{ matrix.ui }} | |
- run: mv apphost/target/${{ matrix.target.target }}/release/piton${{ matrix.target.exec_suffix }} piton-${{ matrix.target.name }}-${{ matrix.ui }}${{ matrix.target.exec_suffix }} | |
- name: Upload Piton binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apphost-${{ matrix.target.name }}-${{ matrix.ui }} | |
path: piton-${{ matrix.target.name }}-${{ matrix.ui }}${{ matrix.target.exec_suffix }} | |
if-no-files-found: error |