Skip to content

Merge pull request #334 from kayjan/feature/tidy-modify-tests #851

Merge pull request #334 from kayjan/feature/tidy-modify-tests

Merge pull request #334 from kayjan/feature/tidy-modify-tests #851

Workflow file for this run

name: Code Coverage
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize]
jobs:
codecov:
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
permissions:
actions: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install ".[all]"
- name: Generate coverage report and benchmark report
run: |
python -m pip install pytest pytest-cov pytest-benchmark[histogram]
pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=./ --cov-report=xml --benchmark-autosave --benchmark-histogram=.benchmarks/histogram --benchmark-json output.json
- name: Convert coverage report
uses: irongut/[email protected]
with:
filename: coverage.xml
badge: true
format: markdown
indicators: true
output: both
- name: Upload coverage to PR comment
if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Code coverage report
recreate: true
path: code-coverage-results.md
- name: Clear previous benchmark report
if: ${{ github.event_name == 'push' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh cache delete ${{ runner.os }}-benchmark --repo kayjan/bigtree
continue-on-error: true
- name: Download previous benchmark report
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark report
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "pytest"
output-file-path: output.json
external-data-json-path: ./cache/benchmark-data.json
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true
fail-on-alert: true
summary-always: true
- name: Store benchmark report (gh-pages)
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "pytest"
output-file-path: output.json
gh-repository: "github.com/kayjan/bigtree-benchmark"
github-token: ${{ secrets.BENCHMARK_TOKEN }}
auto-push: true
- name: Upload coverage to Codecov
if: ${{ github.event_name == 'push' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
name: codecov-umbrella
verbose: true # optional (default = false)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}