diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index f2196de..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,202 +0,0 @@ -env: - RUSTFLAGS: -D warnings - RUSTDOCFLAGS: -D warnings - -stable_test_task: - name: "Rust Stable" - container: - image: rust:latest - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - setup_script: - - rustup component add rustfmt - primary_test_script: - - rustc --version - - cargo test --all - alloc_only_test_script: - - cargo test --manifest-path compatibility-tests/alloc-only/Cargo.toml - backtraces_impl_backtrace_crate_test_script: - - cargo test --manifest-path compatibility-tests/backtraces-impl-backtrace-crate/Cargo.toml - backtraces_impl_inert_test_script: - - cargo test --manifest-path compatibility-tests/backtraces-impl-inert/Cargo.toml - context_selectors_have_documentation_test_script: - - cargo test --manifest-path compatibility-tests/context-selectors-have-documentation/Cargo.toml - futures_test_script: - - cargo test --manifest-path compatibility-tests/futures/Cargo.toml - renamed_import_test_script: - - cargo test --manifest-path compatibility-tests/renamed-import/Cargo.toml - compile_fail_test_script: - - cargo test --manifest-path compatibility-tests/compile-fail/Cargo.toml - lint_script: - - > - for i in $(find . -name 'Cargo.toml'); do - pushd $(dirname $i); - cargo +stable fmt --all -- --check; - popd; - done - all_compatibility_tests_used_script: - - > - for n in compatibility-tests/*; do - n=$(basename $n); - if grep -q $n .cirrus.yml; then - echo "$n found"; - else - echo "$n missing"; - exit 1; - fi; - done - before_cache_script: rm -rf $CARGO_HOME/registry/index - -doc_test_task: - name: "Docs" - env: - # unused-braces is due to https://github.com/rust-lang/rust/issues/70717 - RUSTFLAGS: "-D warnings -A unused-braces" - RUSTDOCFLAGS: "${RUSTFLAGS}" - container: - image: rustlang/rust:nightly - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - version_information_script: - - rustc +nightly --version - docs_script: - - cargo +nightly doc - backtraces_impl_backtrace_crate_docs_script: - - cargo +nightly doc --features=backtraces-impl-backtrace-crate - futures_docs_script: - - cargo +nightly doc --features=futures - before_cache_script: rm -rf $CARGO_HOME/registry/index - -doc_tests_task: - name: "Documentation Tests" - container: - image: rustlang/rust:nightly - cpu: 1 - memory: 4Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - version_information_script: - - rustc +nightly --version - backtraces_impl_backtrace_crate_doctests_script: - - cargo +nightly test --doc --features=backtraces-impl-backtrace-crate - futures_doctests_script: - - cargo +nightly test --doc --features=futures,internal-dev-dependencies - before_cache_script: rm -rf $CARGO_HOME/registry/index - -stable_no_std_test_task: - name: "Rust Stable (no_std)" - container: - image: rust:latest - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - setup_script: - - rustup target add thumbv6m-none-eabi - our_error_test_script: - - rustc --version - - cargo build --target thumbv6m-none-eabi --no-default-features - - cargo build --target thumbv6m-none-eabi --no-default-features --features=futures - before_cache_script: rm -rf $CARGO_HOME/registry/index - -rust_1_81_no_std_test_task: - name: "Rust 1.81 (no_std)" - container: - image: rust:1.81 - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - setup_script: - - rustup target add thumbv6m-none-eabi - core_error_test_script: - - rustc --version - - cargo build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81 - - cargo build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,futures - - cargo build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc - - cargo build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc,futures - before_cache_script: rm -rf $CARGO_HOME/registry/index - -rust_nightly_no_std_test_task: - name: "Rust Nightly (no_std)" - container: - image: rustlang/rust:nightly - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - setup_script: - - rustup target add thumbv6m-none-eabi --toolchain=nightly - - rustc --version - provider_api_test_script: - - cargo +nightly build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,unstable-provider-api - - cargo +nightly build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc,unstable-provider-api - before_cache_script: rm -rf $CARGO_HOME/registry/index - -nightly_test_task: - name: "Rust Nightly" - container: - image: rustlang/rust:nightly - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - setup_script: - - rustup toolchain add stable --profile minimal - primary_test_script: - - rustc +nightly --version - - cargo +nightly test - minimum_version_derive_test_script: - - cp -R snafu-derive snafu-derive-non-workspace - - cd snafu-derive-non-workspace - - echo '[workspace]' >> Cargo.toml - - cargo +nightly -Z minimal-versions update - - cargo +stable build - minimum_version_test_script: - - cargo +nightly -Z minimal-versions update - - cargo +stable test - provider_api_test_script: - - cd compatibility-tests/provider-api/ - - rustc --version - - cargo test - report_provider_api_test_script: - - cd compatibility-tests/report-provider-api/ - - rustc --version - - cargo test - report_try_trait_test_script: - - cd compatibility-tests/report-try-trait/ - - rustc --version - - cargo test - report_provider_api_test_script: - - cd compatibility-tests/backtrace-provider-api/ - - rustc --version - - cargo test - before_cache_script: rm -rf $CARGO_HOME/registry/index - -# Our Minimal Supported Rust Version (MSRV) -v1_65_test_task: - name: "Rust 1.65" - container: - image: rust:1.65 - cpu: 1 - memory: 2Gi - cargo_cache: - folder: $CARGO_HOME/registry - fingerprint_script: cat Cargo.toml - primary_test_script: - - rustup self update - - cd compatibility-tests/v1_65/ - - rustc --version - - cargo test - before_cache_script: rm -rf $CARGO_HOME/registry/index diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7cfd7c3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,268 @@ +name: "Continuous Integration" +on: [push, pull_request] + +env: + RUSTFLAGS: -D warnings + RUSTDOCFLAGS: -D warnings + +jobs: + stable: + name: "Tests (Rust Stable)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: rustfmt + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Tests" + run: cargo test --all + + - name: "Compatibility tests (alloc-only)" + working-directory: compatibility-tests/alloc-only + run: cargo test + + - name: "Compatibility tests (backtraces-impl-backtrace-crate)" + working-directory: compatibility-tests/backtraces-impl-backtrace-crate + run: cargo test + + - name: "Compatibility tests (backtraces_impl_inert)" + working-directory: compatibility-tests/backtraces-impl-inert + run: cargo test + + - name: "Compatibility tests (context_selectors_have_documentation)" + working-directory: compatibility-tests/context-selectors-have-documentation + run: cargo test + + - name: "Compatibility tests (futures)" + working-directory: compatibility-tests/futures + run: cargo test + + - name: "Compatibility tests (renamed_import)" + working-directory: compatibility-tests/renamed-import + run: cargo test + + - name: "Compatibility tests (compile_fail)" + working-directory: compatibility-tests/compile-fail + run: cargo test + + - name: "Formatting" + run: >- + for i in $(find . -name 'Cargo.toml'); do + pushd $(dirname $i); + cargo +stable fmt --all -- --check; + popd; + done + + - name: "All compatibility tests executed" + run: >- + for n in compatibility-tests/*; do + n=$(basename $n); + if grep -q $n .github/workflows/ci.yml; then + echo "$n found"; + else + echo "$n missing"; + exit 1; + fi; + done + + docs: + name: "Documentation (Rust Nightly)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Generate documentation" + run: cargo +nightly doc + + - name: "Generate documentation (backtraces-impl-backtrace-crate)" + run: cargo +nightly doc --features=backtraces-impl-backtrace-crate + + - name: "Generate documentation (futures)" + run: cargo +nightly doc --features=futures + + doctests: + name: "Documentation Tests (Rust Nightly)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Doctests (backtraces-impl-backtrace-crate)" + run: cargo +nightly test --doc --features=backtraces-impl-backtrace-crate + + - name: "Doctests (futures)" + run: cargo +nightly test --doc --features=futures,internal-dev-dependencies + + no_std_stable: + name: "no_std (Rust Stable)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: thumbv6m-none-eabi + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Build" + run: cargo build --target thumbv6m-none-eabi --no-default-features + + - name: "Build (futures)" + run: cargo build --target thumbv6m-none-eabi --no-default-features --features=futures + + no_std_1_81: + name: "no_std (Rust 1.81)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.81 + targets: thumbv6m-none-eabi + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Build" + run: cargo +1.81 build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81 + + - name: "Build (futures)" + run: cargo +1.81 build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,futures + + - name: "Build (alloc)" + run: cargo +1.81 build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc + + - name: "Build (alloc,futures)" + run: cargo +1.81 build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc,futures + + no_std_nightly: + name: "no_std (Rust Nightly)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + targets: thumbv6m-none-eabi + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Build (unstable-provider-api)" + run: cargo +nightly build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,unstable-provider-api + + - name: "Build (alloc,unstable-provider-api)" + run: cargo +nightly build --target thumbv6m-none-eabi --no-default-features --features=rust_1_81,alloc,unstable-provider-api + + nightly: + name: "Tests (Rust Nightly)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + + - name: "Install Rust Stable" + run: rustup toolchain add stable --profile minimal + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Tests" + run: cargo +nightly test + + - name: "Minimum versions (snafu-derive)" + run: >- + cp -R snafu-derive snafu-derive-non-workspace; + cd snafu-derive-non-workspace; + echo '[workspace]' >> Cargo.toml; + cargo +nightly -Z minimal-versions update; + cargo +stable build; + + - name: "Minimum versions (snafu)" + run: >- + cargo +nightly -Z minimal-versions update; + cargo +stable test; + + - name: "Compatibility tests (provider-api)" + working-directory: compatibility-tests/provider-api + run: cargo test + + - name: "Compatibility tests (report-provider-api)" + working-directory: compatibility-tests/report-provider-api + run: cargo test + + - name: "Compatibility tests (report-try-trait)" + working-directory: compatibility-tests/report-try-trait + run: cargo test + + - name: "Compatibility tests (backtrace-provider-api)" + working-directory: compatibility-tests/backtrace-provider-api + run: cargo test + + msrv: + name: "Minimal Supported Rust Version / MSRV (Rust 1.65)" + runs-on: ubuntu-latest + + steps: + - name: "Check out code" + uses: actions/checkout@v7.0.1 + + - name: "Configure Rust" + uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.65 + + - name: "Cache Rust compilation" + uses: Swatinem/rust-cache@v2.9.1 + + - name: "Compatibility tests (v1_65)" + working-directory: compatibility-tests/v1_65 + run: cargo test diff --git a/Cargo.toml b/Cargo.toml index 037a5e1..46d4adc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ keywords = ["error", "ergonomic", "library", "no_std"] categories = ["rust-patterns", "no-std"] exclude = [ - "/.cirrus.yml", + "/.github", "/.gitignore", "/rust-toolchain", ] diff --git a/README.md b/README.md index d9af141..b362d9d 100644 --- a/README.md +++ b/README.md @@ -47,5 +47,5 @@ a full description. [Doc Logo]: https://docs.rs/snafu/badge.svg [Guide]: https://docs.rs/snafu/*/snafu/guide/index.html -[CI]: https://cirrus-ci.com/github/shepmaster/snafu -[CI Logo]: https://api.cirrus-ci.com/github/shepmaster/snafu.svg +[CI]: https://github.com/shepmaster/snafu/actions/workflows/ci.yml +[CI Logo]: https://github.com/shepmaster/snafu/actions/workflows/ci.yml/badge.svg