Skip to content

Bump idna from 3.4 to 3.7 in /python #168

Bump idna from 3.4 to 3.7 in /python

Bump idna from 3.4 to 3.7 in /python #168

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ main ]
paths:
- '.github/workflows/python.yml'
- 'python/**/*.py'
- 'python/poetry.lock'
- 'python/pyproject.toml'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/python.yml'
- 'python/**/*.py'
- 'python/poetry.lock'
- 'python/pyproject.toml'
defaults:
run:
working-directory: ./python
jobs:
lint_and_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
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 poetry
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 truelayer_signing --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 truelayer_signing --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Run static type check
run: |
poetry run mypy truelayer_signing
- name: Test with pytest
run: |
poetry run pytest --cov=truelayer_signing -v tests/
check_version:
runs-on: ubuntu-latest
# Runs only on the main branch
if: github.ref == 'refs/heads/main'
needs: lint_and_test
outputs:
version: ${{ steps.get_version.outputs.version }}
is_published: ${{ steps.check_published.outputs.is_published }}
steps:
- uses: actions/checkout@v4
- name: Get current version
id: get_version
run: echo version=$(grep -m1 'version = "' pyproject.toml | cut -d '"' -f2) >> $GITHUB_OUTPUT
- name: Check if it's already published
id: check_published
run: |
package_url=https://pypi.org/pypi/truelayer-signing/${{ steps.get_version.outputs.version }}/json
status_code=$(curl --write-out %{http_code} --silent --output /dev/null $package_url)
echo is_published=$(([ $status_code -eq 200 ] && echo true ) || echo false) >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
needs: [lint_and_test, check_version]
# Runs only on the main branch and if the current version isn't already published
if: github.ref == 'refs/heads/main' && needs.check_version.outputs.is_published == 'false'
env:
python-version: "3.10"
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
- name: Build and publish
run: |
poetry build
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish