diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..7270d0072 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,85 @@ +name: Coverage Deploy + +on: + schedule: + - cron: "0 0 * * SAT" + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + coverage-build: + runs-on: ubuntu-latest + timeout-minutes: 300 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Rust + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81 + + - name: Install libsasl2-dev libssl-dev + run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev + + - name: Set up Just + uses: extractions/setup-just@v2 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .tool-versions + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + id: cache-cargo + with: + prefix-key: ${{ runner.os }}-v3-cargo + shared-key: stable-release + key: ${{ hashFiles('Cargo.lock', 'Cargo.toml') }} + cache-provider: "github" + cache-directories: "~/.cargo/bin/" + + - name: Set up dependencies + if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} + run: | + cargo install killport || true + cargo install wait-service || true + + - name: Install Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Install Poetry + run: curl -sSL https://install.python-poetry.org | python3 - + + - name: Install Docker Compose + run: | + sudo apt-get update + sudo apt-get install -y docker-compose + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov@0.6.14 + + - name: Generate coverage + run: | + mkdir -p target/llvm-cov/codecov + just stratus-test-coverage "--codecov --output-path target/llvm-cov/codecov/codecov.json" + + - name: Upload coverage report artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: target/llvm-cov/codecov/ + retention-days: 90 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + directory: target/llvm-cov/codecov + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/justfile b/justfile index 147ecb33c..b97c82bc7 100644 --- a/justfile +++ b/justfile @@ -483,7 +483,7 @@ contracts-coverage-erase: just _log "Erasing coverage info..." rm -rf ./*/coverage && echo "Coverage info erased." -stratus-test-coverage output="": +stratus-test-coverage *args="": #!/bin/bash # setup just contracts-clone @@ -597,6 +597,6 @@ stratus-test-coverage output="": -rm -r e2e_logs -rm utils/deploy/deploy_01.log -rm utils/deploy/deploy_02.log + */ - cargo llvm-cov report {{output}} - cargo llvm-cov report --codecov --output-path target/llvm-cov/codecov/codecov.json \ No newline at end of file + cargo llvm-cov report {{args}} \ No newline at end of file