-
Notifications
You must be signed in to change notification settings - Fork 0
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
ci(gha): set up CI #4
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
384c7c5
chore: configure mypy
isac322 5e103b3
fix: type errors
isac322 9a2dcf4
docs: sort imports of README.md
isac322 995c6e9
ci(gha): add ci
isac322 05f359b
ci(gha): add release
isac322 0c3f795
build: install fastapi on dev
isac322 a12f5ac
build: exclude py3.8
isac322 8142c80
fix: replace BaseModel with pydantic dataclass
isac322 c832569
build: specify minimum version of fastapi
isac322 55eb498
Revert "build: exclude py3.8"
isac322 94501d0
ci(gha): build
isac322 9928d1e
Reapply "build: exclude py3.8"
isac322 1edd09f
Revert "fix: replace BaseModel with pydantic dataclass"
isac322 f8c1450
ci(gha): fix build
isac322 ab5c09e
ci(gha): fix build
isac322 ea22a49
ci(gha): skip existing versions on publish
isac322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
pyver: ["3.9", "3.10", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "${{ matrix.pyver }}" | ||
cache: pip | ||
- name: Install dependencies | ||
# language=Bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e '.[dev]' | ||
- name: Test with pytest | ||
# language=Bash | ||
run: | | ||
pytest | ||
- name: Lint | ||
# language=Bash | ||
run: | | ||
ruff check --show-fixes --show-source | ||
mypy -p plugbear | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
- name: Build | ||
# language=Bash | ||
run: | | ||
python -m pip install --upgrade pip build | ||
python -m build . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
pypi-publish: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
- name: Build | ||
# language=Bash | ||
run: | | ||
pip install -U build | ||
python -m build . | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
skip-existing: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,13 @@ name = "plugbear" | |
authors = [{name = "Runbear", email = "[email protected]"}] | ||
readme = "README.md" | ||
dynamic = ["version", "description"] | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
|
@@ -31,16 +30,17 @@ Home = "https://plugbear.io/" | |
Source = "https://github.com/runbear-io/plugbear-python-sdk" | ||
|
||
[project.optional-dependencies] | ||
fastapi = ["fastapi"] | ||
fastapi = ["fastapi>=0.51.0"] | ||
|
||
dev = ["plugbear[test]", "plugbear[lint]"] | ||
dev = ["plugbear[test]", "plugbear[lint]", "plugbear[fastapi]"] | ||
test = [ | ||
"pytest~=7.4", | ||
"pytest-asyncio~=0.23", | ||
"httpx", # for fastapi.testclient | ||
] | ||
lint = [ | ||
"ruff~=0.1", | ||
"mypy~=1.7", | ||
] | ||
|
||
|
||
|
@@ -50,7 +50,7 @@ asyncio_mode = "auto" | |
|
||
[tool.ruff] | ||
line-length = 120 | ||
target-version = "py38" | ||
target-version = "py39" | ||
|
||
[tool.ruff.format] | ||
# Like Black, use double quotes for strings. | ||
|
@@ -60,4 +60,31 @@ indent-style = "space" | |
# Like Black, respect magic trailing commas. | ||
skip-magic-trailing-comma = false | ||
# Like Black, automatically detect the appropriate line ending. | ||
line-ending = "auto" | ||
line-ending = "auto" | ||
|
||
|
||
[tool.mypy] | ||
python_version = "3.9" | ||
allow_redefinition = true | ||
disallow_incomplete_defs = true | ||
disallow_untyped_calls = true | ||
disallow_untyped_decorators = true | ||
disallow_untyped_defs = true | ||
no_implicit_optional = true | ||
no_implicit_reexport = true | ||
no_warn_no_return = true | ||
strict_equality = true | ||
warn_redundant_casts = true | ||
warn_return_any = true | ||
warn_unreachable = true | ||
warn_unused_ignores = true | ||
|
||
pretty = true | ||
show_column_numbers = true | ||
show_error_codes = true | ||
show_error_context = true | ||
|
||
# Plugins | ||
plugins = [ | ||
"pydantic.mypy", | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we bumping the package version while publishing? Can the version be automatically reflected to sdk version header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just update variable
__version__
ofplugbear/__init__.py
. Flit will pick the variable and publish with it.Yeap. Because the
__version__
is an ordinary python variable, and we use it on header directly.