From 590ffdf41921b8f5be6cf44f52174c4d41b4a73d Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sat, 13 Jul 2024 22:54:44 +0800 Subject: [PATCH 1/5] CI: Remove the settings for Cirrus CI --- .cirrus.yml | 88 ----------------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 .cirrus.yml 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 From ad7eedc04c2f864a0e747c10d1012fa053301bfb Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sat, 13 Jul 2024 22:57:40 +0800 Subject: [PATCH 2/5] CI: Add GH Actions job that runs on AWS Graviton (arm64) at AWS CodeBuild --- .github/workflows/CIArm64.yml | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/CIArm64.yml diff --git a/.github/workflows/CIArm64.yml b/.github/workflows/CIArm64.yml new file mode 100644 index 00000000..bff664f7 --- /dev/null +++ b/.github/workflows/CIArm64.yml @@ -0,0 +1,85 @@ +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 + runs-on: codebuild-moka-arm64-runner-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-medium + + steps: + - 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 + - name: Show CPU into + run: | + nproc + 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' + + - name: Run tests (release, sync feature) + run: cargo test --release --features sync + env: + RUSTFLAGS: '--cfg rustver' + + - 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' + + - name: Run tests (future, sync and logging features) + run: cargo test --features 'future, sync, logging' From c8db0a10b500cb9bbc897eda41a593af2235cc70 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sat, 13 Jul 2024 23:14:29 +0800 Subject: [PATCH 3/5] CI: Skip tests requiring large memory on AWS Graviton (arm64) --- .github/workflows/CI.yml | 3 ++- .github/workflows/CIArm64.yml | 11 ++++++++--- .github/workflows/Kani.yml | 4 ++-- .vscode/settings.json | 1 - Cargo.toml | 2 +- build.rs | 2 +- src/cht/segment.rs | 10 +++------- src/future/base_cache.rs | 3 +-- src/sync_base/base_cache.rs | 3 +-- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 75513740..3f5e7104 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,7 +50,8 @@ jobs: # 2-core CPU (x86_64), 7 GB of 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 index bff664f7..c7dc5348 100644 --- a/.github/workflows/CIArm64.yml +++ b/.github/workflows/CIArm64.yml @@ -45,7 +45,8 @@ jobs: # 2-core CPU (x86_64), 7 GB of RAM - name: Show CPU into run: | - nproc + echo "nproc: $(nproc)" + free -m lscpu - name: Install Rust toolchain @@ -59,12 +60,12 @@ jobs: - name: Run tests (debug, sync feature) run: cargo test --features sync env: - RUSTFLAGS: '--cfg rustver' + RUSTFLAGS: '--cfg rustver --cfg skip_large_mem_tests' - name: Run tests (release, sync feature) run: cargo test --release --features sync env: - RUSTFLAGS: '--cfg rustver' + 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 @@ -80,6 +81,10 @@ jobs: - 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"); From ed070deb694ace05b754b106cfd87727b8ff74e0 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 14 Jul 2024 05:27:20 +0800 Subject: [PATCH 4/5] CI: Try a smaller EC2 instance for AWS CodeBuild --- .github/workflows/CIArm64.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/CIArm64.yml b/.github/workflows/CIArm64.yml index c7dc5348..22562e5d 100644 --- a/.github/workflows/CIArm64.yml +++ b/.github/workflows/CIArm64.yml @@ -35,14 +35,12 @@ jobs: # 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 - runs-on: codebuild-moka-arm64-runner-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-medium + runs-on: codebuild-moka-arm64-runner-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-small steps: - 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 - name: Show CPU into run: | echo "nproc: $(nproc)" From 1636ed9aba4ebf2be7af5ce1b20e40e71d8b27dc Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 14 Jul 2024 06:12:34 +0800 Subject: [PATCH 5/5] CI: Use `arm-3.0-medium` EC2 instance (4 vCPU, 8 GB RAM) for AWS CodeBuild --- .github/workflows/CI.yml | 4 ++-- .github/workflows/CIArm64.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3f5e7104..4fda567d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -46,8 +46,8 @@ 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: | echo "nproc: $(nproc)" diff --git a/.github/workflows/CIArm64.yml b/.github/workflows/CIArm64.yml index 22562e5d..b9ad71e2 100644 --- a/.github/workflows/CIArm64.yml +++ b/.github/workflows/CIArm64.yml @@ -35,7 +35,8 @@ jobs: # 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 - runs-on: codebuild-moka-arm64-runner-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-small + # 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