Skip to content

Commit a667347

Browse files
committed
Test all combinations of features
1 parent e3b4b7f commit a667347

File tree

6 files changed

+50
-33
lines changed

6 files changed

+50
-33
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ updates:
1212
applies-to: version-updates
1313
patterns: ["*"]
1414
update-types:
15-
- "minor"
16-
- "patch"
15+
- "minor"
16+
- "patch"
1717
- package-ecosystem: cargo
1818
directory: /
1919
schedule:
@@ -26,5 +26,5 @@ updates:
2626
applies-to: version-updates
2727
patterns: ["*"]
2828
update-types:
29-
- "minor"
30-
- "patch"
29+
- "minor"
30+
- "patch"

.github/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ changelog:
1919
- C-testing
2020
- title: Other Changes
2121
labels:
22-
- '*'
22+
- "*"

.github/workflows/rust.yml

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ name: Rust - Continuous integration
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88

99
concurrency:
1010
# Allow one run at a time for PRs, but multiple for other invocations
1111
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1212
cancel-in-progress: true
1313

14-
1514
env:
1615
RUSTFLAGS: -Dwarnings
1716
CARGO_TERM_COLOR: always
@@ -21,21 +20,21 @@ jobs:
2120
name: Lint
2221
runs-on: ubuntu-latest
2322
steps:
24-
- uses: actions/checkout@v4
25-
- uses: dtolnay/rust-toolchain@stable
26-
with:
27-
components: clippy, rustfmt
28-
- uses: Swatinem/rust-cache@v2
29-
with:
30-
key: lint
31-
- name: Install cargo-workspaces
32-
run: cargo install cargo-workspaces
33-
- name: Check rustfmt
34-
run: cargo fmt --all -- --check
35-
- name: Check clippy
36-
run: cargo ws exec cargo clippy --all-features --all-targets
37-
- name: Check clippy (No features)
38-
run: cargo ws exec cargo clippy --no-default-features --all-targets
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: clippy, rustfmt
27+
- uses: Swatinem/rust-cache@v2
28+
with:
29+
key: lint
30+
- name: Install cargo-workspaces
31+
run: cargo install cargo-workspaces
32+
- name: Check rustfmt
33+
run: cargo fmt --all -- --check
34+
- name: Check clippy
35+
run: cargo ws exec cargo clippy --all-features --all-targets
36+
- name: Check clippy (No features)
37+
run: cargo ws exec cargo clippy --no-default-features --all-targets
3938

4039
msrv:
4140
name: MSRV
@@ -65,7 +64,7 @@ jobs:
6564
rust:
6665
# TODO: possibly add the MSRV here
6766
- { version: stable, name: stable }
68-
os: [ubuntu-latest, macos-latest, windows-latest]
67+
os: [macos-latest, windows-latest]
6968
runs-on: ${{ matrix.os }}
7069
steps:
7170
- uses: actions/checkout@v4
@@ -76,15 +75,30 @@ jobs:
7675
with:
7776
key: build-test
7877

79-
- name: Cargo build
80-
run: cargo build --quiet
81-
- name: Test
82-
run: cargo test
83-
8478
- name: Cargo build --all-features
8579
run: cargo build --quiet --all-features
8680
- name: Test --all-features
8781
run: cargo test --all-features
82+
83+
feature-test:
84+
name: Test feature matrix
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
- uses: dtolnay/rust-toolchain@master
89+
with:
90+
toolchain: ${{ matrix.rust.version }}
91+
- uses: Swatinem/rust-cache@v2
92+
with:
93+
key: features-test
94+
- name: Install cargo-all-features
95+
uses: baptiste0928/[email protected]
96+
with:
97+
crate: cargo-all-features
98+
99+
- name: Test all features
100+
run: cargo test-all-features
101+
88102
ffi:
89103
name: Test FFI (${{ matrix.rust.name }}, ${{ matrix.os }})
90104
strategy:
@@ -122,4 +136,3 @@ jobs:
122136
key: docs
123137
- name: Generate documentation
124138
run: cargo doc -v --document-private-items --all-features
125-

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ compiled_data = ["tzdb"]
7373
sys = ["std", "dep:web-time"]
7474
tzdb = ["dep:tzif", "std", "dep:jiff-tzdb", "dep:combine"]
7575
std = []
76+
77+
[package.metadata.cargo-all-features]
78+
denylist = ["default"]
79+
max_combination_size = 4

src/builtins/compiled/now.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#![cfg(feature = "sys")]
2+
13
use crate::builtins::{
24
core::{Now, PlainDate, PlainDateTime, PlainTime},
35
TZ_PROVIDER,
46
};
57
use crate::sys;
68
use crate::{time::EpochNanoseconds, TemporalError, TemporalResult, TimeZone};
79

8-
#[cfg(feature = "sys")]
910
impl Now {
1011
/// Returns the current system time as a [`PlainDateTime`] with an optional
1112
/// [`TimeZone`].

src/builtins/core/now.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ impl Now {
178178
}
179179
}
180180

181-
#[cfg(all(feature = "tzdb", feature = "sys"))]
182-
#[cfg(test)]
181+
#[cfg(all(test, feature = "tzdb", feature = "sys", feature = "compiled_data"))]
183182
mod tests {
184183
use crate::builtins::core::Now;
185184
use std::thread;

0 commit comments

Comments
 (0)