ci: update for caching and more architectures

This commit is contained in:
iff 2024-11-23 14:28:25 +01:00
parent 1972b25fcb
commit 7e69d2b256

View file

@ -10,6 +10,9 @@ jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
@ -17,9 +20,21 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
deb: true
- os: ubuntu-latest
target: i686-unknown-linux-gnu
deb: true
cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
deb: true
cross: true
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
deb: true
cross: true
- os: ubuntu-latest
target: aarch64-linux-android
cross: true
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
@ -35,49 +50,41 @@ jobs:
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: setup Rust
- name: setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
profile: minimal
- name: install cross
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
uses: actions-rs/cargo@v1
- name: caching
uses: Swatinem/rust-cache@v2
with:
command: install
args: cross --locked
key: ${{ matrix.target }}
- name: build
if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }}
if: ${{ matrix.cross != true}}
run:
cargo build --release --all-features --locked --target ${{ matrix.target }}
- name: build (cross)
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: >
cross build --release --locked --target ${{ matrix.target }}
--features=runtime-rules,request-ai
if: ${{ matrix.cross == true}}
# cross 0.2.5 broken for android
run: |
cargo install cross --locked --git https://github.com/cross-rs/cross --rev 99b8069c0d977a14cd421ad8a3ef3255dc5802be
cross build --release --locked --target ${{ matrix.target }} --features=runtime-rules,request-ai
- name: install cargo-deb
- name: package deb
if: ${{ matrix.deb == true }}
uses: actions-rs/install@v0.1
with:
crate: cargo-deb
- name: build deb
if: ${{ matrix.deb == true }}
uses: actions-rs/cargo@v1
with:
command: deb
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
run: |
cargo install cargo-deb --locked
cargo deb --no-build --no-strip --output . --target ${{ matrix.target }}
- name: zipping files (exe)
if: runner.os == 'Windows'
# for some reason Windows doesn't support environment variables?
run: >
7z a pay-respects-${{ matrix.target }}.zip
7z a pay-respects-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.zip
./target/${{ matrix.target }}/release/pay-respects.exe
- name: zipping files (unix)