From 7e69d2b256d0539cb2ce5c6ec529d6375a0a4f64 Mon Sep 17 00:00:00 2001 From: iff Date: Sat, 23 Nov 2024 14:28:25 +0100 Subject: [PATCH] ci: update for caching and more architectures --- .github/workflows/build.yaml | 55 ++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 46fda0e..70c032d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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)