Skip to content

Bump version to 1.0.4 and update project description in pyproject.tom… #21

Bump version to 1.0.4 and update project description in pyproject.tom…

Bump version to 1.0.4 and update project description in pyproject.tom… #21

# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
#
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
# Trigger on workflow dispatch (manual trigger), pushes to main, PRs, or when a release is published
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published]
permissions:
contents: read
jobs:
release-build:
runs-on: ubuntu-latest
# Only run on releases, not on regular pushes/PRs
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Build release distributions
run: |
# Build the hyperway package
python -m pip install build
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
pypi-publish:
runs-on: ubuntu-latest
# Only run on releases, not on regular pushes/PRs
if: github.event_name == 'release'
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# PyPI project URL for hyperway
url: https://pypi.org/p/hyperway
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for better analysis
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Graphviz
run: |
wget https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/14.0.1/ubuntu_25.04_graphviz-14.0.1-cmake.deb -O /tmp/graphviz-14.0.1.deb
sudo dpkg -i /tmp/graphviz-14.0.1.deb
dot -V
- name: Install tox and dependencies
run: |
python -m pip install --upgrade pip
pip install tox graphviz
- name: Run tests and generate coverage
run: tox -e py312
- name: Debug - Check coverage file paths
run: |
echo "=== Checking coverage.xml paths ==="
if [ -f coverage.xml ]; then
echo "Coverage file exists"
echo "Source path in coverage.xml:"
grep -A 1 "<sources>" coverage.xml
echo ""
echo "Sample file paths (first 5):"
grep -o 'filename="[^"]*"' coverage.xml | head -5
echo ""
echo "Actual source files in src/:"
ls -la src/hyperway/*.py | head -3
else
echo "ERROR: coverage.xml not found!"
exit 1
fi
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=Strangemother_python-hyperway
-Dsonar.organization=strangemother