Skip to content

Commit

Permalink
Merge pull request #2 from xmichele/hatch
Browse files Browse the repository at this point in the history
hatch toml + publishing
  • Loading branch information
fabricebrito authored Sep 25, 2024
2 parents 81b66a0 + 043a2ab commit 35b8e9b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 30 deletions.
48 changes: 22 additions & 26 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,34 @@ name: Publish to PyPI

on:
push:
branches: [ "hatch" ]
branches: [ "hatch" ] #main can be added
release:
types: [published]

permissions:
contents: read
# permissions:
# contents: read
# id-token: write # Ensure this permission is available for trusted publishing

jobs:
deploy:

runs-on: ubuntu-latest

environment: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
# python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Test package
run: hatch -e test run nose2 --verbose
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: pip install hatch
- name: Build package
run: hatch build
- name: Test package
run: hatch -e test run nose2 --verbose
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
password: ${{ secrets.MY_PYPI_API_TOKEN }} # Ensure your PyPI API token is set in secrets otherwise use trusted publishers mode
repository-url: https://upload.pypi.org/legacy/ # Use Test PyPI or main PyPI https://upload.pypi.org/legacy/
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ dependencies = [
"loguru"
]

#[tool.hatch.envs.test.env-vars]
#RETRY_ATTEMPTS="0"
[tool.hatch.envs.test.env-vars]
RETRY_ATTEMPTS="0"

[tool.hatch.envs.test.scripts]
test = "hatch run nose2"
testv = "hatch run nose2 --verbose"
#cov = ["coverage run --source=src -m nose2", "coverage report"]
cov = ["coverage run --source=src -m nose2", "coverage report"]

[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

0 comments on commit 35b8e9b

Please sign in to comment.