Skip to content

Addition of "Examples" Folder to Repository #31

Addition of "Examples" Folder to Repository

Addition of "Examples" Folder to Repository #31

name: "Setup, Build, and Test"
on:
push:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/**'
pull_request:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/**'
jobs:
build-and-test:
name: Build and test codebase
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Run tests
run: |
poetry run coverage run --source=src/entity_recognition_lib -m pytest --doctest-modules --ignore=examples --junitxml=junit/test-results.xml
poetry run coverage report
poetry run coverage html
poetry run coverage xml
- name: Upload JUnit Test Results
uses: actions/upload-artifact@v4
with:
name: junit-test-results
path: junit/test-results.xml
- name: Upload HTML Coverage Report
uses: actions/upload-artifact@v4
with:
name: html-coverage-report
path: htmlcov/
- name: Upload XML Coverage Report
uses: actions/upload-artifact@v4
with:
name: xml-coverage-report
path: coverage.xml
- name: Bump version and commit
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
poetry version patch
git add pyproject.toml
git commit -m "Automated version bump [skip ci]"
git push
- name: Build package
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: poetry build
- name: Upload built package
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-package
path: dist/