-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into refactor/re-architect…
…uring
- Loading branch information
Showing
32 changed files
with
946 additions
and
287 deletions.
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,32 @@ | ||
# This script requires python 3.12 to run. | ||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import Any | ||
|
||
import tomllib # type: ignore[import] | ||
|
||
|
||
def gen_requirements_txt(pyproject_cfg: dict[str, Any]) -> str: | ||
_res: list[str] = [ | ||
"# Automatically generated from pyproject.toml by gen_requirements_txt.py script.", | ||
"# DO NOT EDIT! Only for reference use.", | ||
] | ||
try: | ||
_res.extend(pyproject_cfg["project"]["dependencies"]) | ||
except KeyError: | ||
print("WARNING: no deps are defined in pyproject.toml") | ||
_res.append("") | ||
return "\n".join(_res) | ||
|
||
|
||
if __name__ == "__main__": | ||
script_name, *args = sys.argv | ||
if len(args) < 2: | ||
print(f"Usage: {script_name} <pyproject.toml> <requirements.txt>") | ||
sys.exit(1) | ||
|
||
pyproject_toml, requirements_txt, *_ = args | ||
with open(pyproject_toml, "rb") as src, open(requirements_txt, "w") as dst: | ||
_parsed = tomllib.load(src) | ||
dst.write(gen_requirements_txt(_parsed)) |
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,52 @@ | ||
name: gen requirements.txt on pyproject.toml file changed | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'pyproject.toml' | ||
# allow manual dispatch of this workflow | ||
workflow_dispatch: | ||
|
||
jobs: | ||
gen-requirements-txt: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1 | ||
|
||
steps: | ||
- name: checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
# use repo scope deploy key for the later git operations, so that the pushed commit can trigger the | ||
# workflow as expected. The default action token GITHUB_TOKEN cannot trigger new workflows. | ||
# For more details about this restriction, please refer to: | ||
# https://github.com/peter-evans/create-pull-request/issues/48 and | ||
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs | ||
ssh_key: ${{ secrets.DEPLOY_KEY }} | ||
persist-credentials: true | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: generate requirements.txt | ||
run: | | ||
python .github/tools/gen_requirements_txt.py \ | ||
pyproject.toml requirements.txt | ||
- name: commit change if needed | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
if git diff --exit-code requirements.txt; then | ||
echo "skip commit as requirements.txt is not changed" | ||
else | ||
echo "detect requirements.txt updated, commit change ..." | ||
git add requirements.txt | ||
git commit -m "[GHA] Update requirements.txt on pyproject.toml changed" | ||
git push | ||
fi |
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 |
---|---|---|
|
@@ -4,6 +4,14 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
# NOTE(20241016): this is a workaround for PR with head | ||
# updated by gen_requirements_txt workflow | ||
- review_requested | ||
- assigned | ||
push: | ||
branches: | ||
- main | ||
|
@@ -48,7 +56,7 @@ jobs: | |
# export the coverage report to the comment! | ||
- name: Add coverage report to PR comment | ||
continue-on-error: true | ||
uses: MishaKav/[email protected].52 | ||
uses: MishaKav/[email protected].53 | ||
with: | ||
pytest-xml-coverage-path: test_result/coverage.xml | ||
junitxml-path: test_result/pytest.xml | ||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Automatically generated from pyproject.toml by gen_requirements_txt.py script. | ||
# DO NOT EDIT! Only for reference use. | ||
aiofiles<25,>=24.1 | ||
aiohttp>=3.10.2,<3.11 | ||
cryptography>=43.0.1,<44 | ||
grpcio>=1.53.2,<1.67 | ||
protobuf<4.22,>=4.21.12 | ||
pydantic<3,>=2.6 | ||
pydantic-settings<3,>=2.3 | ||
pyopenssl<25,>=24.1 | ||
pyyaml<7,>=6.0.1 | ||
requests<2.33,>=2.32 | ||
simple-sqlite3-orm<0.3,>=0.2 | ||
typing-extensions>=4.6.3 | ||
urllib3<2.3,>=2.2.2 | ||
uvicorn[standard]>=0.30,<0.32 | ||
zstandard<0.24,>=0.22 |
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
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
Oops, something went wrong.