Skip to content

Commit

Permalink
feat: workflow for deploying to testpypi
Browse files Browse the repository at this point in the history
Deploys on push to generated-client branch to testpypi
  • Loading branch information
Jakob Stolze committed Mar 26, 2024
1 parent 78c4e08 commit 8c7d8dd
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test and deploy to TestPyPI | generated-client branch

on:
push:
branches:
- generated-client

jobs:
pytest:
strategy:
fail-fast: false
matrix:
config:
- python-version: '3.11'
tox: py311
poetry-version: [ "1.8.2" ]
os: [ ubuntu-22.04, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
name: Python ${{ matrix.config.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install poetry
run: pipx install poetry
- name: Install Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.python-version }}
cache: 'poetry'
- name: Install packages
run: poetry install --no-root
- name: Load cached tox
uses: actions/cache@v3
with:
path: .tox
key: tox-${{ matrix.os }}-poetry-${{ matrix.poetry-version }}-python-${{ matrix.config.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Setup API Key
env:
ORS_API_KEY: ${{ secrets.ORS_API_KEY }}
run: printf "[ORS]\napiKey = $ORS_API_KEY\n" > tests-config.ini
- name: Run tox
run: |
poetry run tox -e pytest-${{ matrix.config.tox }}
build-and-publish:
name: Build and publish Python distributions 📦 to TestPyPI
runs-on: ubuntu-20.04
needs: pytest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.python-version }}
cache: 'poetry'
- name: Publish distribution 📦 with test.pypi.org
if: startsWith(github.ref, 'refs/tags/v')
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry build
poetry publish -r testpypi

0 comments on commit 8c7d8dd

Please sign in to comment.