feat(repository): add metrics repository framework with CI optimizations #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| # Prevent concurrent builds from the same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Minimal permissions by default | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: -D warnings | |
| CARGO_INCREMENTAL: 0 # Disable for CI (faster clean builds) | |
| CARGO_BUILD_JOBS: 8 # Increased for better parallelization | |
| RUST_TEST_THREADS: 8 # Match available cores | |
| RUST_BACKTRACE: 1 | |
| CARGO_NET_RETRY: 10 | |
| CARGO_NET_GIT_FETCH_WITH_CLI: true | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| os: [blacksmith-8vcpu-ubuntu-2404] # Upgraded for more cores | |
| rust: [stable, 1.70.0] | |
| max-parallel: 4 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| cache-key: "cache-unit-${{ runner.os }}-${{ matrix.rust }}" | |
| - name: Install nextest | |
| run: | | |
| curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin | |
| cargo nextest --version | |
| - name: Run unit tests | |
| run: cargo nextest run --lib --all-features --profile ci | |
| - name: Run doc tests | |
| run: cargo test --doc | |
| integration-tests: | |
| name: Integration Tests (Group ${{ matrix.group }}) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| os: [blacksmith-16vcpu-ubuntu-2404] # More cores for heavy integration tests | |
| rust: [stable, 1.70.0] | |
| group: [1, 2, 3, 4, 5] # Split tests into 5 parallel groups for better distribution | |
| max-parallel: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| cache-key: "cache-integration-${{ runner.os }}-${{ matrix.rust }}-${{ matrix.group }}" | |
| - name: Install nextest | |
| run: | | |
| curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin | |
| cargo nextest --version | |
| - name: Run integration tests (Group 1) | |
| if: matrix.group == 1 | |
| run: | | |
| cargo nextest run --test analysis_runner_integration --all-features --profile ci | |
| cargo nextest run --test analyzer_integration_tests --all-features --profile ci | |
| cargo nextest run --test anomaly_detection_integration --all-features --profile ci | |
| cargo nextest run --test approx_count_distinct_integration --all-features --profile ci | |
| cargo nextest run --test builder_extensions_test --all-features --profile ci | |
| cargo nextest run --test cloud_storage_test --all-features --profile ci | |
| - name: Run integration tests (Group 2) | |
| if: matrix.group == 2 | |
| run: | | |
| cargo nextest run --test column_count_integration --all-features --profile ci | |
| cargo nextest run --test column_profiler_integration --all-features --profile ci | |
| cargo nextest run --test completeness_integration --all-features --profile ci | |
| cargo nextest run --test context_integration --all-features --profile ci | |
| cargo nextest run --test data_type_integration --all-features --profile ci | |
| cargo nextest run --test distinctness_integration --all-features --profile ci | |
| - name: Run integration tests (Group 3) | |
| if: matrix.group == 3 | |
| run: | | |
| cargo nextest run --test exact_quantile_integration --all-features --profile ci | |
| cargo nextest run --test histogram_integration --all-features --profile ci | |
| cargo nextest run --test integration_test_suite --all-features --profile ci | |
| cargo nextest run --test joined_sources_integration --all-features --profile ci | |
| cargo nextest run --test metrics_test --all-features --profile ci | |
| cargo nextest run --test multi_source_integration --all-features --profile ci | |
| - name: Run integration tests (Group 4) | |
| if: matrix.group == 4 | |
| run: | | |
| cargo nextest run --test optimizer_integration --all-features --profile ci | |
| cargo nextest run --test performance_regression_test --all-features --profile ci | |
| cargo nextest run --test property_tests --all-features --profile ci | |
| cargo nextest run --test security_tests --all-features --profile ci | |
| cargo nextest run --test sources_integration --all-features --profile ci | |
| cargo nextest run --test repository_integration --all-features --profile ci | |
| - name: Run integration tests (Group 5) | |
| if: matrix.group == 5 | |
| run: | | |
| cargo nextest run --test string_length_integration --all-features --profile ci | |
| cargo nextest run --test structured_logging_test --all-features --profile ci | |
| cargo nextest run --test test_utils_test --all-features --profile ci | |
| cargo nextest run --test type_inference_integration --all-features --profile ci | |
| cargo nextest run --test unique_value_ratio_integration --all-features --profile ci | |
| # Feature combination tests | |
| feature-tests: | |
| name: Feature Tests | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| rust: [stable] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| cache-key: "cache-features-${{ runner.os }}-${{ matrix.rust }}" | |
| - name: Install nextest | |
| run: | | |
| curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin | |
| - name: Run tests (no default features) | |
| run: cargo nextest run --no-default-features --profile ci-quick | |
| fmt: | |
| name: Rustfmt | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: stable | |
| components: rustfmt | |
| cache-key: "cache-fmt" | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| clippy: | |
| name: Clippy | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| cache-key: "cache-clippy" | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| coverage: | |
| name: Code Coverage | |
| runs-on: blacksmith-8vcpu-ubuntu-2404 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: stable | |
| cache-key: "cache-coverage" | |
| - name: Install tarpaulin | |
| run: | | |
| cargo install cargo-tarpaulin --locked || true | |
| - name: Generate code coverage | |
| run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml --engine llvm | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./cobertura.xml | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| msrv: | |
| name: MSRV Check | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust (MSRV) | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: 1.70.0 | |
| cache-key: "cache-msrv" | |
| - name: Check MSRV | |
| run: cargo check --all-features | |
| build: | |
| name: Build Check | |
| runs-on: blacksmith-8vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: stable | |
| cache-key: "cache-build" | |
| - name: Build | |
| run: cargo build --release --all-features | |
| - name: Build benchmarks | |
| run: cargo bench --no-run | |
| integration: | |
| name: Integration Tests | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: stable | |
| cache-key: "cache-integration" | |
| - name: Run integration tests | |
| run: cargo integration |