Skip to content

Commit

Permalink
Change the CI --all-features to an explicit list.
Browse files Browse the repository at this point in the history
This is due to the mutually exclusive features in rkyv which
we expose now. `--all-features` will now activate them and the crate
will fail to compile rkyv. We work around this by defining
an explicit list of all mutually exclusive features to.

Unfortunately there isn't an easy way to share env variables
among different YAML files
(actions/runner#655).

There also isn't a good way to specify --all-features minus
"just a few" (rust-lang/cargo#3126)
aside from giving the complete list.

Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
  • Loading branch information
gz committed Dec 14, 2023
1 parent 3728017 commit ead2720
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: codecov

env:
# It's really `--all-features`, but not adding the mutually exclusive features from rkyv
ALL_NON_EXCLUSIVE_FEATURES: --features "libc winapi unstable-locales rkyv serde arbitrary iana-time-zone android-tzdata"

on:
push:
branches: [main, 0.4.x]
Expand All @@ -18,7 +23,7 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo +nightly llvm-cov --all-features --workspace --lcov --doctests --output-path lcov.info
run: cargo +nightly llvm-cov ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --workspace --lcov --doctests --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: lint

env:
# It's really `--all-features`, but not adding the mutually exclusive features from rkyv
ALL_NON_EXCLUSIVE_FEATURES: --features "libc winapi unstable-locales rkyv serde arbitrary iana-time-zone android-tzdata"

on:
push:
branches: [main, 0.4.x]
Expand All @@ -19,7 +23,7 @@ jobs:
- run: cargo fmt --check --manifest-path fuzz/Cargo.toml
- run: cargo fmt --check --manifest-path bench/Cargo.toml
- run: |
cargo clippy --all-features --all-targets --color=always \
cargo clippy ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --all-targets --color=always \
-- -D warnings
- run: |
cargo clippy --manifest-path fuzz/Cargo.toml --color=always \
Expand Down Expand Up @@ -50,8 +54,8 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-deadlinks
- run: cargo deadlinks -- --all-features
- run: cargo doc --all-features --no-deps
- run: cargo deadlinks -- ${{ env.ALL_NON_EXCLUSIVE_FEATURES }}
- run: cargo doc ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --no-deps
env:
RUSTDOCFLAGS: -Dwarnings

Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: All Tests and Builds

env:
# It's really `--all-features`, but not adding the mutually exclusive features from rkyv
ALL_NON_EXCLUSIVE_FEATURES: --features "libc winapi unstable-locales rkyv serde arbitrary iana-time-zone android-tzdata"

on:
push:
branches: [main, 0.4.x]
Expand All @@ -16,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-features --color=always -- --color=always
- run: cargo test ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --color=always -- --color=always

# later this may be able to be included with the below
# kept separate for now as the following don't compile on 1.57
Expand Down Expand Up @@ -59,8 +63,8 @@ jobs:
- run: cargo check --manifest-path fuzz/Cargo.toml --all-targets
# run --lib and --doc to avoid the long running integration tests
# which are run elsewhere
- run: cargo test --lib --all-features --color=always -- --color=always
- run: cargo test --doc --all-features --color=always -- --color=always
- run: cargo test --lib ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --color=always -- --color=always
- run: cargo test --doc ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --color=always -- --color=always

features_check:
strategy:
Expand Down Expand Up @@ -181,16 +185,16 @@ jobs:
- uses: actions/checkout@v4
- run: cargo install cross
- uses: Swatinem/rust-cache@v2
- run: cross test --lib --all-features --target i686-unknown-linux-gnu --color=always
- run: cross test --doc --all-features --target i686-unknown-linux-gnu --color=always
- run: cross test --lib --all-features --target i686-unknown-linux-musl --color=always
- run: cross test --doc --all-features --target i686-unknown-linux-musl --color=always
- run: cross test --lib ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --target i686-unknown-linux-gnu --color=always
- run: cross test --doc ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --target i686-unknown-linux-gnu --color=always
- run: cross test --lib ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --target i686-unknown-linux-musl --color=always
- run: cross test --doc ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --target i686-unknown-linux-musl --color=always

check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo +nightly doc --all-features --no-deps
- run: cargo +nightly doc ${{ env.ALL_NON_EXCLUSIVE_FEATURES }} --no-deps
env:
RUSTDOCFLAGS: "-D warnings --cfg docsrs"

0 comments on commit ead2720

Please sign in to comment.