From 8dbb1aeb5c49acc3e521312515b3a5d87e805a74 Mon Sep 17 00:00:00 2001 From: Brad Edwards Date: Sat, 11 Jan 2025 09:11:10 -0800 Subject: [PATCH] Update search for creates --- .github/workflows/ci-cs.yml | 22 +++++++++++----- .github/workflows/ci-math.yml | 22 +++++++++++----- .github/workflows/ci-ml.yml | 22 +++++++++++----- .github/workflows/ci-shared.yml | 22 +++++++++++----- .github/workflows/ci-stats.yml | 22 +++++++++++----- .github/workflows/ci.yml | 46 --------------------------------- 6 files changed, 76 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci-cs.yml b/.github/workflows/ci-cs.yml index 2e46ae9..3a430d8 100644 --- a/.github/workflows/ci-cs.yml +++ b/.github/workflows/ci-cs.yml @@ -21,18 +21,26 @@ jobs: override: true - name: Install dependencies run: sudo apt-get install lcov - - name: Run tests + - name: Run tests for implemented crates run: | - for toml in $(find crates/cs -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo test --manifest-path $toml + # First, find all implemented crates (those with src directory) + for crate_dir in crates/cs/blocks-cs-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Testing implemented crate: ${crate_dir}" + cargo test --manifest-path "${crate_dir}Cargo.toml" + else + echo "Skipping unimplemented crate: ${crate_dir}" + fi done - name: Generate coverage report run: | cargo install cargo-llvm-cov - for toml in $(find crates/cs -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info + # Only generate coverage for implemented crates + for crate_dir in crates/cs/blocks-cs-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Generating coverage for: ${crate_dir}" + cargo llvm-cov --manifest-path "${crate_dir}Cargo.toml" --lcov --output-path lcov.info + fi done - name: Check coverage run: | diff --git a/.github/workflows/ci-math.yml b/.github/workflows/ci-math.yml index 0ed38f6..d07383a 100644 --- a/.github/workflows/ci-math.yml +++ b/.github/workflows/ci-math.yml @@ -21,18 +21,26 @@ jobs: override: true - name: Install dependencies run: sudo apt-get install lcov - - name: Run tests + - name: Run tests for implemented crates run: | - for toml in $(find crates/cs -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo test --manifest-path $toml + # First, find all implemented crates (those with src directory) + for crate_dir in crates/math/blocks-math-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Testing implemented crate: ${crate_dir}" + cargo test --manifest-path "${crate_dir}Cargo.toml" + else + echo "Skipping unimplemented crate: ${crate_dir}" + fi done - name: Generate coverage report run: | cargo install cargo-llvm-cov - for toml in $(find crates/math -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info + # Only generate coverage for implemented crates + for crate_dir in crates/math/blocks-math-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Generating coverage for: ${crate_dir}" + cargo llvm-cov --manifest-path "${crate_dir}Cargo.toml" --lcov --output-path lcov.info + fi done - name: Check coverage run: | diff --git a/.github/workflows/ci-ml.yml b/.github/workflows/ci-ml.yml index 9ba3fdf..e5c5bb8 100644 --- a/.github/workflows/ci-ml.yml +++ b/.github/workflows/ci-ml.yml @@ -21,18 +21,26 @@ jobs: override: true - name: Install dependencies run: sudo apt-get install lcov - - name: Run tests + - name: Run tests for implemented crates run: | - for toml in $(find crates/ml -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo test --manifest-path $toml + # First, find all implemented crates (those with src directory) + for crate_dir in crates/ml/blocks-ml-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Testing implemented crate: ${crate_dir}" + cargo test --manifest-path "${crate_dir}Cargo.toml" + else + echo "Skipping unimplemented crate: ${crate_dir}" + fi done - name: Generate coverage report run: | cargo install cargo-llvm-cov - for toml in $(find crates/ml -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info + # Only generate coverage for implemented crates + for crate_dir in crates/ml/blocks-ml-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Generating coverage for: ${crate_dir}" + cargo llvm-cov --manifest-path "${crate_dir}Cargo.toml" --lcov --output-path lcov.info + fi done - name: Check coverage run: | diff --git a/.github/workflows/ci-shared.yml b/.github/workflows/ci-shared.yml index 9c5543c..d4be06e 100644 --- a/.github/workflows/ci-shared.yml +++ b/.github/workflows/ci-shared.yml @@ -1,4 +1,3 @@ - name: CI/CD on: @@ -22,15 +21,26 @@ jobs: override: true - name: Install dependencies run: sudo apt-get install lcov - - name: Run tests + - name: Run tests for implemented crates run: | - cargo test --manifest-path crates/cs/Cargo.toml + # First, find all implemented crates (those with src directory) + for crate_dir in crates/shared/blocks-shared-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Testing implemented crate: ${crate_dir}" + cargo test --manifest-path "${crate_dir}Cargo.toml" + else + echo "Skipping unimplemented crate: ${crate_dir}" + fi + done - name: Generate coverage report run: | cargo install cargo-llvm-cov - for toml in $(find crates/shared -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info + # Only generate coverage for implemented crates + for crate_dir in crates/shared/blocks-shared-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Generating coverage for: ${crate_dir}" + cargo llvm-cov --manifest-path "${crate_dir}Cargo.toml" --lcov --output-path lcov.info + fi done - name: Check coverage run: | diff --git a/.github/workflows/ci-stats.yml b/.github/workflows/ci-stats.yml index c52b94e..fcc3b91 100644 --- a/.github/workflows/ci-stats.yml +++ b/.github/workflows/ci-stats.yml @@ -21,18 +21,26 @@ jobs: override: true - name: Install dependencies run: sudo apt-get install lcov - - name: Run tests + - name: Run tests for implemented crates run: | - for toml in $(find crates/stats -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo test --manifest-path $toml + # First, find all implemented crates (those with src directory) + for crate_dir in crates/stats/blocks-stats-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Testing implemented crate: ${crate_dir}" + cargo test --manifest-path "${crate_dir}Cargo.toml" + else + echo "Skipping unimplemented crate: ${crate_dir}" + fi done - name: Generate coverage report run: | cargo install cargo-llvm-cov - for toml in $(find crates/stats -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info + # Only generate coverage for implemented crates + for crate_dir in crates/stats/blocks-stats-*/; do + if [ -d "${crate_dir}src" ]; then + echo "Generating coverage for: ${crate_dir}" + cargo llvm-cov --manifest-path "${crate_dir}Cargo.toml" --lcov --output-path lcov.info + fi done - name: Check coverage run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 03cdcdd..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,46 +0,0 @@ - -name: CI/CD - -on: - push: - branches: - - chore/basic-ci-cd - pull_request: - branches: - - main - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Install dependencies - run: sudo apt-get install lcov - - name: Run tests - run: | - cargo test --manifest-path crates/cs/Cargo.toml - - name: Generate coverage report - run: | - cargo install cargo-llvm-cov - for toml in $(find crates/cs -name "Cargo.toml"); do - echo "Running tests for $toml" - cargo llvm-cov --manifest-path $toml --lcov --output-path lcov.info - done - - name: Check coverage - run: | - bash <(curl -s https://codecov.io/bash) -f lcov.info - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - name: Fail if coverage is below 90% - run: | - bash <(curl -s https://codecov.io/bash) -f lcov.info - if [ $(lcov --summary lcov.info | grep -Eo '[0-9]+\.[0-9]+' | head -1) -lt 90 ]; then - echo "Coverage is below 90%"; - exit 1; - fi