Skip to content

Commit

Permalink
ci: use cargo nono to check for no_std compatibility violations
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTMjugador committed May 18, 2024
1 parent c140776 commit efda3b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install cargo-nono
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: cargo-nono

- name: Run rustfmt
if: matrix.conf == 'nightly'
run: cargo fmt --check --verbose -- --color=always
Expand All @@ -66,3 +72,13 @@ jobs:
- name: Generate documentation
if: matrix.conf == 'nightly'
run: cargo doc --all-features

- name: Check effective no_std compatibility
if: matrix.conf == 'nightly'
run: |
# Temporarily drop the binary crate so that cargo nono does not
# get confused about what crate to analyze: we are only interested
# in the library one
sed -i 's;^bin = ;#&;' Cargo.toml
rm src/main.rs
cargo nono check --no-default-features --features gzip,zlib
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# The binary target must be set in a single line like this to make it easily
# removable by the CI "Check effective no_std compatibility" step
bin = [{ name = "zopfli", required-features = ["std", "gzip", "zlib"] }]

[package]
name = "zopfli"
version = "0.8.1"
Expand Down Expand Up @@ -46,10 +50,6 @@ std = [
]
nightly = ["crc32fast?/nightly"]

[[bin]]
name = "zopfli"
required-features = ["std", "gzip", "zlib"]

[profile.release]
debug = true

Expand Down

0 comments on commit efda3b4

Please sign in to comment.