name: QC on: pull_request: push: branches: [main] permissions: checks: write contents: read jobs: prettier: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actionsx/prettier@v2 with: args: --check . shellcheck: name: Shellcheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master rustfmt: name: Rust Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Run Rust Formatting Script run: bash format_rust_code.sh --mode check cargo-audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} cargo-clippy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: rustup component add clippy - name: Install libsodium run: sudo apt-get install -y libsodium-dev - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-features cargo-doc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: rustup component add clippy - name: Install libsodium run: sudo apt-get install -y libsodium-dev # `--no-deps` used as a workaround for a rust compiler bug. See: # - https://github.com/rosenpass/rosenpass/issues/62 # - https://github.com/rust-lang/rust/issues/108378 - run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items cargo-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install libsodium run: sudo apt-get install -y libsodium-dev # liboqs requires quite a lot of stack memory, thus we adjust # the default stack size picked for new threads (which is used # by `cargo test`) to be _big enough_. Setting it to 8 MiB - run: RUST_MIN_STACK=8388608 cargo test cargo-test-nix-devshell-x86_64-linux: runs-on: - ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: cachix/install-nix-action@v21 with: nix_path: nixpkgs=channel:nixos-unstable - uses: cachix/cachix-action@v12 with: name: rosenpass authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - run: nix develop --command cargo test cargo-fuzz: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install libsodium run: sudo apt-get install -y libsodium-dev - name: Install nightly toolchain run: | rustup toolchain install nightly rustup default nightly - name: Install cargo-fuzz run: cargo install cargo-fuzz - name: Run fuzzing run: | cargo fuzz run fuzz_aead_enc_into -- -max_total_time=5 cargo fuzz run fuzz_blake2b -- -max_total_time=5 cargo fuzz run fuzz_handle_msg -- -max_total_time=5 ulimit -s 8192000 && RUST_MIN_STACK=33554432000 && cargo fuzz run fuzz_kyber_encaps -- -max_total_time=5 cargo fuzz run fuzz_mceliece_encaps -- -max_total_time=5 cargo fuzz run fuzz_box_sodium_alloc -- -max_total_time=5 cargo fuzz run fuzz_vec_sodium_alloc -- -max_total_time=5