|
| 1 | +name: Test and deploy to TestPyPI | generated-client branch |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - generated-client |
| 7 | + |
| 8 | +jobs: |
| 9 | + pytest: |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + config: |
| 14 | + - python-version: '3.11' |
| 15 | + tox: py311 |
| 16 | + poetry-version: [ "1.8.2" ] |
| 17 | + os: [ ubuntu-22.04, macos-latest, windows-latest ] |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + name: Python ${{ matrix.config.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }} |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + - name: Install poetry |
| 28 | + run: pipx install poetry |
| 29 | + - name: Install Python ${{ matrix.config.python-version }} |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.config.python-version }} |
| 33 | + cache: 'poetry' |
| 34 | + - name: Install packages |
| 35 | + run: poetry install --no-root |
| 36 | + - name: Load cached tox |
| 37 | + uses: actions/cache@v3 |
| 38 | + with: |
| 39 | + path: .tox |
| 40 | + key: tox-${{ matrix.os }}-poetry-${{ matrix.poetry-version }}-python-${{ matrix.config.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 41 | + - name: Setup API Key |
| 42 | + env: |
| 43 | + ORS_API_KEY: ${{ secrets.ORS_API_KEY }} |
| 44 | + run: printf "[ORS]\napiKey = $ORS_API_KEY\n" > tests-config.ini |
| 45 | + - name: Run tox |
| 46 | + run: | |
| 47 | + poetry run tox -e pytest-${{ matrix.config.tox }} |
| 48 | +
|
| 49 | + build-and-publish: |
| 50 | + name: Build and publish Python distributions 📦 to TestPyPI |
| 51 | + runs-on: ubuntu-20.04 |
| 52 | + needs: pytest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + - name: Install poetry |
| 56 | + run: pipx install poetry |
| 57 | + - name: Install Python ${{ matrix.config.python-version }} |
| 58 | + uses: actions/setup-python@v5 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.config.python-version }} |
| 61 | + cache: 'poetry' |
| 62 | + - name: Publish distribution 📦 with test.pypi.org |
| 63 | + if: startsWith(github.ref, 'refs/tags/v') |
| 64 | + run: | |
| 65 | + poetry config repositories.testpypi https://test.pypi.org/legacy/ |
| 66 | + poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 67 | + poetry build |
| 68 | + poetry publish -r testpypi |
0 commit comments