Skip to content

V1.0.3

V1.0.3 #16

Workflow file for this run

name: On Release Workflow
on:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest coverage
pip install tomlkit==0.13.2
- name: Install make
run: sudo apt-get install make
- name: Run tests
run: make tests -k
- name: Upload test reports
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.python-version }}
path: tests_reports/
- name: publish test report
if: success() || failure()
uses: mikepenz/action-junit-report@v5
with:
report_paths: tests_reports/**/report.xml
include_passed: true
check_name: Pytest Test Report (${{ matrix.python-version }})
- name: Setup .NET Core # Required to execute ReportGenerator
if: success() || failure()
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-quality: 'ga'
- name: Merge coverage reports
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: tests_reports/**/coverage.xml
targetdir: coverage-report
reporttypes: "cobertura"
- name: coverage report
if: s(success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage-report/Cobertura.xml
fail_below_min: true
thresholds: "90 100"
format: markdown
output: both
hide_complexity: true
- name: Rename coverage report
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
run: mv code-coverage-results.md coverage-report/coverage.${{ matrix.python-version }}.md
- name: upload code coverage report
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.python-version }}
path: coverage-report/coverage.${{ matrix.python-version }}.md
update_release:
runs-on: ubuntu-latest
needs: test
steps:
- name: download code coverage reports
uses: actions/download-artifact@v4
with:
name: code-coverage-report-3.10
path: coverage-reports
- name: add coverage to release description
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const coverage = fs.readFileSync('coverage-reports/coverage.3.10.md', 'utf8');
const releaseBody = `## Test coverage\n${coverage}\n\n${context.payload.release.body}`;
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: context.payload.release.id,
body: releaseBody
});
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: make VERSION=${{ github.event.release.tag_name }}
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: package-artifacts-${{ github.event.release.tag_name }}
path: |
dist/*.tar.gz
dist/*.whl
- name: Publish release assets
uses: AButler/upload-release-assets@v3.0
with:
files: "dist/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}