Skip to content

Commit

Permalink
fix: try different rust setup
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Jul 28, 2023
1 parent 5ca43f9 commit 204f3bb
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/rust-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
RUSTFLAGS: "-D warnings"
CARGO_TERM_COLOR: always
DEFAULT_FEATURES: tokio,serde,reqwest,sparse,sysinfo,libsolv_rs
rust_stable: 1.70.0

jobs:
check:
Expand Down Expand Up @@ -92,39 +93,46 @@ jobs:

- { name: "Windows-x86_64", target: x86_64-pc-windows-msvc, os: windows-latest }
# - { name: "Windows-aarch64", target: aarch64-pc-windows-msvc, os: windows-latest, skip-tests: true }
env:
BUILD_CMD: cargo # The build and test command to use if not overwritten
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
submodules: recursive
lfs: ${{ !matrix.job.skip-tests }}

- name: Install prerequisites
shell: bash
run: |
case ${{ matrix.job.target }} in
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
# - name: Install prerequisites
# shell: bash
# run: |
# case ${{ matrix.job.target }} in
# arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
# aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
# esac

# - name: Install Rust toolchain
# uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# target: ${{ matrix.job.target }}
# components: rustfmt
# cache: false

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.job.target }}
components: rustfmt
toolchain: ${{ env.rust_stable }}
target: ${{ matrix.target }}

- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
- uses: taiki-e/setup-cross-toolchain-action@v1
if: startsWith(matrix.job.os, 'ubuntu') && !contains(matrix.job.target, '-musl')
with:
tool: cross
target: ${{ matrix.job.target }}

- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- uses: taiki-e/install-action@cross
if: contains(matrix.job.target, '-musl')

# - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
# if: endsWith(matrix.job.target, 'windows-msvc')

- uses: Swatinem/rust-cache@v2

- name: Add macOS cross build capability
if: matrix.job.target == 'aarch64-apple-darwin'
Expand Down Expand Up @@ -154,11 +162,7 @@ jobs:
echo "CARGO_BUILD_OPTIONS=${CARGO_BUILD_OPTIONS}" >> $GITHUB_OUTPUT
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --target=${{ matrix.job.target }} --all-targets ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} --features ${{ env.DEFAULT_FEATURES }}
run: cargo build --target=${{ matrix.job.target }} --all-targets ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} --features ${{ env.DEFAULT_FEATURES }}

- name: Set test options
id: test-options
Expand All @@ -174,8 +178,4 @@ jobs:
- name: Run tests
if: ${{ !matrix.job.skip-tests }}
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: test
args: --workspace --features ${{ env.DEFAULT_FEATURES }} --target=${{ matrix.job.target }} ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} -- --nocapture
run: cargo test --workspace --features ${{ env.DEFAULT_FEATURES }} --target=${{ matrix.job.target }} ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} -- --nocapture

0 comments on commit 204f3bb

Please sign in to comment.