Skip to content

Commit

Permalink
Merge pull request #442 from moka-rs/ci-aws-codebuild-arm64
Browse files Browse the repository at this point in the history
CI: Replace Cirrus CI with paid AWS CodeBuild for Linux arm64 testing
  • Loading branch information
tatsuya6502 authored Jul 13, 2024
2 parents 8fe161a + 1636ed9 commit 56cf794
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 107 deletions.
88 changes: 0 additions & 88 deletions .cirrus.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/CIArm64.yml
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions .github/workflows/Kani.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"benmanes",
"cfgs",
"CHECKME",
"circleci",
"CLFU",
"clippy",
"Codecov",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
const ALLOWED_CFG_NAMES: &[&str] = &[
"armv5te",
"beta_clippy",
"circleci",
"kani",
"mips",
"rustver",
"skip_large_mem_tests",
"trybuild",
];

Expand Down
10 changes: 3 additions & 7 deletions src/cht/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/future/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/sync_base/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 56cf794

Please sign in to comment.