From 20e5fdc35fecacc8d02d97452bfb063159a4ae46 Mon Sep 17 00:00:00 2001 From: Cosmic Horror Date: Sat, 21 Oct 2023 19:39:54 -0600 Subject: [PATCH] Emit build program name and version in CI --- .github/workflows/publish.yml | 14 ++++++++++---- .github/workflows/test.yml | 9 +++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22fd023..997bc70 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -66,7 +66,12 @@ jobs: with: targets: ${{ matrix.target }} - - name: Install Cross + - name: Setup native compilation + if: ${{ matrix.use-cross == false }} + shell: bash + echo "CARGO=cargo" >> $GITHUB_ENV + + - name: Setup cross compilation if: ${{ matrix.use-cross == true }} shell: bash run: | @@ -77,12 +82,13 @@ 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 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..e4c871e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,6 +60,11 @@ jobs: with: targets: ${{ matrix.target }} + - name: Setup native compilation + if: ${{ matrix.use-cross == false }} + shell: bash + echo "CARGO=cargo" >> $GITHUB_ENV + - name: Install Cross if: ${{ matrix.use-cross == true }} shell: bash @@ -72,9 +77,9 @@ jobs: 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 "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Test run: | - cargo test + $CARGO --version + $CARGO test --target ${{ matrix.target }}