feat: introduce ruff for linter #50
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ci-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# We have to update setuptools wheel to package with package_data, LICENSE, NOTICE | |
env: | |
DEPENDENCES: pip setuptools wheel tox | |
jobs: | |
dead-link: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo npm install -g markdown-link-check@3.10.0 | |
- run: | | |
for file in $(find . -name "*.md"); do | |
markdown-link-check -c .dlc.json -q "$file" | |
done | |
lint: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Dependences | |
run: | | |
python -m pip install --upgrade ${{ env.DEPENDENCES }} | |
- name: Run All Lint Check | |
run: | | |
python -m tox -vv -e lint | |
pytest: | |
timeout-minutes: 15 | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# YAML parse `3.10` to `3.1`, so we have to add quotes for `'3.10'`, see also: | |
# https://github.com/actions/setup-python/issues/160#issuecomment-724485470 | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependences | |
run: | | |
python -m pip install --upgrade ${{ env.DEPENDENCES }} | |
- name: Run All Tests | |
run: | | |
python -m tox -vv -e code-test | |
- uses: codecov/codecov-action@v3 | |
# Codecov have a 100-upload limit per commit, and there are 3 * 6 files upload each time run pytest, | |
# We should not run upload in schedule GitHub event, because the sixth day we do not change our code | |
# and the upload limit will be reached 3 * 6 * 6. For more detail can see: | |
# https://community.codecov.com/t/ci-failure-due-to-too-many-uploads-to-this-commit/2587/7 | |
if: ${{ github.event_name != 'schedule' }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
verbose: true | |
local-ci: | |
timeout-minutes: 15 | |
needs: | |
- pytest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Dependences | |
run: | | |
python -m pip install --upgrade ${{ env.DEPENDENCES }} | |
- name: Run Tests Build Docs | |
run: | | |
python -m tox -vv -e local-ci |