-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: workflow for deploying to testpypi
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.
There are no files selected for viewing
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
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 |