Skip to content

fix: exclude provenance graphs from present entity discovery #161

fix: exclude provenance graphs from present entity discovery

fix: exclude provenance graphs from present entity discovery #161

Workflow file for this run

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2025 Arcangelo Massari <arcangelo.massari@unibo.it>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
name: Run tests
on:
push:
branches:
- "**"
pull_request:
branches: [main]
permissions:
contents: read
env:
COVERAGE_REPORT_PATH: htmlcov
jobs:
CheckCoverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install Python
run: uv python install
- name: Install dependencies
run: uv sync --locked --all-extras --dev
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Start test database
run: |
chmod +x ./tests/start-test-database.sh
./tests/start-test-database.sh
- name: Run tests with coverage
run: |
uv run coverage run --rcfile=tests/coverage/.coveragerc
uv run coverage xml
echo "=== Coverage Report ==="
uv run coverage report
echo "COVERAGE=$(uv run coverage report | grep TOTAL | awk '{print $4}')" >> $GITHUB_ENV
- name: Stop test database
if: always()
run: |
chmod +x ./tests/stop-test-database.sh
./tests/stop-test-database.sh
- name: Generate HTML coverage report
run: |
uv run coverage html -d htmlcov
- name: Upload coverage artifact
if: matrix.python-version == '3.10' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ env.COVERAGE_REPORT_PATH }}
- name: Generate coverage badge
if: matrix.python-version == '3.10'
run: |
COVERAGE_NUM=$(echo ${{ env.COVERAGE }} | sed 's/%//')
if (( $(echo "$COVERAGE_NUM >= 90" | bc -l) )); then
COLOR="green"
elif (( $(echo "$COVERAGE_NUM >= 75" | bc -l) )); then
COLOR="yellow"
elif (( $(echo "$COVERAGE_NUM >= 60" | bc -l) )); then
COLOR="orange"
else
COLOR="red"
fi
echo "BADGE_COLOR=$COLOR" >> $GITHUB_ENV
- name: Create badge
if: matrix.python-version == '3.10'
uses: RubbaBoy/BYOB@v1.3.0
with:
name: opencitations-time-agnostic-library-coverage-${{ github.ref_name }}
label: "Coverage"
status: "${{ env.COVERAGE }}"
color: ${{ env.BADGE_COLOR }}
github_token: ${{ secrets.GIST_PAT }}
repository: arcangelo7/badges
actor: arcangelo7