Skip to content

chore: Modernize repo and code #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24d7ab2
Modernize actions
alfred82santa Feb 14, 2025
fffbfdb
Refactor all SDK, sync and async drivers, more tests, started a new c…
alfred82santa Feb 25, 2025
d7ebc2f
Remove src from .gitignore
alfred82santa Feb 25, 2025
912d96c
Install all extras
alfred82santa Feb 25, 2025
91b304d
Make compatible with old python versions
alfred82santa Feb 25, 2025
6d78798
Make compatible with old python versions
alfred82santa Feb 25, 2025
d0157ef
Fix test datetimes and other fixes
alfred82santa Feb 26, 2025
1ba8d5a
Fix support for python 3.9
alfred82santa Feb 26, 2025
a5cfa5d
Remove testing print
alfred82santa Feb 26, 2025
7b43371
Added documentation
alfred82santa Feb 27, 2025
67ea36a
Added TOTP and Application operations
alfred82santa Feb 28, 2025
1698b6e
Fixes
alfred82santa Feb 28, 2025
3855f88
Added set-metadata operation, set metadata on pairing and phone numbe…
alfred82santa Mar 4, 2025
ccc6df7
Better docs and fixes
alfred82santa Mar 4, 2025
5ce918e
Fix docs
alfred82santa Mar 4, 2025
c4d8412
Improve tests and docs
alfred82santa Mar 5, 2025
6c17fed
Added authorization control status api
alfred82santa Mar 5, 2025
e7e1bcf
Make compatible py3.9
alfred82santa Mar 5, 2025
1da4aa8
Make compatible py3.9
alfred82santa Mar 5, 2025
f830565
Better docs
alfred82santa Mar 5, 2025
eae17cb
Added get subscription and more docs
alfred82santa Mar 5, 2025
2c9a855
Fix docs
alfred82santa Mar 5, 2025
07fb2e4
More docs and fixes
alfred82santa Mar 5, 2025
a7cef2f
Typo
alfred82santa Mar 5, 2025
0ab6795
Fixes
alfred82santa Mar 12, 2025
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
38 changes: 38 additions & 0 deletions .github/actions/setup-repo/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: setup
description: Setup up repository
inputs:
python-version:
description: Python version to setup
required: false
default: "3.13"
poetry-version:
description: Poetry version to setup
required: false
default: "2.0"

runs:
using: composite
steps:
- name: Setup python
if: inputs.python-version
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Setup poetry
if: inputs.poetry-version
uses: abatilo/actions-poetry@v4
with:
poetry-version: ${{ inputs.poetry-version }}

- name: Setup a local virtual environment
shell: bash
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- uses: actions/cache@v4
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
71 changes: 71 additions & 0 deletions .github/actions/versioning/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: versioning
description: Setup up current version
inputs:
level:
description: "Version increase level"
required: false
default: "none"
outputs:
current-version:
description: "Old version"
value: ${{ steps.current-version.outputs.version }}
version:
description: "New version"
value: ${{ steps.define-version.outputs.version }}
version-no-build:
description: "New version with no build part"
value: ${{ steps.define-version.outputs.versionNoBuild }}
release-major:
description: "New major version"
value: ${{ steps.define-version.outputs.major }}
release-minor:
description: "New minor version"
value: ${{ steps.define-version.outputs.baseReleaseMinor }}
release-patch:
description: "New patch version"
value: ${{ steps.define-version.outputs.baseRelease }}
part-major:
description: "Major part of new version"
value: ${{ steps.define-version.outputs.major }}
part-minor:
description: "Minor part of new version"
value: ${{ steps.define-version.outputs.minor }}
part-patch:
description: "Patch part of new version"
value: ${{ steps.define-version.outputs.patch }}
part-prerelease-type:
description: "Prerelase type part of new version"
value: ${{ steps.define-version.outputs.prereleaseType }}
part-prerelease-number:
description: "Prerelase number part of new version"
value: ${{ steps.define-version.outputs.prereleaseNumber }}
part-build:
description: "Build part of new version"
value: ${{ steps.define-version.outputs.build }}
is-prerelease:
description: "Whether is a prerelease version or not"
value: ${{ steps.define-version.outputs.isPrerelease }}

runs:
using: composite
steps:
- name: Store version
id: current-version
shell: bash
run: |
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"

- name: Define prerelease version
id: define-version
uses: alfred82santa/action-next-version@v1
with:
version: ${{ steps.current-version.outputs.version }}
level: ${{ inputs.level }}
versionFormat: "pep440"
releaseTagPattern: "^v([0-9](?:\\.?[0-9]+)*(?:[\\.\\-_+0-9a-zA-Z]+)?)$"

- name: Set development version
shell: bash
if: inputs.level != 'none'
run: |
poetry version ${{ steps.define-version.outputs.version }}
93 changes: 93 additions & 0 deletions .github/workflows/common_get_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Common get version

on:
workflow_call:
inputs:
ref:
description: "Base branch reference"
required: false
type: string

level:
description: "Release level"
required: false
type: string
default: none

outputs:
version:
description: "Version"
value: ${{ jobs.get_version.outputs.version }}
version-no-build:
description: "Version with no build part"
value: ${{ jobs.get_version.outputs.version-no-build }}
release-major:
description: "Release major granularity"
value: ${{ jobs.get_version.outputs.release-major }}
release-minor:
description: "Release minor granularity"
value: ${{ jobs.get_version.outputs.release-minor }}
release-patch:
description: "Release patch granularity"
value: ${{ jobs.get_version.outputs.release-patch }}
release-ref:
description: "Release branch"
value: release/${{ jobs.get_version.outputs.release-minor }}
part-major:
description: "Major part of release version"
value: ${{ jobs.get_version.outputs.part-major }}
part-minor:
description: "Minor part of release version"
value: ${{ jobs.get_version.outputs.part-minor }}
part-patch:
description: "Patch part of release version"
value: ${{ jobs.get_version.outputs.part-patch }}
part-prerelease-type:
description: "Prerelease type part of release version"
value: ${{ jobs.get_version.outputs.part-prerelease-type }}
part-prerelease-number:
description: "Prerelease number part of release version"
value: ${{ jobs.get_version.outputs.part-prerelease-number }}
part-build:
description: "Build part of release version"
value: ${{ jobs.get_version.outputs.part-build }}
is-prerelease:
description: "Whether is a prerelease version"
value: ${{ jobs.get_version.outputs.is-prerelease }}

permissions:
contents: read

jobs:
get_version:
name: Get version
# The type of runner that the job will run on
runs-on: ubuntu-latest

outputs:
current-version: ${{ steps.define-version.outputs.current-version }}
version: ${{ steps.define-version.outputs.version }}
version-no-build: ${{ steps.define-version.outputs.version-no-build }}
release-major: ${{ steps.define-version.outputs.release-major }}
release-minor: ${{ steps.define-version.outputs.release-minor }}
release-patch: ${{ steps.define-version.outputs.release-patch }}
part-major: ${{ steps.define-version.outputs.part-major }}
part-minor: ${{ steps.define-version.outputs.part-minor }}
part-patch: ${{ steps.define-version.outputs.part-patch }}
part-prerelease-type: ${{ steps.define-version.outputs.part-prerelease-type }}
part-prerelease-number: ${{ steps.define-version.outputs.part-prerelease-number }}
part-build: ${{ steps.define-version.outputs.part-build }}
is-prerelease: ${{ steps.define-version.outputs.is-prerelease }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.ref }}

- uses: ./.github/actions/setup-repo

- uses: ./.github/actions/versioning
id: define-version
with:
level: ${{ inputs.level }}
52 changes: 52 additions & 0 deletions .github/workflows/common_make_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Common make release

on:
workflow_call:
inputs:
level:
description: "Version increase level"
required: false
default: "none"
type: string

jobs:
release:
name: Make release
# The type of runner that the job will run on
runs-on: ubuntu-latest

outputs:
version: ${{ steps.define-version.outputs.version }}
base-release-version: ${{ steps.define-version.outputs.release-patch}}
release-ref: release/${{ steps.define-version.outputs.release-minor }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup-repo

- uses: ./.github/actions/versioning
id: define-version
with:
level: ${{ inputs.level }}

- name: Build package
run: |
poetry build

- name: Publish package
run: |
poetry publish --username=__token__ --password=${{ secrets.PYPI_API_TOKEN }}

- name: Make release
id: make_release
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: v${{ steps.define-version.outputs.version-no-build }}
RELEASE_TITLE: Release ${{ steps.define-version.outputs.version }}
run: |
gh release create $TAG_NAME --target ${{ github.sha }} -t "$RELEASE_TITLE" ${{ (inputs.level != 'none') && '--prerelease' }} --generate-notes
echo "release=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "**Tag:** [$TAG_NAME]("$(gh release view $TAG_NAME --json url --jq ".url")")" >> $GITHUB_STEP_SUMMARY
56 changes: 56 additions & 0 deletions .github/workflows/common_push_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This is a basic workflow to help you get started with Actions

name: Common push version

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the develop branch
on:
workflow_call:
inputs:
level:
description: "Version level to increase (major, minor or patch)"
required: false
default: "minor"
type: string
ref:
description: "Base branch reference"
required: false
default: "main"
type: string

concurrency:
group: push-version-${{ inputs.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
increase_version:
name: Increase version

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.ref }}

- uses: ./.github/actions/setup-repo

- uses: ./.github/actions/versioning
id: define-version
with:
level: ${{ inputs.level }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "Bump version to ${{ steps.define-version.outputs.version }}"
branch: "task/start-version-${{ steps.define-version.outputs.version }}"
delete-branch: true
commit-message: "Bump version to ${{ steps.define-version.outputs.version }}"
body: |
:crown: *Automatic PR starting new version*
labels: automated,bot
base: ${{ inputs.ref }}
add-paths: pyproject.toml
32 changes: 32 additions & 0 deletions .github/workflows/latch_sdk_python_manual_increase_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow to help you get started with Actions

name: Increase version

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the develop branch
on:
workflow_dispatch:
inputs:
level:
description: "Version level to increase (major, minor or patch)"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
ref:
description: "Base branch reference"
required: false
default: "develop"
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
increase_version:
uses: ./.github/workflows/common_push_version.yaml
with:
level: ${{ inputs.level }}
ref: ${{ inputs.ref }}
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/latch_sdk_python_manual_make_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Manual make release

on:
workflow_dispatch:
inputs:
level:
description: "Release level"
required: true
type: choice
default: dev
options:
- production
- rc
- beta
- alpha
- dev

jobs:
make-release:
uses: ./.github/workflows/common_make_release.yaml
secrets: inherit
with:
level: ${{ inputs.level == 'production' && 'none' || inputs.level }}

get-branch:
if: inputs.level == 'production'
uses: ./.github/workflows/common_get_version.yaml
secrets: inherit

increase-version:
needs:
- get-branch
uses: ./.github/workflows/common_push_version.yaml
with:
level: 'patch'
ref: ${{ needs.get-branch.outputs.release-ref }}
secrets: inherit
Loading