From 20b1459a4225982a56fd0fc57df6e5d10f4f568b Mon Sep 17 00:00:00 2001 From: CosmicHorror Date: Sat, 21 Oct 2023 20:06:52 -0600 Subject: Actually use the build target intended for each CI job (#252) --- .github/workflows/publish.yml | 16 ++++++++++++---- .github/workflows/test.yml | 13 ++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22fd023..2a34b47 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -66,7 +66,13 @@ jobs: with: targets: ${{ matrix.target }} - - name: Install Cross + - name: Setup native compilation + if: ${{ matrix.use-cross == false }} + shell: bash + run: | + echo "CARGO=cargo" >> $GITHUB_ENV + + - name: Setup cross compilation if: ${{ matrix.use-cross == true }} shell: bash run: | @@ -77,12 +83,14 @@ jobs: curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" tar xf cross-x86_64-unknown-linux-musl.tar.gz echo "CARGO=cross" >> $GITHUB_ENV - echo "RUSTFLAGS='--cfg sd_cross_compile'" - echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV + echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Build + shell: bash run: | - cargo build --release --locked + $CARGO --version + $CARGO build --release --locked --target ${{ matrix.target }} - name: Upload binaries to release uses: svenstaro/upload-release-action@2.7.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c4cc96..3ce9afe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,6 +60,12 @@ jobs: with: targets: ${{ matrix.target }} + - name: Setup native compilation + if: ${{ matrix.use-cross == false }} + shell: bash + run: | + echo "CARGO=cargo" >> $GITHUB_ENV + - name: Install Cross if: ${{ matrix.use-cross == true }} shell: bash @@ -71,10 +77,11 @@ jobs: curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" tar xf cross-x86_64-unknown-linux-musl.tar.gz echo "CARGO=cross" >> $GITHUB_ENV - echo "RUSTFLAGS='--cfg sd_cross_compile'" - echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Test + shell: bash run: | - cargo test + $CARGO --version + $CARGO test --target ${{ matrix.target }} -- cgit v1.2.3