Skip to content
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(github action): update branch of checking #1384

Merged
merged 10 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
79 changes: 79 additions & 0 deletions .github/workflows/bk-login.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: bklogin_ci_check
on:
push:
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/bk-login/**"
- "src/idp-plugins/**"
pull_request:
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/bk-login/**"
- "src/idp-plugins/**"
jobs:
check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-login/bklogin
- name: Format & Lint with ruff
run: |
pip install ruff==0.1.4
ruff format src/bk-login --config=src/bk-login/pyproject.toml
ruff src/bk-login --config=src/bk-login/pyproject.toml
- name: Lint with mypy
run: |
pip install mypy==1.6.1 types-requests==2.31.0.2 types-setuptools==57.4.18 types-dataclasses==0.1.7 types-redis==3.5.18 types-PyMySQL==1.1.0.1 types-six==0.1.9 types-toml==0.1.5 types-pytz==2023.3.0.0 types-urllib3==1.26.25.14
mypy src/bk-login --config-file=src/bk-login/pyproject.toml
test:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Start MySQL Container
uses: samin/[email protected]
with:
mysql version: "8.0"
mysql database: bk-login
mysql user: root
mysql password: root_pwd
mysql root password: root_pwd
- name: Start Redis Container
uses: supercharge/[email protected]
with:
redis-version: "3.2.0"
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-login/bklogin
- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.6.1"
- name: Install dependencies
working-directory: src/bk-login
run: poetry install
- name: Run unittest
working-directory: src/bk-login
run: |
# random secret
export BK_APP_SECRET="fod6MKVTVi_3M5HgGoj-qI7b3l0dgCzTBwGypnDz4vg="
# random secret key
export BKKRILL_ENCRYPT_SECRET_KEY="tttHSBLiVdQPItrfy7n9dV7AxAUMZpYVkD6IHMbL0VE="
export BK_USER_URL=""
export BK_COMPONENT_API_URL=""
export MYSQL_PASSWORD=root_pwd
export MYSQL_HOST="127.0.0.1"
export DJANGO_SETTINGS_MODULE=bklogin.settings
poetry run pytest ./tests
14 changes: 4 additions & 10 deletions .github/workflows/bk-user.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: bkuser_ci_check
on:
push:
branches: [master, ft_tenant]
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/bk-user/**"
- "src/idp-plugins/**"
pull_request:
branches: [master, ft_tenant]
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/bk-user/**"
- "src/idp-plugins/**"
jobs:
check:
runs-on: ubuntu-latest
Expand All @@ -20,23 +22,16 @@ jobs:
python-version: "3.10"
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-login/bklogin
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-user/bkuser
- name: Format & Lint with ruff
run: |
pip install ruff==0.1.4
ruff format src/bk-user --config=src/bk-user/pyproject.toml
ruff src/bk-user --config=src/bk-user/pyproject.toml
ruff format src/bk-login --config=src/bk-login/pyproject.toml
ruff src/bk-login --config=src/bk-login/pyproject.toml
ruff format src/idp-plugins --config=src/idp-plugins/pyproject.toml
ruff src/idp-plugins --config=src/idp-plugins/pyproject.toml
- name: Lint with mypy
run: |
pip install mypy==1.6.1 types-requests==2.31.0.2 types-setuptools==57.4.18 types-dataclasses==0.1.7 types-redis==3.5.18 types-PyMySQL==1.1.0.1 types-six==0.1.9 types-toml==0.1.5 types-pytz==2023.3.0.0 types-urllib3==1.26.25.14
mypy src/bk-user --config-file=src/bk-user/pyproject.toml
mypy src/bk-login --config-file=src/bk-login/pyproject.toml
mypy src/idp-plugins --config-file=src/idp-plugins/pyproject.toml
test:
strategy:
fail-fast: false
Expand All @@ -61,7 +56,6 @@ jobs:
python-version: "3.10"
- name: create idp plugin symbolic link
run: |
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-login/bklogin
ln -s $(pwd)/src/idp-plugins/idp_plugins $(pwd)/src/bk-user/bkuser
- name: Set up Poetry
uses: abatilo/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ master, develop ]
branches: [ main, pre_*, ft_*, release/* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, develop ]
branches: [ main, pre_*, ft_*, release/* ]
schedule:
- cron: '22 11 * * 4'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ESLint

on:
push:
branches: [ master, develop, pre_*, ft_* ]
branches: [ main, pre_*, ft_*, release/* ]
pull_request:
branches: [ master, develop, pre_*, ft_* ]
branches: [ main, pre_*, ft_*, release/* ]

jobs:
build:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/idp-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: idp_plugin_ci_check
on:
push:
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/idp-plugins/**"
pull_request:
branches: [ main, pre_*, ft_*, release/* ]
paths:
- "src/idp-plugins/**"
jobs:
check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Format & Lint with ruff
run: |
pip install ruff==0.1.4
ruff format src/idp-plugins --config=src/idp-plugins/pyproject.toml
ruff src/idp-plugins --config=src/idp-plugins/pyproject.toml
- name: Lint with mypy
run: |
pip install mypy==1.6.1 types-requests==2.31.0.2 types-setuptools==57.4.18 types-dataclasses==0.1.7 types-redis==3.5.18 types-PyMySQL==1.1.0.1 types-six==0.1.9 types-toml==0.1.5 types-pytz==2023.3.0.0 types-urllib3==1.26.25.14
mypy src/idp-plugins --config-file=src/idp-plugins/pyproject.toml
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ repos:
.*/poetry\.lock|
.*/pyproject\.toml|
\.github/workflows/bk-user.yml|
\.github/workflows/bk-login.yml|
\.github/workflows/idp-plugins.yml|
src/bk-user/logs|src/pages/node_modules/|
src/bk-login/pages/src/views/components/protocol.vue|
src/pages/static/bk_icon_font/iconcool.json|
Expand Down
2 changes: 1 addition & 1 deletion src/idp-plugins/idp_plugins/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BuiltinIdpPluginEnum(str, StructuredEnum):
WECOM = EnumField("wecom", label=_("企业微信"))


BuiltinIdpPluginIDs = list(BuiltinIdpPluginEnum)
BuiltinIdpPluginIDs = list(BuiltinIdpPluginEnum) # type: ignore


class AllowedHttpMethodEnum(str, StructuredEnum):
Expand Down
Loading