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

Rust: Add no_std CI #1648

Merged
merged 8 commits into from
Sep 5, 2023
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,43 @@ on:
schedule:
- cron: '0 0 1 * *'

defaults:
run:
working-directory: fiat-rust

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ github.job }}
cancel-in-progress: true

jobs:
test-rust:

runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- name: cargo build
run: (cd fiat-rust; cargo build --verbose)
run: cargo build --verbose
- name: cargo test
run: (cd fiat-rust; cargo test --verbose)
- name: cargo test (no_std)
run: (cd fiat-rust; cargo test --no-default-features --verbose)
run: cargo test --verbose
- name: curve25519-dalek test
run: etc/ci/test-fiat-rust-curve25519-dalek.sh
run: (cd .. ; etc/ci/test-fiat-rust-curve25519-dalek.sh)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you instead make the scripts robust to cwd changes by sticking in a line like

cd "$(dirname "$0")/../.." || exit 7

in the script itself?

Copy link
Contributor Author

@pinkforest pinkforest Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to do that in a follow-up PR where I will remove those shellscripts together and it will be natively github action - or a bit more idiomatic w/o shellscripts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good. In that case I think you'll need to fix the cd ..; ../etc/... that's a couple lines down though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thanks fixed 💜

- name: crate-crypto/Ed448-Goldilocks test
run: etc/ci/test-fiat-rust-crate-crypto-Ed448-Goldilocks.sh
run: (cd .. ; etc/ci/test-fiat-rust-crate-crypto-Ed448-Goldilocks.sh)

build-nostd:
name: Build on no_std target (thumbv7em-none-eabi)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: thumbv7em-none-eabi
- uses: taiki-e/install-action@cargo-hack
# No default features build
- name: no_std / no feat fiat-crypto
run: cargo build -p fiat-crypto --target thumbv7em-none-eabi --release --no-default-features
- name: no_std / cargo hack fiat-crypto
run: cargo hack build -p fiat-crypto --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to complete in 0.00s?
Run cargo build -p fiat-crypto --target thumbv7em-none-eabi --release --no-default-features
Compiling fiat-crypto v0.2.2 (/home/runner/work/fiat-crypto/fiat-crypto/fiat-rust)
Finished release [optimized] target(s) in 6.75s
0s
Run cargo hack build -p fiat-crypto --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std
cargo hack build -p fiat-crypto --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std
shell: /usr/bin/bash -e {0}
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
info: running cargo build --release --target thumbv7em-none-eabi --no-default-features on fiat-crypto (1/1)
Finished release [optimized] target(s) in 0.00s

Copy link
Contributor Author

@pinkforest pinkforest Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because it only builds it and it uses incremental compilation - it will take more when there are features