diff --git a/.github/workflows/publish-pypi-test.yml b/.github/workflows/publish-pypi-test.yml new file mode 100644 index 0000000..0c81326 --- /dev/null +++ b/.github/workflows/publish-pypi-test.yml @@ -0,0 +1,47 @@ +name: Publish to PyPI - Test Wheels + +on: [push, pull_request] + +jobs: + build_and_test_wheels: + runs-on: ubuntu-latest + environment: release + strategy: + matrix: + python-version: ["3.12"] + + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + # Need this to get version number from last tag + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Build sdist and wheel + run: > + export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) && + pipx run build + + - name: Check for packaging errors + run: pipx run twine check --strict dist/* + + - name: Install produced wheel + run: pip install dist/*.whl + + - name: Test module is importable using the installed wheel - 1 + run: python -c "import save_and_restore_api" + + - name: Test module is importable using the installed wheel - 2 + run: python -c "from save_and_restore_api import SaveRestoreAPI" + + - name: Test module is importable using the installed wheel - 3 + run: python -c "from save_and_restore_api.aio import SaveRestoreAPI" + + - name: Test if save-and-restore tools can be started + run: save-and-restore -h diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index c7ca989..271e969 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,22 +1,42 @@ name: Publish to PyPI on: - release: - types: [created] - branches: - - main + release: + types: [created] + branches: + - main jobs: - upload: + build_and_upload_to_pypi: runs-on: ubuntu-latest environment: release + strategy: + matrix: + python-version: ["3.12"] steps: - - name: Download dist artifact - uses: actions/download-artifact@v4 + + - name: Checkout + uses: actions/checkout@v4 + with: + # Need this to get version number from last tag + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 with: - name: dist - path: dist + python-version: ${{ matrix.python-version }} + + - name: Build sdist and wheel + run: > + export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) && + pipx run build + + - name: Check for packaging errors + run: pipx run twine check --strict dist/* + + - name: Install produced wheel + run: pip install dist/*.whl - name: Publish to PyPI using trusted publishing uses: pypa/gh-action-pypi-publish@release/v1