Skip to content

Update README.md

Update README.md #10

Workflow file for this run

name: Test PyPI deploy
on:
push:
branches:
- master
jobs:
generate_version:
name: Generate version
runs-on: ubuntu-latest
steps:
- name: Generate version file
run: echo "0.0.$(date "+%s")" > VERSION
- name: Upload version artifact
uses: actions/upload-artifact@v4
with:
name: VERSION
path: VERSION
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
needs: generate_version
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download version
uses: actions/download-artifact@v4
with:
name: VERSION
path: .
- name: Update version
run: sed -i "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml || sed -i "" "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- name: Upload sources
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: generate_version
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, macos-14 ]
steps:
- name: Set MACOSX_DEPLOYMENT_TARGET
run: |
if [[ ${{ matrix.os }} = macos-13 ]]
then
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV"
elif [[ ${{ matrix.os }} = macos-14 ]]
then
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV"
fi
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download version
uses: actions/download-artifact@v4
with:
name: VERSION
path: .
- name: Update version
run: sed -i "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml || sed -i "" "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml
- name: Build wheels
uses: pypa/[email protected]
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
publish_test:
name: Publish to test PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Push to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: "https://test.pypi.org/legacy/"
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
install_and_run_tests:
name: Install package from Test PyPI and run tests (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
needs: publish_test
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, macos-14 ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- name: Checkout the tests
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download version
uses: actions/download-artifact@v4
with:
name: VERSION
path: .
# retry up to 10 times in case the package is not available yet
- name: Install the package
uses: nick-fields/[email protected]
with:
timeout_seconds: 60
retry_wait_seconds: 10
max_attempts: 10
command: pip install --extra-index-url https://test.pypi.org/simple/ --no-cache-dir swisspair[test]=="$(cat VERSION)"
- name: Run tests
run: pytest