diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index f68de176..00000000 --- a/.cirrus.yml +++ /dev/null @@ -1,88 +0,0 @@ -env: - # This cfg will prevent to run tests requiring large memory (~8GiB) - RUSTFLAGS: --cfg circleci - NUM_CPUS: "2" - -linux_arm64_task: - # Run only when triggered manually or by cron. - # - # Note that the cron schedule is set from Cirrus CI web console (not in this file): - # See: https://cirrus-ci.org/guide/writing-tasks/#cron-builds - trigger_type: manual - - # Skip the whole task when this is a temporary branch for GitHub merge queue. - skip: $CIRRUS_BRANCH =~ 'gh-readonly-queue/.*' - - arm_container: - cpu: $NUM_CPUS - matrix: - - image: rust:slim # docker's official latest rust stable version - ## Disable jobs for nightly and the MSRV to avoid to hit the concurrency limit. - # - image: rustlang/rust:nightly-slim # nightly hosted by rustlang - # - image: rust:1.65.0-slim # MSRV - # no rust-beta image found in docker hub, won't be tested - - ## Disable caching as there is no Cargo.lock file in Moka repository. - # registry_cache: - # folder: $CARGO_HOME/registry - # fingerprint_script: cat Cargo.lock - # target_cache: - # folder: target - # fingerprint_script: - # - rustc --version - # - cat Cargo.lock - - # Install dependencies (native libraries) - setup_script: - - apt-get update - - apt-get install -y libssl-dev pkg-config - - show_cpu_info_script: | - nproc - lscpu - - # Show Rust version - check_version_script: rustc -Vv - - # Downgrade dependencies to minimal versions (Nightly only) - # downgrade_deps_script: | - # # The nightly image has no RUST_VERSION set - # if [ -z "$RUST_VERSION" ]; then - # echo 'Downgrading dependencies to minimal versions' - # else - # echo 'Skipped' - # fi - - # Pin some dependencies to specific versions (MSRV only) - # pin_deps_script: | - # if [ "v$RUST_VERSION" == "v1.65.0" ]; then - # echo 'Pinning some dependencies to specific versions' - # cargo update -p --precise - # else - # echo 'Skipped' - # fi - - test_script: - # Run tests (debug, sync feature) - - cargo test -j 1 --lib --features sync -- --test-threads=$NUM_CPUS - - # Run tests (release, sync feature) - - cargo test -j 1 --release --features sync -- --test-threads=$NUM_CPUS - - # Run tests (sync feature, key lock test for notification) - - cargo test --release --lib --features sync sync::cache::tests::test_key_lock_used_by_immediate_removal_notifications -- --exact --ignored - - # Run tests (sync feature, drop value after eviction for sync::Cache) - - cargo test --release --lib --features sync sync::cache::tests::drop_value_immediately_after_eviction -- --exact --ignored - - # Run tests (sync feature, drop value after eviction for sync::SegmentedCache) - - cargo test --release --lib --features sync sync::segment::tests::drop_value_immediately_after_eviction -- --exact --ignored - - # Run tests (future feature, but no sync feature) - - cargo test -j 1 --no-default-features --features 'future, atomic64, quanta' -- --test-threads=$NUM_CPUS - - # Run tests (future, sync and logging features) - - cargo test -j 1 --features 'future, sync, logging' -- --test-threads=$NUM_CPUS - - # before_cache_script: - # - rm -rf $CARGO_HOME/registry/index diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 75513740..4fda567d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -46,11 +46,12 @@ jobs: - name: Checkout Moka uses: actions/checkout@v4 - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources - # 2-core CPU (x86_64), 7 GB of RAM + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories + # x86_64, 4 vCPUs, 16 GB RAM - name: Show CPU into run: | - nproc + echo "nproc: $(nproc)" + free -m lscpu - name: Install Rust toolchain diff --git a/.github/workflows/CIArm64.yml b/.github/workflows/CIArm64.yml new file mode 100644 index 00000000..b9ad71e2 --- /dev/null +++ b/.github/workflows/CIArm64.yml @@ -0,0 +1,89 @@ +name: CI (Linux Arm64) + +on: + push: + paths-ignore: + - '.devcontainer/**' + - '.gitpod.yml' + - '.vscode/**' + pull_request: + paths-ignore: + - '.devcontainer/**' + - '.gitpod.yml' + - '.vscode/**' + schedule: + # Run against the last commit on the default branch on Friday at 8pm (UTC?) + - cron: '0 20 * * 5' + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + # https://github.com/marketplace/actions/skip-duplicate-actions + uses: fkirc/skip-duplicate-actions@v5 + with: + concurrent_skipping: 'same_content' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + + test: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + + # Runs on AWS Graviton (arm64) runner at AWS CodeBuild. + # https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html + # https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html + # arm64, 4 vCPUs, 8 GB RAM + runs-on: codebuild-moka-arm64-runner-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-medium + + steps: + - name: Checkout Moka + uses: actions/checkout@v4 + + - name: Show CPU into + run: | + echo "nproc: $(nproc)" + free -m + lscpu + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Show cargo tree + run: cargo tree --features 'sync, future' + + - name: Run tests (debug, sync feature) + run: cargo test --features sync + env: + RUSTFLAGS: '--cfg rustver --cfg skip_large_mem_tests' + + - name: Run tests (release, sync feature) + run: cargo test --release --features sync + env: + RUSTFLAGS: '--cfg rustver --cfg skip_large_mem_tests' + + - name: Run tests (sync feature, key lock test for notification) + run: cargo test --release --lib --features sync sync::cache::tests::test_key_lock_used_by_immediate_removal_notifications -- --exact --ignored + + - name: Run tests (sync feature, drop value after eviction for sync::Cache) + run: cargo test --release --lib --features sync sync::cache::tests::drop_value_immediately_after_eviction -- --exact --ignored + + - name: Run tests (sync feature, drop value after eviction for sync::SegmentedCache) + run: cargo test --release --lib --features sync sync::segment::tests::drop_value_immediately_after_eviction -- --exact --ignored + + - name: Run tests (sync feature, drop cache) + run: cargo test --release --lib --features sync sync::cache::tests::ensure_gc_runs_when_dropping_cache -- --exact --ignored + + - name: Run tests (future feature, but no sync feature) + run: cargo test --no-default-features --features 'future, atomic64, quanta' + env: + RUSTFLAGS: '--cfg skip_large_mem_tests' + + - name: Run tests (future, sync and logging features) + run: cargo test --features 'future, sync, logging' + env: + RUSTFLAGS: '--cfg skip_large_mem_tests' diff --git a/.github/workflows/Kani.yml b/.github/workflows/Kani.yml index 0c47f6a8..59c0bff2 100644 --- a/.github/workflows/Kani.yml +++ b/.github/workflows/Kani.yml @@ -39,9 +39,9 @@ jobs: - name: Show CPU into run: | - nproc - lscpu + echo "nproc: $(nproc)" free -m + lscpu - name: Pin some dependencies to specific versions run: ./.ci_extras/pin-crate-vers-kani.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index 6cdda843..c9ae44b0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,6 @@ "benmanes", "cfgs", "CHECKME", - "circleci", "CLFU", "clippy", "Codecov", diff --git a/Cargo.toml b/Cargo.toml index b89c67a6..3e4a3c8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/moka-rs/moka" keywords = ["cache", "concurrent"] categories = ["caching", "concurrency"] readme = "README.md" -exclude = [".circleci", ".cirrus.yml", ".devcontainer", ".github", ".gitpod.yml", ".vscode"] +exclude = [".devcontainer", ".github", ".gitpod.yml", ".vscode"] build = "build.rs" [features] diff --git a/build.rs b/build.rs index e99050f6..b82d02a6 100644 --- a/build.rs +++ b/build.rs @@ -3,10 +3,10 @@ const ALLOWED_CFG_NAMES: &[&str] = &[ "armv5te", "beta_clippy", - "circleci", "kani", "mips", "rustver", + "skip_large_mem_tests", "trybuild", ]; diff --git a/src/cht/segment.rs b/src/cht/segment.rs index 6d00efc1..7bd301bb 100644 --- a/src/cht/segment.rs +++ b/src/cht/segment.rs @@ -1393,14 +1393,10 @@ mod tests { NUM_VALUES - key_parents.iter().filter(|k| k.was_dropped()).count(); let bucket_array_len = map.capacity() * 2; assert_eq!(bucket_array_len, map.num_segments() * 128 * 2); - if !cfg!(circleci) { - // TODO: FIXME: These assertions sometimes fail when cargo tarpaulin - // is used on Circle CI. - assert!(live_key_count <= bucket_array_len / 10); + assert!(live_key_count <= bucket_array_len / 10); - for this_value_parent in value_parents.iter() { - assert!(this_value_parent.was_dropped()); - } + for this_value_parent in value_parents.iter() { + assert!(this_value_parent.was_dropped()); } for i in 0..NUM_VALUES { diff --git a/src/future/base_cache.rs b/src/future/base_cache.rs index 4881cd2b..f495bba1 100644 --- a/src/future/base_cache.rs +++ b/src/future/base_cache.rs @@ -2954,8 +2954,7 @@ mod tests { ensure_sketch_len(pot16 + 1, pot(17), "pot16 + 1").await; // The following tests will allocate large memory (~8GiB). - // Skip when running on Circle CI. - if !cfg!(circleci) { + if !cfg!(skip_large_mem_tests) { // due to ceiling to next_power_of_two ensure_sketch_len(pot30 - 1, pot30, "pot30- 1").await; ensure_sketch_len(pot30, pot30, "pot30").await; diff --git a/src/sync_base/base_cache.rs b/src/sync_base/base_cache.rs index 3d68de2d..64468479 100644 --- a/src/sync_base/base_cache.rs +++ b/src/sync_base/base_cache.rs @@ -2682,8 +2682,7 @@ mod tests { ensure_sketch_len(pot16 + 1, pot(17), "pot16 + 1"); // The following tests will allocate large memory (~8GiB). - // Skip when running on Circle CI. - if !cfg!(circleci) { + if !cfg!(skip_large_mem_tests) { // due to ceiling to next_power_of_two ensure_sketch_len(pot30 - 1, pot30, "pot30- 1"); ensure_sketch_len(pot30, pot30, "pot30");