Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: package

on:
push:
branches:
- master
- develop
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
package:
name: Build and validate distributions
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v7

- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.12"

- name: Install packaging tools
run: python -m pip install --upgrade build twine

- name: Build source and wheel distributions
run: python -m build

- name: Validate distribution metadata
run: python -m twine check --strict dist/*

- name: Install wheel in a clean environment
run: |
python -m venv "$RUNNER_TEMP/pyerrors-wheel-smoke"
"$RUNNER_TEMP/pyerrors-wheel-smoke/bin/python" -m pip install dist/*.whl
"$RUNNER_TEMP/pyerrors-wheel-smoke/bin/python" -m pip check

- name: Verify installed wheel
run: |
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/pyerrors-wheel-smoke/bin/python" -c 'import importlib.metadata as metadata; import os; from pathlib import Path; import pyerrors; assert pyerrors.__version__ == metadata.version("pyerrors"); assert not Path(pyerrors.__file__).resolve().is_relative_to(Path(os.environ["GITHUB_WORKSPACE"]).resolve()); print(f"validated {pyerrors.__version__} from {pyerrors.__file__}")'
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
if-no-files-found: error

publish:
if: github.event_name == 'release'
needs: [build]
name: Upload to PyPI
runs-on: ubuntu-latest
Expand Down