* Make regalloc2 `#![no_std]` This crate doesn't require any features from the standard library, so it can be made `no_std` to allow it to be used in environments that can't use the Rust standard library. This PR mainly performs the following mechanical changes: - `std::collections` is replaced with `alloc::collections`. - `std::*` is replaced with `core::*`. - `Vec`, `vec!`, `format!` and `ToString` are imported when needed since they are no longer in the prelude. - `HashSet` and `HashMap` are taken from the `hashbrown` crate, which is the same implementation that the standard library uses. - `FxHashSet` and `FxHashMap` are typedefs in `lib.rs` that are based on the `hashbrown` types. The only functional change is that `RegAllocError` no longer implements the `Error` trait since that is not available in `core`. Dependencies were adjusted to not require `std` and this is tested in CI by building against the `thumbv6m-none-eabi` target that doesn't have `std`. * Add the Error trait impl back under a "std" feature
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
# Derived from regalloc.rs' GitHub CI config file.
|
|
|
|
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
# Lint code with rustfmt, report an error if it needs to be run.
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install rustfmt
|
|
run: rustup component add rustfmt
|
|
- name: Run rustfmt and check there's no difference
|
|
run: cargo fmt --all -- --check
|
|
|
|
# Make sure the code compiles and that all the tests pass.
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Build
|
|
run: cargo build
|
|
- name: Run tests
|
|
run: cargo test --all --verbose
|
|
|
|
# Make sure the code typechecks with non-default features enabled.
|
|
features:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Check with all features
|
|
run: cargo check --all-features
|
|
|
|
# Make sure the code and its dependencies compile without std.
|
|
no_std:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install thumbv6m-none-eabi target
|
|
run: rustup target add thumbv6m-none-eabi
|
|
- name: Check no_std build
|
|
run: cargo check --target thumbv6m-none-eabi --no-default-features --features trace-log,checker,enable-serde
|
|
|
|
# Lint dependency graph for security advisories, duplicate versions, and
|
|
# incompatible licences.
|
|
cargo_deny:
|
|
name: Cargo deny
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
- run: |
|
|
set -e
|
|
curl -L https://github.com/EmbarkStudios/cargo-deny/releases/download/0.8.5/cargo-deny-0.8.5-x86_64-unknown-linux-musl.tar.gz | tar xzf -
|
|
mv cargo-deny-*-x86_64-unknown-linux-musl/cargo-deny cargo-deny
|
|
echo `pwd` >> $GITHUB_PATH
|
|
- run: cargo deny check
|
|
|
|
# Builds the fuzz targets.
|
|
fuzz:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install nightly
|
|
run: rustup toolchain install nightly
|
|
- name: Install cargo-fuzz
|
|
run: cargo +nightly install cargo-fuzz
|
|
- name: Build ssagen fuzzing target
|
|
run: cargo +nightly fuzz build ssagen
|
|
- name: Build moves fuzzing target
|
|
run: cargo +nightly fuzz build moves
|
|
- name: Build ion fuzzing target
|
|
run: cargo +nightly fuzz build ion
|
|
- name: Build and smoke-test ion_checker fuzzing target
|
|
run: cargo +nightly fuzz run ion_checker ./fuzz/smoketest/ion_checker.bin
|