1+ name : Run Tests
2+
3+ on :
4+ pull_request :
5+ types : [ opened, synchronize ]
6+
7+ jobs :
8+ tests :
9+ name : Run Tests
10+ runs-on : windows-latest
11+
12+ env :
13+ PYTHONIOENCODING : ' UTF-8'
14+
15+ strategy :
16+ matrix :
17+ python-version : [ 3.12 ]
18+
19+ steps :
20+ - name : Configure git
21+ run : |
22+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
23+ git config --global core.autocrlf false
24+ git config --global core.eol lf
25+ git config --global user.email "110257560+BnanZ0@users.noreply.github.com"
26+ git config --global user.name "RU"
27+ echo "action_state=yellow" >> $env:GITHUB_ENV
28+ echo $env:action_state
29+
30+ - uses : actions/checkout@v6
31+ with :
32+ submodules : true
33+ lfs : true
34+ fetch-depth : 0
35+
36+ - name : Set up Python ${{ matrix.python-version }}
37+ uses : actions/setup-python@v6
38+ with :
39+ python-version : ${{ matrix.python-version }}
40+
41+ - name : Set UTF-8 encoding
42+ run : |
43+ set PYTHONIOENCODING=utf-8
44+ set PYTHONLEGACYWINDOWSSTDIO=utf-8
45+ echo PYTHONIOENCODING=utf-8 >> $GITHUB_ENV
46+
47+ - name : Install Dependencies
48+ run : |
49+ pip install -r requirements.txt
50+
51+ - name : Run tests
52+ run : |
53+ Get-ChildItem -Path ".\tests\*.py" | ForEach-Object {
54+ Write-Host "Running tests in $($_.FullName)"
55+ try {
56+ # Run the Python unittest command
57+ python -m unittest $_.FullName
58+
59+ # Check if the previous command succeeded
60+ if ($LASTEXITCODE -ne 0) {
61+ throw "Tests failed in $($_.FullName)"
62+ }
63+ } catch {
64+ # Stop the loop and return the error
65+ Write-Error $_
66+ exit 1
67+ }
68+ }
69+
70+
0 commit comments