Skip to content

Commit

Permalink
ci: run code coverage stats every 3 days
Browse files Browse the repository at this point in the history
  • Loading branch information
neysofu committed Dec 5, 2022
1 parent 7b4228c commit bfbf201
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Code coverage

on:
workflow_dispatch:
schedule:
# Run it every 3 days.
- cron: "0 3 * * *"

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
THEGRAPH_STORE_POSTGRES_DIESEL_URL: "postgresql://postgres:postgres@localhost:5432/graph_node_test"
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings"
N_CONCURRENT_TESTS: "4"
TESTS_GANACHE_HARD_WAIT_SECONDS: "30"

jobs:
# Heavily inspired from <https://github.com/taiki-e/cargo-llvm-cov#continuous-integration>.
coverage:
name: Code coverage of integration tests
runs-on: ubuntu-latest
timeout-minutes: 60
services:
ipfs:
image: ipfs/go-ipfs:v0.10.0
ports:
- 5001:5001
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: graph_node_test
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Node 14
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache-dependency-path: "tests/integration-tests/yarn.lock"
- name: Install lld
run: sudo apt-get install -y lld jq
- uses: actions-rs/cargo@v1
with:
command: install
args: cargo-llvm-cov

- name: Build graph-node
uses: actions-rs/cargo@v1
with:
command: build
args: --bin graph-node

- name: Generate code coverage
run: cargo llvm-cov --package graph-tests --lcov --output-path lcov.info -- --nocapture
- uses: actions/upload-artifact@v3
with:
name: code-coverage-info
path: lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
# No token needed, because the repo is public.
files: lcov.info
fail_ci_if_error: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Code coverage stuff
*.profraw
lcov.info

# Generated by Cargo
# will have compiled files and executables
/target/
Expand Down

0 comments on commit bfbf201

Please sign in to comment.