Files
cuprate-for-explorer/.github/workflows/ci.yml
Boog900 1b28c3b728 Add Fuzzing + fix found issues (#464)
* add fuzz tests

* fix CI

* fix found vuln

* fix deny

* add more targets

* fmt + clippy

* Add exclude for fuzz

* add defaults rather than exclude

* add fuzz to CI

* remove clippy run

* add readme

* review fixes

* Update Cargo.toml

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2025-05-28 20:29:06 +01:00

139 lines
3.5 KiB
YAML

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
# Show colored output in CI.
CARGO_TERM_COLOR: always
# Show full panics.
RUST_BACKTRACE: "full"
# Increase thread stack size to 8 megabytes.
RUST_MIN_STACK: 8000000
# Fail on documentation warnings.
RUSTDOCFLAGS: '-D warnings'
# Enable debug information generation for build dependencies.
CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG: true
jobs:
# Run format separately.
#
# This will fast-cancel other CI early if this fails.
#
# `cargo fmt` checks _all_ code, regardless of the OS
# or any `#[cfg]`'s, so this only needs to run on Linux.
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Format
run: cargo fmt --all --check
# Run typo checker separately.
# This will fast-cancel other CI early if this fails.
typo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Spell Check
uses: crate-ci/typos@master
# Run 32-bit WASM support check separately.
wasm-32-bit-support:
runs-on: ubuntu-latest
strategy:
matrix:
# The list of crates to check for WASM 32 bit support
# TODO: check features.
crate: [
cuprate-epee-encoding,
cuprate-rpc-types,
cuprate-fixed-bytes,
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Build WASM 32-bit
run: cargo build --target wasm32-unknown-unknown -p ${{ matrix.crate }}
# All other CI.
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [
windows-2022, # EOL = 2026-10-13 | <https://endoflife.date/windows-server>
macos-15, # EOL = 2027-09-16 | <https://endoflife.date/macos>
macos-13, # EOL = 2025-10-24 | For x64.
ubuntu-22.04, # EOL = 2027-04-01 | <https://endoflife.date/ubuntu>
ubuntu-22.04-arm,
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Cache
uses: actions/cache@v4
with:
path: target
key: ${{ matrix.os }}
- name: Download monerod
uses: ./.github/actions/monerod-download
- name: Install dependencies (Windows)
if: matrix.os == 'windows-2022'
uses: lukka/get-cmake@v3.31.6 # Needed for `randomx-rs`
- name: Documentation
run: cargo doc --all-features --no-deps
- name: Clippy (fail on warnings)
run: cargo clippy --all-features --all-targets -- -D warnings
# HACK: how to test both DB backends that are feature-gated?
- name: Test
run: |
cargo test --all-features
cargo test --package cuprate-blockchain --no-default-features --features redb
- name: Build
run: cargo build --all-features --all-targets
- name: Hack Check
run: |
cargo install cargo-hack --locked
cargo hack check --feature-powerset --no-dev-deps