-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from BA-OST-Index/dev
2023-11-19 weekly update
- Loading branch information
Showing
28 changed files
with
322 additions
and
106 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,30 @@ | ||
name: Dev Branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'dev' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install necessary Python packages | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Update submodules | ||
run: | | ||
git submodule update --remote | ||
# Custom script | ||
- name: Run custom prechecking | ||
run: python prechecker.py |
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,29 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install necessary Python packages | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Update submodules | ||
run: | | ||
git submodule update --remote | ||
# Custom script | ||
- name: Run custom prechecking | ||
run: python prechecker.py |
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,11 @@ | ||
ALL_LANGS = ["en", "zh_cn"] | ||
LANG_OTHER_PAGE = { | ||
"page/{lang}/main_all.html": "main/index.html", | ||
"page/{lang}/_index.html": "index.html", | ||
"page/{lang}/_about.html": "about.html" | ||
} | ||
OTHER_STATIC_PAGE = { | ||
"page/index.html": "index.html", | ||
"page/404.html": "404.html", | ||
"page/zh_cn/_zhcn_technical.html": "zh_cn/zhcn_technical.html" | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import time | ||
|
||
ALL_LANGS = ["en", "zh_cn"] | ||
|
||
|
||
def render_template(env, path): | ||
print(f"[INFO]\tTesting {path}...") | ||
try: | ||
template = env.get_template(path) | ||
|
||
start = time.time_ns() | ||
template.render(is_static=True) | ||
end = time.time_ns() | ||
except Exception as e: | ||
print(f"[FAIL]\tFailed with exception: {str(e)}") | ||
raise e | ||
else: | ||
print(f"[OK]\tSuccessfully tested (runtime {(end - start) / 1e6} ms)") | ||
|
||
|
||
def check_static_per_lang(env, page: dict): | ||
total = len(page.keys()) | ||
failed_count = 0 | ||
|
||
for i in ALL_LANGS: | ||
for path, name in page.items(): | ||
try: | ||
render_template(env, path.format(lang=i)) | ||
except Exception: | ||
failed_count += 1 | ||
|
||
print(f"Total {total}, failed {failed_count} ({failed_count / total * 100:0.2f}%)") | ||
if failed_count != 0: | ||
raise AssertionError | ||
|
||
|
||
def check_static_otehr(env, page: dict): | ||
total = len(page.keys()) | ||
failed_count = 0 | ||
|
||
for path, name in page.items(): | ||
try: | ||
render_template(env, path) | ||
except Exception: | ||
failed_count += 1 | ||
|
||
print(f"Total {total}, failed {failed_count} ({failed_count / total * 100:0.2f}%)") | ||
if failed_count != 0: | ||
raise AssertionError |
Oops, something went wrong.