Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 67 additions & 69 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ name: Python package

on:
push:
branches: [ "main","feature/**","development", "[0-9]+-*"]
branches: ["main", "feature/**", "development", "[0-9]+-*"]
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches: [ "main","development"]
types: [opened, reopened, edited]
branches: ["main", "development"]
types: [opened, reopened, edited, synchronize]

jobs:
test-and-lint:
Expand All @@ -21,85 +21,83 @@ jobs:
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 }}
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test,tox_gh,tox,mypy,flake8]
# Linting step only runs for Python 3.8
- name: mypy
if: matrix.python-version == '3.8'
continue-on-error: true
run: mypy -p corbado_python_sdk --exclude generated --strict --disable-error-code attr-defined
- name: lint with flake8
if: matrix.python-version == '3.8'
run: flake8 .
- name: Test with tox
run: |
tox run
env:
CORBADO_PROJECT_ID: ${{ secrets.CORBADO_PROJECT_ID }}
CORBADO_API_SECRET: ${{ secrets.CORBADO_API_SECRET }}
CORBADO_FRONTEND_API: ${{ vars.CORBADO_FRONTEND_API }}
CORBADO_BACKEND_API: ${{ vars.CORBADO_BACKEND_API }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
**/requirements*.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test,tox_gh,tox,mypy,flake8]

# Linting step only runs for Python 3.8
- name: mypy
if: matrix.python-version == '3.8'
continue-on-error: true
run: mypy -p corbado_python_sdk --exclude generated --strict --disable-error-code attr-defined
- name: lint with flake8
if: matrix.python-version == '3.8'
run: flake8 .

- name: Test with tox
run: |
tox run
env:
CORBADO_PROJECT_ID: "pro-1870103272253508163"
CORBADO_API_SECRET: ${{ secrets.CORBADO_API_SECRET }}
CORBADO_FRONTEND_API: ${{ vars.CORBADO_FRONTEND_API }}
CORBADO_BACKEND_API: ${{ vars.CORBADO_BACKEND_API }}



build:
if: startsWith(github.ref, 'refs/tags/v') # only make separate build and upload for tag pushes
name: Build and upload distribution package
if: startsWith(github.ref, 'refs/tags/v') # only make separate build and upload for tag pushes
name: Build and upload distribution package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python distribution package to PyPI
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
needs: [build,test-and-lint] # Ensure that package was built and tested for all python versions before publishing
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
needs: [build, test-and-lint] # Ensure that package was built and tested for all python versions before publishing
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/passkeys
permissions:
id-token: write
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading