Add verify command to check login status #692
Workflow file for this run
This file contains hidden or 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
name: Test When PR | |
on: | |
pull_request: | |
paths: | |
- swanlab/** | |
- test/** | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' # 缓存 pip 依赖 | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-media.txt | |
pip install -r requirements-dev.txt | |
pip install -r requirements-dashboard.txt | |
- name: Run Tests (First Attempt) | |
id: test_first_try | |
continue-on-error: true # 允许失败,不阻止后续步骤执行 | |
run: | | |
export SWANLAB_RUNTIME=test-no-cloud | |
export SWANLAB_WEB_HOST=${{ secrets.SWANLAB_WEB_HOST }} | |
export SWANLAB_API_HOST=${{ secrets.SWANLAB_API_HOST }} | |
export SWANLAB_API_KEY=${{ secrets.SWANLAB_API_KEY }} | |
export PYTHONPATH=$PYTHONPATH:. | |
pytest test/unit | |
- name: Run Tests (Retry) | |
if: steps.test_first_try.outcome == 'failure' # 仅在第一次失败时重试 | |
run: | | |
export SWANLAB_RUNTIME=test-no-cloud | |
export SWANLAB_WEB_HOST=${{ secrets.SWANLAB_WEB_HOST }} | |
export SWANLAB_API_HOST=${{ secrets.SWANLAB_API_HOST }} | |
export SWANLAB_API_KEY=${{ secrets.SWANLAB_API_KEY }} | |
export PYTHONPATH=$PYTHONPATH:. | |
pytest test/unit |