Skip to content

change license fully to APACHE and fix pytests directory path #272

change license fully to APACHE and fix pytests directory path

change license fully to APACHE and fix pytests directory path #272

Workflow file for this run

name: Unit Tests For Development
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
strategy:
matrix:
include:
- os: windows-latest
python-version: 3.11
- os: windows-latest
python-version: 3.12
- os: windows-latest
python-version: 3.13
# - os: macos-latest
# python-version: 3.11
- os: ubuntu-latest
python-version: 3.11
- os: ubuntu-latest
python-version: 3.12
- os: ubuntu-latest
python-version: 3.13
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install uv (Linux/macOS)
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install uv
- name: Install dependencies (Linux/macOS)
if: runner.os != 'Windows'
run: |
uv venv .venv
source .venv/bin/activate
uv sync --no-install-project --group test --group dev
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
uv venv .venv
.venv\Scripts\activate
uv sync --no-install-project --group test --group dev
- name: Run unit tests (Linux/macOS)
if: runner.os != 'Windows' && matrix.python-version != 3.13
run: |
source .venv/bin/activate
uv run coverage run -m unittest discover -s tests -p 'test_*.py'
- name: Run unit tests and generate coverage report (Linux/macOS python 3.13)
if: runner.os != 'Windows' && matrix.python-version == 3.13
run: |
source .venv/bin/activate
uv run coverage run -m unittest discover -s tests -p 'test_*.py'
uv run coverage xml -o coverage.xml
- name: Run unit tests (Windows)
if: runner.os == 'Windows'
run: |
.venv\Scripts\activate
uv run coverage run -m unittest discover -s tests -p "test_*.py"
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
if: runner.os != 'Windows' && matrix.python-version == 3.13
with:
name: coverage-report-ubuntu-latest-py3.13
path: coverage.xml
if-no-files-found: warn
publish_coverage:
name: Publish coverage (Ubuntu Python 3.13)
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Ubuntu 3.13 coverage artifact
id: dl
uses: actions/download-artifact@v4
with:
name: coverage-report-ubuntu-latest-py3.13
path: .
continue-on-error: true
- name: Upload coverage to Codecov
if: steps.dl.outcome == 'success'
uses: codecov/codecov-action@v4
env:
CI: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true
slug: hololinked-dev/hololinked
- name: Skip note (no Ubuntu 3.13 artifact found)
if: steps.dl.outcome != 'success'
run: echo "No Ubuntu 3.13 coverage artifact present; skipping Codecov upload."
publish_package:
name: Publish package to Test PyPI
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'workflow_dispatch'
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Build package
run: uv build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/