Skip to content

Commit

Permalink
Merge pull request #403 from moka-rs/fix-ci/2024-02-10/v09
Browse files Browse the repository at this point in the history
 CI: Fix the CI (remove Skeptic etc.) for v0.9.x
  • Loading branch information
tatsuya6502 authored Feb 12, 2024
2 parents 426feac + 4bfa241 commit 53f8a4b
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 47 deletions.
File renamed without changes.
3 changes: 1 addition & 2 deletions .ci_extras/pin-crate-vers-msrv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -eux

# Pin some dependencies to specific versions for the MSRV.
cargo update -p dashmap --precise 5.4.0
cargo update -p ahash --precise 0.8.7
cargo update -p tempfile --precise 3.6.0
cargo update -p tokio --precise 1.29.1
cargo update -p async-global-executor --precise 2.3.1
Expand All @@ -14,7 +15,6 @@ cargo update -p regex --precise 1.9.6
cargo update -p memchr --precise 2.6.2
cargo update -p h2 --precise 0.3.20
cargo update -p actix-rt --precise 2.8.0
cargo update -p cargo-platform --precise 0.1.5
cargo update -p crossbeam-epoch --precise 0.9.15

# To use memchr 2.5.0, we need to use regex 1.9.4 and regex-automata 0.3.7.
Expand All @@ -24,6 +24,5 @@ cargo update -p regex-automata --precise 0.3.7
# The following crates require rustc to support target feature "neon",
# which is unstable in Rust 1.60.0.
cargo update -p aho-corasick --precise 1.0.5
cargo update -p bytecount --precise 0.6.3
cargo update -p memchr --precise 2.5.0
cargo update -p value-bag --precise 1.4.1
4 changes: 4 additions & 0 deletions .ci_extras/pin-crate-vers-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ set -eux
cargo update -p openssl --precise 0.10.39
cargo update -p cc --precise 1.0.61
cargo update -p proc-macro2 --precise 1.0.63
cargo update -p parking_lot_core --precise 0.9.3
cargo update -p dashmap --precise 5.4.0
# 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
17 changes: 1 addition & 16 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 @@ -42,21 +42,6 @@ jobs:
with:
toolchain: ${{ matrix.rust }}

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

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

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

- name: Run compile error tests (sync, future and dash features, trybuild)
if: ${{ matrix.rust == 'stable' }}
run: cargo test ui_trybuild --release --features 'sync, future, dash'
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"Deques",
"devcontainer",
"docsrs",
"doctest",
"doctests",
"Einziger",
"else's",
"Eytan",
Expand Down
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,11 @@ env_logger = "0.9"
getrandom = "0.2"
paste = "1.0.9"
reqwest = "0.11.11"
skeptic = "0.13"
tokio = { version = "1.19", features = ["fs", "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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,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 \
--no-default-features --features future
$ RUSTFLAGS='--cfg trybuild' cargo test --no-default-features --features future
```

**Generating the Doc**
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() {}
2 changes: 1 addition & 1 deletion src/dash/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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
4 changes: 2 additions & 2 deletions src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,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 @@ -3007,7 +3007,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 @@ -218,3 +218,10 @@ mod tests {
t.compile_fail("tests/compile_tests/future/clone/*.rs");
}
}

#[cfg(all(doctest, feature = "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/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2940,7 +2940,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 @@ -3079,7 +3079,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 @@ -729,8 +729,8 @@ where
seg_max_capacity,
seg_init_capacity,
build_hasher.clone(),
weigher.as_ref().map(Arc::clone),
eviction_listener.as_ref().map(Arc::clone),
weigher.clone(),
eviction_listener.clone(),
eviction_listener_conf.clone(),
time_to_live,
time_to_idle,
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 @@ -73,7 +73,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
3 changes: 3 additions & 0 deletions src/unsync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,9 @@ where
break;
}

// clippy::map_clone will give us a false positive warning here.
// Version: clippy 0.1.77 (f2048098a1c 2024-02-09) in Rust 1.77.0-beta.2
#[allow(clippy::map_clone)]
let key = probation
.peek_front()
.map(|node| Rc::clone(&node.element.key));
Expand Down
2 changes: 0 additions & 2 deletions tests/skeptic.rs

This file was deleted.

0 comments on commit 53f8a4b

Please sign in to comment.