ci(github-actions): 💚 not parallel #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build pytest wheel | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Test with pytest | |
run: pytest test.py | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build pytest wheel twine | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Build artifacts | |
run: python -m build | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
- name: Publish package to TestPyPI | |
run: | | |
python3 -m twine upload --skip-existing --non-interactive --verbose --password $TWINE_PASSWORD dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ |