Skip to content

Commit

Permalink
add jobs to publish package on PyPI and Github draft release
Browse files Browse the repository at this point in the history
  • Loading branch information
SamR1 committed Dec 29, 2024
1 parent 7177e42 commit 5176314
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/.tests-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,31 @@ jobs:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:

- uses: actions/checkout@v4

- name: Install Poetry and Dependencies
run: |
python -m pip install --upgrade pip
pip install --quiet poetry
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Create test databases
run: python db/create_ci_test_db.py

- name: Bandit
if: matrix.python-version == '3.13'
run: bandit -r fittrackee -c pyproject.toml

- name: Lint
if: matrix.python-version == '3.13'
run: ruff check fittrackee e2e

- name: Mypy
if: matrix.python-version == '3.13'
run: mypy fittrackee

- name: Pytest
run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1

Expand All @@ -74,15 +81,19 @@ jobs:
matrix:
psql-version: [ "12", "13", "14", "15", "16" ]
steps:

- uses: actions/checkout@v4

- name: Install Poetry and Dependencies
run: |
python -m pip install --upgrade pip
pip install --quiet poetry
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Create test databases
run: python db/create_ci_test_db.py

- name: Pytest
run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1

Expand Down Expand Up @@ -115,15 +126,19 @@ jobs:
EMAIL_URL: "smtp://mailhog:1025"
REDIS_URL: "redis://redis:6379"
steps:

- uses: actions/checkout@v4

- name: Install Poetry and Dependencies
run: |
python -m pip install --upgrade pip
pip install --quiet poetry
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Run migrations
run: flask db upgrade --directory fittrackee/migrations

- name: Start application and run tests with Selenium
run: |
setsid nohup flask run --with-threads -h 0.0.0.0 -p 5000 >> nohup.out 2>&1 &
Expand Down Expand Up @@ -191,3 +206,66 @@ jobs:
uses: ./.github/workflows/.e2e-tests.yml
with:
previous-version: true

publish-to-pypi:
if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v')
name: Publish Python distribution to PyPI
needs: ["end2end", "end2end_package", "end2end_package_update"]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/fittrackee
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v')
name: Upload distribution to GitHub Release
needs: ["publish-to-pypi"]
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub draft release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY"
--draft
--notes "wip"
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"

0 comments on commit 5176314

Please sign in to comment.