Skip to content

Commit ea78353

Browse files
committed
first commit
0 parents  commit ea78353

26 files changed

+4844
-0
lines changed

.flake8

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude =
4+
.git,
5+
__pycache__,
6+
cdk.out,
7+
build,
8+
dist,
9+
.eggs,
10+
*.egg,
11+
node_modules,
12+
tests/**/snapshots/*.py,
13+
.venv
14+
inline-quotes = double
15+
ignore = E402,W503,W504,F403,F405,E704,F811

.github/workflows/main-workflow.yaml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Main Workflow
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
pull-requests: write
12+
issues: write
13+
14+
jobs:
15+
setup:
16+
name: Setup Environment
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
shell: bash
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Required for semantic-release
25+
26+
- name: Set up python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: 3.11
30+
31+
- name: Configure Poetry
32+
uses: snok/install-poetry@v1
33+
with:
34+
version: 1.7.1
35+
virtualenvs-create: true
36+
virtualenvs-in-project: true
37+
38+
- name: Cache virtualenv
39+
uses: actions/cache@v4
40+
with:
41+
path: ./.venv
42+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
43+
44+
- name: Install dependencies
45+
run: |
46+
poetry install
47+
48+
- name: Upload workspace
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: workspace
52+
include-hidden-files: true
53+
path: |
54+
.
55+
!.git
56+
!.github
57+
!node_modules
58+
!.venv
59+
60+
verify:
61+
needs: setup
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
task: [lint]
66+
include:
67+
- task: lint
68+
command: make lint
69+
name: ${{ matrix.task }}
70+
steps:
71+
- name: Download workspace
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: workspace
75+
76+
- name: Set up python
77+
uses: actions/setup-python@v4
78+
with:
79+
python-version: 3.11
80+
81+
- name: Configure Poetry
82+
uses: snok/install-poetry@v1
83+
with:
84+
version: 1.7.1
85+
virtualenvs-create: true
86+
virtualenvs-in-project: true
87+
88+
- name: Cache virtualenv
89+
uses: actions/cache@v4
90+
with:
91+
path: ./.venv
92+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
93+
94+
- name: Run ${{ matrix.task }}
95+
run: |
96+
poetry run ${{ matrix.command }}
97+
98+
test:
99+
needs: setup
100+
runs-on: ubuntu-latest
101+
strategy:
102+
matrix:
103+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
104+
name: Test Python ${{ matrix.python-version }}
105+
steps:
106+
- name: Download workspace
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: workspace
110+
111+
- name: Set up python ${{ matrix.python-version }}
112+
uses: actions/setup-python@v4
113+
with:
114+
python-version: ${{ matrix.python-version }}
115+
116+
- name: Configure Poetry
117+
uses: snok/install-poetry@v1
118+
with:
119+
version: 1.7.1
120+
virtualenvs-create: true
121+
virtualenvs-in-project: true
122+
123+
- name: Cache virtualenv
124+
uses: actions/cache@v4
125+
with:
126+
path: ./.venv
127+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
128+
129+
- name: Run tests
130+
run: poetry run make test
131+
timeout-minutes: 5
132+
133+
release:
134+
needs: [verify, test]
135+
runs-on: ubuntu-latest
136+
concurrency: release
137+
outputs:
138+
released: ${{ steps.release.outputs.released }}
139+
steps:
140+
# Note: we need to checkout the repository at the workflow sha in case during the workflow
141+
# the branch was updated. To keep PSR working with the configured release branches,
142+
# we force a checkout of the desired release branch but at the workflow sha HEAD.
143+
- name: Setup | Checkout Repository at workflow sha
144+
uses: actions/checkout@v4
145+
with:
146+
fetch-depth: 0
147+
ref: ${{ github.sha }}
148+
149+
- name: Setup | Force correct release branch on workflow sha
150+
run: |
151+
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
152+
153+
- name: Action | Semantic Version Release
154+
id: release
155+
uses: python-semantic-release/python-semantic-release@v9.15.1
156+
with:
157+
github_token: ${{ secrets.GITHUB_TOKEN }}
158+
git_committer_name: "github-actions"
159+
git_committer_email: "actions@users.noreply.github.com"
160+
161+
# Add Poetry-based PyPI publishing steps
162+
- name: Set up python
163+
if: steps.release.outputs.released == 'true'
164+
uses: actions/setup-python@v4
165+
with:
166+
python-version: 3.11
167+
168+
- name: Configure Poetry
169+
if: steps.release.outputs.released == 'true'
170+
uses: snok/install-poetry@v1
171+
with:
172+
version: 1.7.1
173+
virtualenvs-create: true
174+
virtualenvs-in-project: true
175+
176+
- name: Configure poetry credentials
177+
if: steps.release.outputs.released == 'true'
178+
run: |
179+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
180+
181+
- name: Build and publish
182+
if: steps.release.outputs.released == 'true'
183+
run: |
184+
poetry build
185+
poetry publish
186+
187+
# Add the download workspace as a separate step before build and publish
188+
- name: Download workspace
189+
if: steps.release.outputs.released == 'true'
190+
uses: actions/download-artifact@v4
191+
with:
192+
name: workspace
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Pull Request Workflow
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
setup:
7+
name: Setup Environment
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
shell: bash
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Required for semantic-release
16+
17+
- name: Set up python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: Configure Poetry
23+
uses: snok/install-poetry@v1
24+
with:
25+
version: 1.7.1
26+
virtualenvs-create: true
27+
virtualenvs-in-project: true
28+
29+
- name: Cache virtualenv
30+
uses: actions/cache@v4
31+
with:
32+
path: ./.venv
33+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
34+
35+
- name: Install dependencies
36+
run: |
37+
poetry install
38+
39+
- name: Upload workspace
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: workspace
43+
include-hidden-files: true
44+
path: |
45+
.
46+
!.git
47+
!.github
48+
!node_modules
49+
!.venv
50+
51+
verify:
52+
needs: setup
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
task: [lint]
57+
include:
58+
- task: lint
59+
command: make lint
60+
name: ${{ matrix.task }}
61+
steps:
62+
- name: Download workspace
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: workspace
66+
67+
- name: Set up python
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: 3.11
71+
72+
- name: Configure Poetry
73+
uses: snok/install-poetry@v1
74+
with:
75+
version: 1.7.1
76+
virtualenvs-create: true
77+
virtualenvs-in-project: true
78+
79+
- name: Cache virtualenv
80+
uses: actions/cache@v4
81+
with:
82+
path: ./.venv
83+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
84+
85+
- name: Run ${{ matrix.task }}
86+
run: |
87+
poetry run ${{ matrix.command }}
88+
89+
test:
90+
needs: setup
91+
runs-on: ubuntu-latest
92+
strategy:
93+
matrix:
94+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
95+
name: Test Python ${{ matrix.python-version }}
96+
steps:
97+
- name: Download workspace
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: workspace
101+
102+
- name: Set up python ${{ matrix.python-version }}
103+
uses: actions/setup-python@v4
104+
with:
105+
python-version: ${{ matrix.python-version }}
106+
107+
- name: Configure Poetry
108+
uses: snok/install-poetry@v1
109+
with:
110+
version: 1.7.1
111+
virtualenvs-create: true
112+
virtualenvs-in-project: true
113+
114+
- name: Cache virtualenv
115+
uses: actions/cache@v4
116+
with:
117+
path: ./.venv
118+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
119+
120+
- name: Run tests
121+
run: poetry run make test
122+
timeout-minutes: 5
123+
124+
semantic-release-dry-run:
125+
needs: setup
126+
runs-on: ubuntu-latest
127+
name: Semantic Release Dry Run
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v4
131+
with:
132+
fetch-depth: 0 # Required for semantic-release to access git history
133+
ref: ${{ github.head_ref }} # This checks out the PR source branch
134+
135+
- name: Set up python
136+
uses: actions/setup-python@v4
137+
with:
138+
python-version: 3.11
139+
140+
- name: Install semantic-release
141+
run: |
142+
python -m pip install python-semantic-release==9.15.1
143+
144+
- name: Dry Run Semantic Release
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
run: |
148+
semantic-release --noop version

0 commit comments

Comments
 (0)