Skip to content

Commit

Permalink
🔖 New Release Bugfix +
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaloog committed Dec 7, 2024
1 parent 0cf1abc commit 22d4af3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 81 deletions.
137 changes: 57 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# GitHub Actions configuration **EXAMPLE**,
# MODIFY IT ACCORDING TO YOUR NEEDS!
# Reference: https://docs.github.com/en/actions

name: tests
name: Continuous Integration

on:
push:
Expand All @@ -12,115 +8,96 @@ on:
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
pull_request: # Run in every PR
workflow_dispatch: # Allow manually triggering the workflow
schedule:
# Run roughly every 15 days at 00:00 UTC
# (useful to check if updates on dependencies break the package)
- cron: '0 0 1,16 * *'

permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 0} # deep clone for setuptools-scm
- uses: actions/setup-python@v4
id: setup-python
with: {python-version: "3.11"}
- name: Run static analysis and format checkers
run: pipx run pre-commit run --all-files --show-diff-on-failure
- name: Build package distribution files
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox -e clean,build
- name: Record the path of wheel distribution
id: wheel-distribution
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
- name: Store the distribution files for use in other stages
# `tests` and `publish` will use the same pre-built distributions,
# so we make sure to release the exact same package that was tested
uses: actions/upload-artifact@v3
with:
name: python-distribution-files
path: dist/
retention-days: 1

test:
needs: prepare
tests:
strategy:
matrix:
python:
- "3.8" # oldest Python supported by PSF
- "3.11" # newest Python that is stable
python-version:
- "3.10"
# - "3.11"
- "3.12"
- "3.13"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
runs-on: ${{matrix.platform}}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
id: setup-python
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v3
with: {name: python-distribution-files, path: dist/}
python-version: ${{matrix.python-version}}
- name: Install the project
run: uv sync --all-extras --dev

- name: Run tests
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
-- -rFEx --durations 10 --color yes # pytest args
# For example, using `pytest`
run: uv run pytest tests

# Generate Coverage
- name: Generate coverage report
run: pipx run coverage lcov -o coverage.lcov
run: uv run coverage lcov -o coverage.lcov
- name: Upload partial coverage report
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
path-to-lcov: coverage.lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
parallel: true

finalize:
needs: test
finalize_coverage:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Finalize coverage report
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

publish:
needs: finalize
needs: finalize_coverage
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
environment: 'deploy'
environment: 'publish'
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
# id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with: {python-version: "3.11"}
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v3
with: {name: python-distribution-files, path: dist/}
- name: Publish Package
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: "Build Package"
run: uv build

- name: "Publish Package to PyPi"
env:
# TODO: Set your PYPI_TOKEN as a secret using GitHub UI
# - https://pypi.org/help/#apitoken
# - https://docs.github.com/en/actions/security-guides/encrypted-secrets
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: pipx run tox -e publish
# UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_TOKEN: ${{secrets.PYPI_TOKEN}}

run: uv publish
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "dotenvhub"
version = "0.2.0"
version = "0.2.1"
description = "Terminal App to manage .env files written in Python powered by Textual"
readme = "README.md"
authors = [
Expand Down

0 comments on commit 22d4af3

Please sign in to comment.