Skip to content

feat(fixer): add script to detect identifier schema mismatches #459

feat(fixer): add script to detect identifier schema mismatches

feat(fixer): add script to detect identifier schema mismatches #459

Workflow file for this run

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2025 Arcangelo Massari <[email protected]>
#
# 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:
- "**" # All branches, including those with /
pull_request:
branches: [master]
# Add permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
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
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install project dependencies
run: |
poetry install
chmod +x ./test/start-test-databases.sh
chmod +x ./test/stop-test-databases.sh
- name: Install system dependencies
run: |
sudo apt-get update && sudo apt-get install -y libncurses6
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Start test databases
run: ./test/start-test-databases.sh
- name: Run tests with coverage
run: |
poetry run coverage run --rcfile=test/coverage/.coveragerc
echo "=== Coverage Report ==="
poetry run coverage report
echo "COVERAGE=$(poetry run coverage report | grep TOTAL | awk '{print $4}')" >> $GITHUB_ENV
- name: Stop test databases
if: always()
run: ./test/stop-test-databases.sh
- name: Generate HTML coverage report
run: |
poetry run coverage html -d htmlcov
- name: Upload coverage report artifact (for master branch)
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.10'
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
retention-days: 14
- name: Upload coverage report to GitHub Pages artifact
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.10'
uses: actions/upload-pages-artifact@v3
with:
path: htmlcov/
- name: Determine badge color
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: Generate coverage badge (for master branch)
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.10'
uses: RubbaBoy/[email protected]
with:
name: opencitations-oc_meta_coverage
label: "Coverage"
status: "${{ env.COVERAGE }}"
color: ${{ env.BADGE_COLOR }}
github_token: ${{ secrets.GIST_PAT }}
repository: arcangelo7/badges
actor: arcangelo7
DeployPages:
needs: CheckCoverage
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
environment:
name: ${{ github.repository }}/pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4