Skip to content

Commit

Permalink
update workflow; add pytest config to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0nx committed Nov 4, 2024
1 parent 16e1422 commit f92cd1e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ max_line_length = 160
ij_continuation_indent_size = 4
ij_python_blank_line_at_file_end = true

[{*.yml_sample,*.yaml_sample,*.yml,*.yaml}]
[{*.yml_sample,*.yaml_sample,*.yml,*.yaml,*.toml}]
indent_size = 2
54 changes: 37 additions & 17 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,42 @@ on:
- 'v*'

jobs:
deploy:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.eml_parser_github_deploy }}
run: |
python3 -m build -o dist/ .
twine upload dist/*
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies and build wheel
run: |
python -m pip install uv
uv build --wheel
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
# Specifying a GitHub environment is optional, but strongly encouraged
environment:
name: release
url: https://github.com/GOVCERT-LU/eml_parser/

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]


steps:
Expand All @@ -24,8 +24,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test,filemagic,regex]
python3 -m pip install uv
uv sync --extra test --extra filemagic --extra regex
- name: Test with pytest
run: |
pytest -v tests
uv run pytest -v tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.eml
*.pyc
uv.lock

build
dist
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Communications :: Email",
]
requires-python = ">= 3.9"
Expand Down Expand Up @@ -53,7 +54,7 @@ dev = [
"ruff",
]
test = [
"pytest",
"pytest>=8.3",
"pytest-sugar",
"coverage",
]
Expand Down Expand Up @@ -87,6 +88,16 @@ warn_unused_ignores = true
strict_optional = true
check_untyped_defs = false

files = [
"eml_parser/**/*.py"
]

[tool.pytest.ini_options]
minversion = "8.0"
testpaths = [
"tests"
]

[tool.ruff]
line-length = 160
indent-width = 4
Expand Down

0 comments on commit f92cd1e

Please sign in to comment.