Skip to content

Commit 3d240a6

Browse files
committed
CI: add release workflow
1 parent 287a9e2 commit 3d240a6

File tree

5 files changed

+110
-2
lines changed

5 files changed

+110
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Test FastAPI bindings
2+
3+
on:
4+
workflow_dispatch:
5+
inputs: {}
6+
push:
7+
branches:
8+
- release
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- "python-fastapi/src/gel_auth_fastapi/_version.py"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
working-directory: python-fastapi
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
26+
with:
27+
version: "0.6.2"
28+
29+
- name: Build
30+
run: uv build
31+
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: dist
35+
path: python-fastapi/dist/*
36+
37+
test:
38+
runs-on: ubuntu-latest
39+
needs: build
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
python-version:
44+
- "3.9"
45+
- "3.10"
46+
- "3.11"
47+
- "3.12"
48+
- "3.13"
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Install uv and set the python version
53+
uses: astral-sh/setup-uv@v5
54+
with:
55+
version: "0.6.2"
56+
python-version: ${{ matrix.python-version }}
57+
58+
- name: Download artifact
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: dist
62+
63+
- name: Install and prepare test source files
64+
run: |
65+
uv pip install gel_auth_fastapi*.whl
66+
tar xvf gel_auth_fastapi*.tar.*
67+
mv gel_auth_fastapi-*/tests .
68+
rm -rf gel_auth_fastapi-*
69+
find python-fastapi
70+
71+
- name: Run tests
72+
run: |
73+
cd tests
74+
uv run python -m unittest -v

python-fastapi/examples/basic-async/pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "0.1.0"
44
description = "Basic async example project"
55
readme = "README.md"
66
requires-python = ">=3.13"
7+
classifiers = ["Private :: Do Not Upload"]
78
dependencies = [
89
"gel-auth-fastapi",
910
]

python-fastapi/pyproject.toml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[project]
22
name = "gel-auth-fastapi"
3-
version = "0.1.0"
43
description = "Gel auth extension binding for FastAPI"
54
readme = "README.md"
65
authors = [
76
{ name = "Gel Data Inc.", email = "[email protected]" }
87
]
98
requires-python = ">=3.9"
109
dependencies = []
10+
dynamic = ["version"]
1111

1212
[build-system]
1313
requires = ["hatchling"]
@@ -39,3 +39,14 @@ indent-width = 4
3939
[tool.black]
4040
line-length = 80
4141
target-version = ["py39", "py310", "py311", "py312", "py313"]
42+
43+
[tool.hatch.version]
44+
path = "src/gel_auth_fastapi/_version.py"
45+
46+
[tool.hatch.build.targets.sdist]
47+
exclude = [
48+
"/examples",
49+
]
50+
51+
[tool.hatch.build.targets.sdist.force-include]
52+
"../LICENSE" = "LICENSE"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# This source file is part of the Gel open source project.
3+
#
4+
# Copyright 2025-present Gel Data Inc. and the Gel authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
__version__ = "0.1.0"

python-fastapi/tests/test_cqa.py python-fastapi/tests/test_source_code.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_cqa_mypy(self) -> None:
3131
root_path = find_root_path()
3232
config_path = root_path / "pyproject.toml"
3333
if not config_path.exists():
34-
raise RuntimeError("could not locate pyproject.toml file")
34+
raise unittest.SkipTest("could not locate pyproject.toml file")
3535

3636
try:
3737
import mypy # NoQA
@@ -65,6 +65,9 @@ def test_cqa_mypy(self) -> None:
6565

6666
def test_cqa_ruff(self):
6767
root_path = find_root_path()
68+
config_path = root_path / "pyproject.toml"
69+
if not config_path.exists():
70+
raise unittest.SkipTest("could not locate pyproject.toml file")
6871

6972
try:
7073
import ruff # type: ignore # NoQA

0 commit comments

Comments
 (0)