Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix the CI (remove Skeptic etc.) for v0.12.x #399

Merged
merged 4 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci_extras/pin-crate-vers-msrv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -eux

# Pin some dependencies to specific versions for the MSRV.
cargo update -p cargo-platform --precise 0.1.5
# cargo update -p <crate> --precise <version>
2 changes: 2 additions & 0 deletions .ci_extras/pin-crate-vers-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ set -eux

# Pin some dependencies to specific versions for the nightly toolchain.
cargo update -p proc-macro2 --precise 1.0.63
# https://github.com/tkaitchuck/aHash/issues/200
cargo update -p ahash --precise 0.8.7
7 changes: 3 additions & 4 deletions .github/workflows/Lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
# Continue running other jobs in the matrix even if one fails.
fail-fast: false
matrix:
rust:
- toolchain: stable
Expand All @@ -45,10 +47,7 @@ jobs:
components: rustfmt, clippy

- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --lib --tests --all-features --all-targets -- -D warnings
run: cargo clippy --lib --tests --all-features --all-targets -- -D warnings
env:
RUSTFLAGS: ${{ matrix.rust.rustflags }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/LinuxCrossCompileTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Remove integration tests and force enable rustc_version crate
run: |
rm -rf tests
sed -i '/actix-rt\|async-std\|reqwest\|skeptic/d' Cargo.toml
sed -i '/actix-rt\|async-std\|reqwest/d' Cargo.toml
sed -i 's/target.*rustver.*\.//' Cargo.toml
sed -i 's/build = "build.rs"/build = ".ci_extras\/build_linux_cross.rs"/' Cargo.toml
cat Cargo.toml
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/Skeptic.yml → .github/workflows/Trybuild.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Skeptic and Trybuild
name: Trybuild

on:
push:
Expand Down Expand Up @@ -28,6 +28,8 @@ jobs:
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
# Continue running other jobs in the matrix even if one fails.
fail-fast: false
matrix:
rust:
- stable
Expand All @@ -41,22 +43,6 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy

- name: Run tests (sync feature)
run: cargo test --release --features sync
env:
RUSTFLAGS: '--cfg skeptic'

- name: Run tests (release, sync and future)
run: cargo test --release --features 'sync, future'
env:
RUSTFLAGS: '--cfg skeptic'

- name: Run tests (sync and future, without atomic64 and quanta)
run: cargo test --release --no-default-features --features 'sync, future'
env:
RUSTFLAGS: '--cfg skeptic'

- name: Run compile error tests (sync and future features, trybuild)
if: ${{ matrix.rust == 'stable' }}
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"Descheduled",
"devcontainer",
"docsrs",
"doctest",
"doctests",
"Einziger",
"else's",
"ENHANCEME",
Expand Down
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,11 @@ env_logger = "0.10.0"
getrandom = "0.2"
paste = "1.0.9"
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls"] }
skeptic = "0.13"
tokio = { version = "1.19", features = ["fs", "io-util", "macros", "rt-multi-thread", "sync", "time" ] }

[target.'cfg(trybuild)'.dev-dependencies]
trybuild = "1.0"

[target.'cfg(skeptic)'.build-dependencies]
skeptic = "0.13.5"

[target.'cfg(rustver)'.build-dependencies]
rustc_version = "0.4.0"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@ To run all tests including `future` feature and doc tests on the README, use the
following command:

```console
$ RUSTFLAGS='--cfg skeptic --cfg trybuild' cargo test --all-features
$ RUSTFLAGS='--cfg trybuild' cargo test --all-features
```

**Running All Tests without Default Features**

```console
$ RUSTFLAGS='--cfg skeptic --cfg trybuild' cargo test \
$ RUSTFLAGS='--cfg trybuild' cargo test \
--no-default-features --features 'future, sync'
```

Expand Down
8 changes: 1 addition & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#[cfg(skeptic)]
fn main() {
// generates doc tests for `README.md`.
skeptic::generate_doc_tests(&["README.md"]);
}

#[cfg(rustver)]
fn main() {
use rustc_version::version;
Expand All @@ -14,5 +8,5 @@ fn main() {
);
}

#[cfg(not(any(skeptic, rustver)))]
#[cfg(not(rustver))]
fn main() {}
12 changes: 10 additions & 2 deletions src/common/timer_wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,13 @@ pub(crate) enum TimerEvent<K> {
// This cache entry has been rescheduled. Rescheduling includes moving a timer
// from one wheel to another in a lower level of the hierarchy. (This variant
// is mainly used for testing)
#[cfg(test)]
Rescheduled(TrioArc<EntryInfo<K>>),
#[cfg(not(test))]
Rescheduled(()),
/// This timer node (containing a cache entry) has been removed from the timer.
/// (This variant is mainly used for testing)
Descheduled(Box<DeqNode<TimerNode<K>>>),
Descheduled,
}

/// An iterator over expired cache entries.
Expand Down Expand Up @@ -509,15 +512,20 @@ impl<'iter, K> Iterator for TimerEventsIter<'iter, K> {
// The cache entry has not expired. Reschedule it.
let node_p = NonNull::new(Box::into_raw(node)).expect("Got a null ptr");
match self.timer_wheel.schedule_existing_node(node_p) {
#[cfg(test)]
ReschedulingResult::Rescheduled => {
let entry_info = unsafe { node_p.as_ref() }.element.entry_info();
return Some(TimerEvent::Rescheduled(TrioArc::clone(entry_info)));
}
#[cfg(not(test))]
ReschedulingResult::Rescheduled => {
return Some(TimerEvent::Rescheduled(()));
}
ReschedulingResult::Removed(node) => {
// The timer event has been removed from the timer
// wheel. Unset the timer node from the ValueEntry.
node.as_ref().element.unset_timer_node_in_deq_nodes();
return Some(TimerEvent::Descheduled(node));
return Some(TimerEvent::Descheduled);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/future/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<K, V, S> Clone for BaseCache<K, V, S> {
write_op_ch: self.write_op_ch.clone(),
interrupted_op_ch_snd: self.interrupted_op_ch_snd.clone(),
interrupted_op_ch_rcv: self.interrupted_op_ch_rcv.clone(),
housekeeper: self.housekeeper.as_ref().map(Arc::clone),
housekeeper: self.housekeeper.clone(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3916,7 +3916,7 @@ mod tests {
// Note that MyError does not implement std::error::Error trait
// like anyhow::Error.
#[derive(Debug)]
pub struct MyError(String);
pub struct MyError(#[allow(dead_code)] String);

type MyResult<T> = Result<T, Arc<MyError>>;

Expand Down Expand Up @@ -4053,7 +4053,7 @@ mod tests {
// Note that MyError does not implement std::error::Error trait
// like anyhow::Error.
#[derive(Debug)]
pub struct MyError(String);
pub struct MyError(#[allow(dead_code)] String);

type MyResult<T> = Result<T, Arc<MyError>>;

Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,10 @@ mod tests {
t.compile_fail("tests/compile_tests/future/clone/*.rs");
}
}

#[cfg(all(doctest, sync))]
mod doctests {
// https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#include-items-only-when-collecting-doctests
#[doc = include_str!("../README.md")]
struct ReadMeDoctests;
}
4 changes: 2 additions & 2 deletions src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl<K, V> Clone for ExpirationPolicy<K, V> {
Self {
time_to_live: self.time_to_live,
time_to_idle: self.time_to_idle,
expiry: self.expiry.as_ref().map(Arc::clone),
expiry: self.expiry.clone(),
}
}
}
Expand Down Expand Up @@ -337,7 +337,7 @@ impl<K, V> ExpirationPolicy<K, V> {
}

pub(crate) fn expiry(&self) -> Option<Arc<dyn Expiry<K, V> + Send + Sync + 'static>> {
self.expiry.as_ref().map(Arc::clone)
self.expiry.clone()
}

pub(crate) fn set_expiry(&mut self, expiry: Arc<dyn Expiry<K, V> + Send + Sync + 'static>) {
Expand Down
4 changes: 2 additions & 2 deletions src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3556,7 +3556,7 @@ mod tests {
// Note that MyError does not implement std::error::Error trait like
// anyhow::Error.
#[derive(Debug)]
pub struct MyError(String);
pub struct MyError(#[allow(dead_code)] String);

type MyResult<T> = Result<T, Arc<MyError>>;

Expand Down Expand Up @@ -3697,7 +3697,7 @@ mod tests {
// Note that MyError does not implement std::error::Error trait like
// anyhow::Error.
#[derive(Debug)]
pub struct MyError(String);
pub struct MyError(#[allow(dead_code)] String);

type MyResult<T> = Result<T, Arc<MyError>>;

Expand Down
4 changes: 2 additions & 2 deletions src/sync/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,9 @@ where
seg_max_capacity,
seg_init_capacity,
build_hasher.clone(),
weigher.as_ref().map(Arc::clone),
weigher.clone(),
eviction_policy.clone(),
eviction_listener.as_ref().map(Arc::clone),
eviction_listener.clone(),
expiration_policy.clone(),
invalidator_enabled,
)
Expand Down
2 changes: 1 addition & 1 deletion src/sync_base/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<K, V, S> Clone for BaseCache<K, V, S> {
inner: Arc::clone(&self.inner),
read_op_ch: self.read_op_ch.clone(),
write_op_ch: self.write_op_ch.clone(),
housekeeper: self.housekeeper.as_ref().map(Arc::clone),
housekeeper: self.housekeeper.clone(),
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests/skeptic.rs

This file was deleted.

Loading