Skip to content

Commit a977119

Browse files
committed
Add cross tests
1 parent cbd6849 commit a977119

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "cross-tests"
2+
description: "tests for aarch64 & mips"
3+
4+
inputs:
5+
rust:
6+
required: true
7+
package:
8+
required: true
9+
target:
10+
required: true
11+
features:
12+
required: true
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- uses: actions/checkout@v1
18+
- uses: actions-rs/toolchain@v1
19+
with:
20+
profile: minimal
21+
toolchain: ${{ inputs.rust }}
22+
target: ${{ inputs.target }}
23+
override: true
24+
- name: Install precompiled cross
25+
run: |
26+
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')
27+
wget -O /tmp/binaries.tar.gz $URL
28+
tar -C /tmp -xzf /tmp/binaries.tar.gz
29+
mv /tmp/cross ~/.cargo/bin
30+
shell: bash
31+
- run: cross test --no-default-features --package ${{ inputs.package }} --target ${{ inputs.target }} --features ${{ inputs.features }}
32+
shell: bash

.github/workflows/sha3.yml

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: sha3
33
on:
44
pull_request:
55
paths:
6+
- ".github/workflows/sha3.yml"
67
- "sha3/**"
78
- "Cargo.*"
89
push:
@@ -55,3 +56,30 @@ jobs:
5556
- run: cargo test --no-default-features
5657
- run: cargo test
5758
- run: cargo test --all-features
59+
60+
# Cross-compiled tests
61+
cross:
62+
strategy:
63+
matrix:
64+
rust:
65+
- 1.41.0 # MSRV
66+
- stable
67+
target:
68+
- aarch64-unknown-linux-gnu
69+
- mips-unknown-linux-gnu
70+
features:
71+
- default
72+
73+
runs-on: ubuntu-latest
74+
defaults:
75+
run:
76+
# Cross mounts only current package, i.e. by default it ignores workspace's Cargo.toml
77+
working-directory: .
78+
steps:
79+
- uses: actions/checkout@v1
80+
- uses: ./.github/actions/cross-tests
81+
with:
82+
rust: ${{ matrix.rust }}
83+
package: sha3
84+
target: ${{ matrix.target }}
85+
features: ${{ matrix.features }}

0 commit comments

Comments
 (0)