Skip to content

fix(metrics): saturating sum_us in OpHistogram to prevent u64 overflow #163

fix(metrics): saturating sum_us in OpHistogram to prevent u64 overflow

fix(metrics): saturating sum_us in OpHistogram to prevent u64 overflow #163

Workflow file for this run

name: CI
permissions:
contents: read
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
# === Compile once, share artifacts to all check jobs ===
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install deps
run: bash tests/e2e/common/install-linux-deps.sh standard "" yes no
- name: Build workspace (debug) + test binaries
run: |
cargo build --workspace
cargo test --no-run --workspace 2>/dev/null || echo "(test compile skipped — incremental ok)"
- name: Build mntrs-csi (debug)
run: cargo build --package mntrs-csi
- name: Build workspace (release) + test binaries
run: |
if cargo build --release --workspace --features hdfs-jni 2>/dev/null; then
cargo test --no-run --release --workspace --features hdfs-jni 2>/dev/null || echo "(hdfs-jni test compile skipped)"
else
cargo build --release --workspace
cargo test --no-run --release --workspace 2>/dev/null || echo "(release test compile skipped)"
fi
- name: Build mntrs-csi (release)
run: cargo build --release -p mntrs-csi
# Upload only the directories cargo needs for incremental
# re-use: fingerprints (tells cargo what's already compiled),
# deps (pre-built rlibs/so's), and binaries + test binaries.
# Skipping incremental/ (.o files, ~70% of size) keeps the
# artifact under 500 MB.
- name: Package target/debug artifacts
run: |
tar czf /tmp/target-debug.tar.gz -C target/debug \
.fingerprint deps build mntrs mntrs-csi \
core_fs_unit_test fuse_integration_test \
libmntrs*.rlib libmntrs*.so libmntrs*.d \
2>/dev/null || echo "(partial tar — ok for incremental)"
- name: Upload target/debug
uses: actions/upload-artifact@v4
with:
name: target-debug
path: /tmp/target-debug.tar.gz
retention-days: 1
- name: Package target/release artifacts
run: |
tar czf /tmp/target-release.tar.gz -C target/release \
.fingerprint deps build mntrs mntrs-csi \
hdfs_integration_test core_fs_unit_test fuse_integration_test \
libmntrs*.rlib libmntrs*.so libmntrs*.d \
2>/dev/null || echo "(partial tar — ok for incremental)"
- name: Upload target/release
uses: actions/upload-artifact@v4
with:
name: target-release
path: /tmp/target-release.tar.gz
retention-days: 1
# === Matrix: test / clippy / fmt / hdfs-jni / csi-sanity ===
check:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
task:
- test
- clippy
- fmt
- hdfs-jni
- csi-sanity
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Install deps
run: bash tests/e2e/common/install-linux-deps.sh standard "" yes no
- name: Download target/debug
uses: actions/download-artifact@v4
with:
name: target-debug
- name: Extract target/debug
run: mkdir -p target/debug && tar xzf target-debug.tar.gz -C target/debug && rm target-debug.tar.gz
- name: Download target/release
uses: actions/download-artifact@v4
with:
name: target-release
- name: Extract target/release
run: mkdir -p target/release && tar xzf target-release.tar.gz -C target/release && rm target-release.tar.gz
- name: Test (lib)
if: matrix.task == 'test'
run: cargo test --workspace --lib
- name: Clippy
if: matrix.task == 'clippy'
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Format check
if: matrix.task == 'fmt'
run: cargo fmt --all -- --check
- name: HDFS JNI (build + test + clippy)
if: matrix.task == 'hdfs-jni'
run: |
sudo apt-get update && sudo apt-get install -y default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java
JVM_LIB=$(find /usr/lib/jvm -name "libjvm.so" | head -1)
if [ -n "$JVM_LIB" ]; then
export LD_LIBRARY_PATH=$(dirname "$JVM_LIB"):${LD_LIBRARY_PATH:-}
fi
cargo build --release --features hdfs-jni
cargo test --test hdfs_integration_test --features hdfs-jni
- name: CSI sanity test
if: matrix.task == 'csi-sanity'
run: |
cargo build --release -p mntrs-csi
# Download csi-sanity
CSI_SANITY=""
if go install github.com/kubernetes-csi/csi-test/v5/cmd/csi-sanity@latest; then
CSI_SANITY="$(go env GOPATH)/bin/csi-sanity"
elif curl -sSL https://github.com/kubernetes-csi/csi-test/releases/download/v5.3.1/csi-sanity-v5.3.1-linux-amd64.tar.gz | tar xz; then
CSI_SANITY="./csi-sanity"
fi
[ -x "$CSI_SANITY" ] || { echo "::error::csi-sanity not available"; exit 1; }
cat > /tmp/csi-test-params.yaml << 'YAML'
storage: "memory://"
readOnly: "true"
YAML
./target/release/mntrs-csi --endpoint unix:///tmp/csi.sock &
CSI_PID=$!
sleep 3
"$CSI_SANITY" --csi.endpoint=unix:///tmp/csi.sock \
--csi.testvolumeparameters=/tmp/csi-test-params.yaml \
--ginkgo.focus='NodePublishVolume|NodeUnpublishVolume|GetPluginInfo|Probe' \
--ginkgo.skip='remove target path' \
2>&1
CSI_EXIT=$?
if [ $CSI_EXIT -ne 0 ]; then
echo "::warning::csi-sanity exited $CSI_EXIT (known: CSI driver unimplemented methods)"
fi
kill $CSI_PID