-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 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,36 @@ | ||
name: check | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
paths: | ||
- ".github/workflows/check.yml" | ||
- "assets/**" | ||
- "**.py" | ||
pull_request: | ||
branches: | ||
- "**" | ||
paths: | ||
- ".github/workflows/check.yml" | ||
- "assets/**" | ||
- "**.py" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
resource: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# pip install maafw | ||
- name: Install maafw | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade maafw --pre | ||
- name: Check Resource | ||
run: | | ||
python ./check_resource.py ./assets/resource/base/ |
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,39 @@ | ||
import sys | ||
|
||
from typing import List | ||
from pathlib import Path | ||
|
||
from maa.resource import Resource | ||
from maa.tasker import Tasker, LoggingLevelEnum | ||
|
||
|
||
def check(dirs: List[Path]) -> bool: | ||
resource = Resource() | ||
|
||
print(f"Checking {len(dirs)} directories...") | ||
|
||
for dir in dirs: | ||
print(f"Checking {dir}...") | ||
status = resource.post_path(dir).wait().status() | ||
if not status.succeeded(): | ||
print(f"Failed to check {dir}.") | ||
return False | ||
|
||
print("All directories checked.") | ||
return True | ||
|
||
|
||
def main(): | ||
if len(sys.argv) < 2: | ||
print("Usage: python configure.py <directory>") | ||
sys.exit(1) | ||
|
||
Tasker.set_stdout_level(LoggingLevelEnum.All) | ||
|
||
dirs = [Path(arg) for arg in sys.argv[1:]] | ||
if not check(dirs): | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |