Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sha3: Add cross tests #339

Merged
merged 1 commit into from Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/cross-tests/action.yml
@@ -0,0 +1,35 @@
name: "cross-tests"

inputs:
rust:
required: true
package:
required: true
target:
required: true
features:
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- 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: |
cd ${{ inputs.package }}
cross test --target ${{ inputs.target }} --no-default-features \
--features ${{ inputs.features }}
shell: bash
90 changes: 56 additions & 34 deletions .github/workflows/sha1.yml
Expand Up @@ -3,6 +3,7 @@ name: sha1
on:
pull_request:
paths:
- ".github/workflows/sha1.yml"
- "sha1/**"
- "Cargo.*"
push:
Expand All @@ -13,17 +14,28 @@ defaults:
working-directory: sha1

env:
CARGO_INCREMENTAL: 0
MSRV: 1.41.0
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 0

jobs:
set-msrv:
runs-on: ubuntu-latest
outputs:
msrv: ${{ steps.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v2
- id: msrv
run: echo "::set-output name=msrv::$(echo $MSRV)"

# Builds for no_std platforms
build:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -40,28 +52,29 @@ jobs:

# Linux tests
linux:
needs: set-msrv
strategy:
matrix:
include:
# 32-bit Linux/x86
# *** NOTE: Currently broken with `asm` feature enabled! See:
# https://github.com/RustCrypto/hashes/issues/251
#- target: i686-unknown-linux-gnu
# rust: 1.41.0 # MSRV
# rust: ${{needs.set-msrv.outputs.msrv}}
# deps: sudo apt update && sudo apt install gcc-multilib
#- target: i686-unknown-linux-gnu
# rust: stable
# deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux/x86_64
- target: x86_64-unknown-linux-gnu
rust: 1.41.0 # MSRV
rust: ${{needs.set-msrv.outputs.msrv}}
- target: x86_64-unknown-linux-gnu
rust: stable

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -76,15 +89,16 @@ jobs:

# macOS tests
macos:
needs: set-msrv
strategy:
matrix:
toolchain:
- 1.41.0 # MSRV
- ${{needs.set-msrv.outputs.msrv}}
- stable

runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -98,19 +112,20 @@ jobs:

# Windows tests
windows:
needs: set-msrv
strategy:
matrix:
include:
# 64-bit Windows (GNU)
# TODO(tarcieri): try re-enabling this when we bump MSRV
#- target: x86_64-pc-windows-gnu
# toolchain: 1.41.0 # MSRV
# toolchain: ${{needs.set-msrv.outputs.msrv}}
- target: x86_64-pc-windows-gnu
toolchain: stable

runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -121,28 +136,35 @@ jobs:
- run: cargo test --target ${{ matrix.target }}

# Cross-compiled tests
# *** NOTE: Currently broken with `asm` feature enabled! See:
# https://github.com/RustCrypto/hashes/issues/251
#
# cross:
# strategy:
# matrix:
# include:
# # ARM64
# - target: aarch64-unknown-linux-gnu
# rust: 1.41.0 # MSRV
# - target: aarch64-unknown-linux-gnu
# rust: stable
#
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true
# - run: cargo install cross
# - run: cross test --target ${{ matrix.target }}
# - run: cross test --target ${{ matrix.target }} --features asm
cross:
needs: set-msrv
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- aarch64-unknown-linux-gnu
- mips-unknown-linux-gnu
features:
- default
# **** NOTE: Currently broken with `asm` feature enabled! See:
# https://github.com/RustCrypto/hashes/issues/251
# include:
# - rust: stable
# target: aarch64-unknown-linux-gnu
# features: asm

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@v2
- uses: ./.github/actions/cross-tests
with:
rust: ${{ matrix.rust }}
package: ${{ github.workflow }}
target: ${{ matrix.target }}
features: ${{ matrix.features }}
68 changes: 41 additions & 27 deletions .github/workflows/sha2.yml
Expand Up @@ -3,6 +3,7 @@ name: sha2
on:
pull_request:
paths:
- ".github/workflows/sha2.yml"
- "sha2/**"
- "Cargo.*"
push:
Expand All @@ -13,23 +14,34 @@ defaults:
working-directory: sha2

env:
CARGO_INCREMENTAL: 0
MSRV: 1.41.0
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 0

jobs:
set-msrv:
runs-on: ubuntu-latest
outputs:
msrv: ${{ steps.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v2
- id: msrv
run: echo "::set-output name=msrv::$(echo $MSRV)"

# Builds for no_std platforms
build:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -40,26 +52,27 @@ jobs:

# Linux tests
linux:
needs: set-msrv
strategy:
matrix:
include:
# 32-bit Linux/x86
- target: i686-unknown-linux-gnu
rust: 1.41.0 # MSRV
rust: ${{needs.set-msrv.outputs.msrv}}
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux/x86_64
- target: x86_64-unknown-linux-gnu
rust: 1.41.0 # MSRV
rust: ${{needs.set-msrv.outputs.msrv}}
- target: x86_64-unknown-linux-gnu
rust: stable

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -74,15 +87,16 @@ jobs:

# macOS tests
macos:
needs: set-msrv
strategy:
matrix:
toolchain:
- 1.41.0 # MSRV
- ${{needs.set-msrv.outputs.msrv}}
- stable

runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -95,6 +109,7 @@ jobs:

# Windows tests
windows:
needs: set-msrv
strategy:
matrix:
include:
Expand All @@ -107,7 +122,7 @@ jobs:

runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -119,33 +134,32 @@ jobs:

# Cross-compiled tests
cross:
needs: set-msrv
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- aarch64-unknown-linux-gnu
- mips-unknown-linux-gnu
features:
- default
include:
# ARM64
#- target: aarch64-unknown-linux-gnu
# rust: 1.41.0 # MSRV
- target: aarch64-unknown-linux-gnu
rust: stable
- rust: stable
target: aarch64-unknown-linux-gnu
features: asm

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: actions-rs/toolchain@v1
- uses: actions/checkout@v2
- uses: ./.github/actions/cross-tests
with:
profile: minimal
toolchain: ${{ matrix.rust }}
rust: ${{ matrix.rust }}
package: ${{ github.workflow }}
target: ${{ matrix.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
- run: cross test --package sha2 --target ${{ matrix.target }}
- run: cross test --package sha2 --target ${{ matrix.target }} --features asm
features: ${{ matrix.features }}