mirror of
https://github.com/hect0x7/JMComic-Crawler-Python.git
synced 2025-11-04 14:49:43 +08:00
59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: 跑测试
|
||
|
||
on:
|
||
schedule:
|
||
- cron: "0 0 * * *"
|
||
workflow_dispatch:
|
||
push:
|
||
branches: [ "dev" ]
|
||
paths:
|
||
- 'src/**/*.py'
|
||
- 'tests/**/*.py'
|
||
- '.github/workflows/test.yml'
|
||
- 'assets/config/option_test.yml'
|
||
|
||
jobs:
|
||
test: # This code is based on https://github.com/gaogaotiantian/viztracer/blob/master/.github/workflows/python-package.yml
|
||
strategy:
|
||
matrix:
|
||
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
|
||
os: [ ubuntu-latest ]
|
||
runs-on: ${{ matrix.os }}
|
||
timeout-minutes: 5
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v3
|
||
|
||
- name: Set up Python ${{ matrix.python-version }}
|
||
uses: actions/setup-python@v4
|
||
with:
|
||
python-version: ${{ matrix.python-version }}
|
||
|
||
- name: Install dependencies
|
||
if: matrix.os != 'windows-latest'
|
||
run: |
|
||
python -m pip install --upgrade pip
|
||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||
|
||
- name: Install dependencies on Windows
|
||
if: matrix.os == 'windows-latest'
|
||
run: |
|
||
python -m pip install --upgrade pip
|
||
if (Test-Path -Path '.\requirements-dev.txt' -PathType Leaf) {pip install -r requirements-dev.txt}
|
||
|
||
- name: Install local
|
||
run: |
|
||
pip install -e ./
|
||
|
||
- name: 跑测试
|
||
if: matrix.os != 'windows-latest'
|
||
run: |
|
||
cd ./tests/
|
||
python -m unittest
|
||
|
||
- name: 跑测试(Windows系统)
|
||
if: matrix.os == 'windows-latest'
|
||
run: |
|
||
python -m unittest discover -s ./tests -p "test_*.py"
|