diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fd82052 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,206 @@ +name: CI + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + linux-native: + runs-on: ${{ matrix.os }} + if: success() || failure() + strategy: + fail-fast: false + matrix: + libc: [gnu, musl] + include: + - os: ubuntu-latest + arch: x86_64 + - os: buildjet-2vcpu-ubuntu-2204-arm + arch: aarch64 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Add target + run: rustup target add ${{ matrix.arch }}-unknown-linux-${{ matrix.libc }} + - name: Test with panic backend + run: LITHIUM_BACKEND=panic cargo test --target ${{ matrix.arch }}-unknown-linux-${{ matrix.libc }} + - name: Test with Itanium backend + run: LITHIUM_BACKEND=itanium cargo test --target ${{ matrix.arch }}-unknown-linux-${{ matrix.libc }} + + linux-cross: + runs-on: ubuntu-latest + if: success() || failure() + strategy: + fail-fast: false + matrix: + target: + - aarch64-linux-android + - arm-linux-androideabi + - armv7-linux-androideabi + - arm-unknown-linux-gnueabi + - arm-unknown-linux-gnueabihf + - arm-unknown-linux-musleabi + - arm-unknown-linux-musleabihf + - armv7-unknown-linux-gnueabihf + - i686-unknown-linux-gnu + - i686-unknown-linux-musl + - loongarch64-unknown-linux-gnu + - loongarch64-unknown-linux-musl + - mips-unknown-linux-gnu + - mips64-unknown-linux-gnuabi64 + - mips64el-unknown-linux-gnuabi64 + - mipsel-unknown-linux-gnu + - powerpc64-unknown-linux-gnu + - powerpc64le-unknown-linux-gnu + - riscv64gc-unknown-linux-gnu + - s390x-unknown-linux-gnu + - sparc64-unknown-linux-gnu + - wasm32-unknown-emscripten + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Install Cross + run: cargo install cross --git https://github.com/cross-rs/cross + - name: Test with panic backend + run: LITHIUM_BACKEND=panic cross test --target ${{ matrix.target }} + - name: Test with Itanium backend + run: LITHIUM_BACKEND=itanium cross test --target ${{ matrix.target }} + + darwin: + runs-on: ${{ matrix.os }} + if: success() || failure() + strategy: + fail-fast: false + matrix: + os: + - macos-13 # x86_64 + - macos-15 # aarch64 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Test with panic backend + run: LITHIUM_BACKEND=panic cargo test + - name: Test with Itanium backend + run: LITHIUM_BACKEND=itanium cargo test + + windows: + runs-on: windows-latest + if: success() || failure() + strategy: + fail-fast: false + matrix: + arch: [x86_64, i686] + abi: [msvc, gnu] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set default-host + run: rustup set default-host ${{ matrix.arch }}-pc-windows-${{ matrix.abi }} + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Test with panic backend + run: set LITHIUM_BACKEND=panic && cargo test + - name: Test with SEH backend + if: matrix.abi == 'msvc' + run: set LITHIUM_BACKEND=seh && cargo test + - name: Test with Itanium backend + if: matrix.abi == 'gnu' + run: set LITHIUM_BACKEND=itanium && cargo test + + miri-linux: + runs-on: ubuntu-latest + if: success() || failure() + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + - i686-unknown-linux-gnu + - powerpc64-unknown-linux-gnu + - mips-unknown-linux-gnu + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Install Miri + run: rustup component add miri + - name: Add target + run: rustup target add ${{ matrix.target }} + - name: Test with panic backend + run: LITHIUM_BACKEND=panic cargo miri test --target ${{ matrix.target }} + - name: Test with Itanium backend + run: LITHIUM_BACKEND=itanium cargo miri test --target ${{ matrix.target }} + + miri-windows: + runs-on: windows-latest + if: success() || failure() + strategy: + fail-fast: false + matrix: + arch: [x86_64, i686] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set default-host + run: rustup set default-host ${{ matrix.arch }}-pc-windows-msvc + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Install Miri + run: rustup component add miri + - name: Test with SEH backend + run: set LITHIUM_BACKEND=seh && cargo miri test + + valgrind: + runs-on: ubuntu-latest + if: success() || failure() + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Install cargo valgrind + runs: sudo apt-get update && sudo apt-get install valgrind && cargo install cargo-valgrind + - name: Test with panic backend + run: LITHIUM_BACKEND=panic cargo valgrind test --target ${{ matrix.target }} + - name: Test with Itanium backend + run: LITHIUM_BACKEND=itanium cargo valgrind test --target ${{ matrix.target }} + + # TODO: Restore this when strict provenance APIs are in stable. + # test_stable: + # runs-on: ubuntu-latest + # if: success() || failure() + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Install Rust + # run: rustup update stable && rustup default stable + # - name: Test with panic backend + # run: cargo test + + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + backend: [panic, itanium, seh] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy + - name: Rustfmt + run: LITHIUM_BACKEND=${{ matrix.backend }} cargo fmt -- --check + - name: Clippy + run: LITHIUM_BACKEND=${{ matrix.backend }} cargo clippy -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index b013dd8..4579c8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,12 +35,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - [[package]] name = "cast" version = "0.3.0" @@ -121,8 +115,6 @@ dependencies = [ "num-traits", "once_cell", "oorandom", - "plotters", - "rayon", "regex", "serde", "serde_derive", @@ -141,31 +133,6 @@ dependencies = [ "itertools", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - [[package]] name = "crunchy" version = "0.2.2" @@ -220,15 +187,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "libc" version = "0.2.161" @@ -246,12 +204,6 @@ dependencies = [ "typeid", ] -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - [[package]] name = "memchr" version = "2.7.4" @@ -279,34 +231,6 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" -[[package]] -name = "plotters" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" - -[[package]] -name = "plotters-svg" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" -dependencies = [ - "plotters-backend", -] - [[package]] name = "proc-macro2" version = "1.0.89" @@ -325,26 +249,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "regex" version = "1.11.1" @@ -485,71 +389,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasm-bindgen" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" - -[[package]] -name = "web-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi-util" version = "0.1.9" diff --git a/Cargo.toml b/Cargo.toml index 5e6430a..b9266fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ typeid = "1.0.2" [dev-dependencies] anyhow = "1" -criterion = "0.5" +criterion = { version = "0.5", default-features = false, features = ["cargo_bench_support"] } replace_with = "0.1.7" [build-dependencies] diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..c84aaac --- /dev/null +++ b/Cross.toml @@ -0,0 +1,14 @@ +[build.env] +passthrough = ["LITHIUM_BACKEND"] + +[target.mips-unknown-linux-gnu] +build-std = ["std"] + +[target.mips64-unknown-linux-gnuabi64] +build-std = ["std"] + +[target.mips64el-unknown-linux-gnuabi64] +build-std = ["std"] + +[target.mipsel-unknown-linux-gnu] +build-std = ["std"]