Skip to content

Commit

Permalink
chore: add codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-aranha-cw committed Dec 19, 2024
1 parent 0ed0a31 commit 93d8f23
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 3 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Coverage Deploy

Check warning on line 1 in .github/workflows/coverage.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/coverage.yml#L1

Ensure top-level permissions are not set to write-all

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: [email protected]

- 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 }}
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
cargo llvm-cov report {{args}}

0 comments on commit 93d8f23

Please sign in to comment.