JMComic-Crawler-Python/.github/workflows/test.yml

59 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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"