fix actions #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- 'main' | |
- 'dev' | |
- 'feature/*' | |
- 'hotfix/*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.26" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install the project | |
run: uv sync | |
- name: Install the project | |
run: uv build | |
- name: Upload built artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: dist/* | |
tests: | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
matrix: | |
# os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] | |
os: [ "ubuntu-latest" ] | |
# python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
python-version: [ "3.13"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.26" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set PYTHONPATH (Linux/macOS) | |
if: runner.os != 'Windows' | |
run: echo "PYTHONPATH=$PWD/src" >> $GITHUB_ENV | |
shell: bash | |
- name: Set PYTHONPATH (Windows) | |
if: runner.os == 'Windows' | |
run: echo PYTHONPATH=%CD%\src >> %GITHUB_ENV% | |
shell: cmd | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run Ruff | |
run: uv run ruff check | |
- name: Run Pytests | |
run: uv run pytest tests | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build, tests] | |
# if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- run: ls -R | |
- name: List contents of dist/ directory | |
run: | | |
ls -al dist/ | |
- name: Upload to PyPI | |
env: | |
PYPI_USERNAME: ${{ secrets.PP_UN }} | |
PYPI_PASSWORD: ${{ secrets.PP_TK }} | |
run: | | |
uv publish | |
- name: Clean up | |
run: | | |
rm -rf dist # Removes built artifacts after publishing |