ci: install deps unconditionally in ubuntu #101
Workflow file for this run
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: CD | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
# FIXME: Temporarily run on ci-fixes branch while testing | |
branches: [main, ci-fixes] | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
build-and-upload-artifacts: | |
name: Build & Upload Artifacts (${{ matrix.target }}) | |
# if: startsWith(github.event.release.name, 'tetanes') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
# TODO: windows aarch64 | |
# - target: aarch64-pc-windows-msvc | |
# os: windows-latest | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
- target: wasm32-unknown-unknown | |
os: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
# wasm32-unknown-unknown doesn't need additional toolchains and rustup | |
# target is managed by build-artifacts already | |
# | |
# Windows/macOS just run `rustup add` since the CI runners support cross-compiling | |
- if: ${{ !startsWith(matrix.target, 'wasm32') }} | |
uses: taiki-e/setup-cross-toolchain-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
- if: startsWith(matrix.os, 'ubuntu') | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cross | |
git: https://github.com/cross-rs/cross | |
commit: 19be834 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-make | |
# Build `.deb` | |
- if: startsWith(matrix.os, 'ubuntu') | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-deb | |
# Build `.msi` | |
- if: startsWith(matrix.os, 'windows') | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-wix | |
# Build `.wasm` | |
- if: startsWith(matrix.target, 'wasm32') | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: trunk | |
# Install linux dependencies | |
- if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt update | |
sudo apt install -y libudev-dev libasound2-dev libssl-dev libfuse2 | |
# Windows/macOS/wasm32/ubuntu x86_64 can all build/cross build normally | |
- if: startsWith(matrix.os, 'macos') || startsWith(matrix.target, 'x86_64') || startsWith(matrix.target, 'wasm32') | |
run: | | |
cargo make build-artifacts -- --target ${{ matrix.target }} | |
# ubuntu aarch64 requires cross building | |
- if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target, 'aarch64') | |
run: | | |
export CROSS_CONTAINER_IN_CONTAINER=true | |
cargo make build-artifacts -- --target ${{ matrix.target }} --cross | |
- uses: actions/upload-artifact@v4 | |
name: "Upload artifacts" | |
with: | |
name: ${{ matrix.target }}-artifacts | |
path: dist/ | |
- if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} dist/* --clobber |