Skip to content

Commit

Permalink
feat: support running unit tests in CI (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oreoxmt authored Dec 4, 2023
1 parent 55a2d02 commit 8aba3d5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run tests
on:
pull_request:
branches:
- main

jobs:

build_and_test:
runs-on: ubuntu-latest

steps:
- name: Checkout current repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Create .env file
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env
echo "TEST=1" >> .env
echo "DOCS_PR=13910" >> .env
echo "DOCS_CN_PR=14523" >> .env
echo "CLOUD_DOCS_PR=10098" >> .env
echo "OPERATOR_DOCS_PR=2397" >> .env
echo "RELEASE_DIR=release-6.7" >> .env
- name: Run test script
run: |
python3 test/test.py
5 changes: 4 additions & 1 deletion test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def analyze(self) -> str:
"""
Analyze test results and generate a report.
"""
terminal_width = os.get_terminal_size().columns
try:
terminal_width = os.get_terminal_size().columns
except OSError:
terminal_width = 80
hyphens = "-" * ((terminal_width - len("Test Results")) // 2)
duration = self.report.end_time - self.report.start_time

Expand Down

0 comments on commit 8aba3d5

Please # to comment.