From a9771194b834c97fd29610ad91083de6dda22409 Mon Sep 17 00:00:00 2001 From: Alexander Wagner Date: Thu, 16 Dec 2021 18:29:31 +0100 Subject: [PATCH] Add cross tests --- .github/actions/cross-tests/action.yml | 32 ++++++++++++++++++++++++++ .github/workflows/sha3.yml | 28 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/actions/cross-tests/action.yml diff --git a/.github/actions/cross-tests/action.yml b/.github/actions/cross-tests/action.yml new file mode 100644 index 000000000..9845cb949 --- /dev/null +++ b/.github/actions/cross-tests/action.yml @@ -0,0 +1,32 @@ +name: "cross-tests" +description: "tests for aarch64 & mips" + +inputs: + rust: + required: true + package: + required: true + target: + required: true + features: + required: true + +runs: + using: "composite" + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ inputs.rust }} + target: ${{ inputs.target }} + override: true + - name: Install precompiled cross + run: | + export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url') + wget -O /tmp/binaries.tar.gz $URL + tar -C /tmp -xzf /tmp/binaries.tar.gz + mv /tmp/cross ~/.cargo/bin + shell: bash + - run: cross test --no-default-features --package ${{ inputs.package }} --target ${{ inputs.target }} --features ${{ inputs.features }} + shell: bash diff --git a/.github/workflows/sha3.yml b/.github/workflows/sha3.yml index 6e9c9dd1d..5066643c7 100644 --- a/.github/workflows/sha3.yml +++ b/.github/workflows/sha3.yml @@ -3,6 +3,7 @@ name: sha3 on: pull_request: paths: + - ".github/workflows/sha3.yml" - "sha3/**" - "Cargo.*" push: @@ -55,3 +56,30 @@ jobs: - run: cargo test --no-default-features - run: cargo test - run: cargo test --all-features + + # Cross-compiled tests + cross: + strategy: + matrix: + rust: + - 1.41.0 # MSRV + - stable + target: + - aarch64-unknown-linux-gnu + - mips-unknown-linux-gnu + features: + - default + + runs-on: ubuntu-latest + defaults: + run: + # Cross mounts only current package, i.e. by default it ignores workspace's Cargo.toml + working-directory: . + steps: + - uses: actions/checkout@v1 + - uses: ./.github/actions/cross-tests + with: + rust: ${{ matrix.rust }} + package: sha3 + target: ${{ matrix.target }} + features: ${{ matrix.features }}