Actually use the build target intended for each CI job (#252)

This commit is contained in:
CosmicHorror 2023-10-21 20:06:52 -06:00 committed by GitHub
parent 4a54433860
commit 20b1459a42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 7 deletions

View file

@ -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

View file

@ -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 }}