Add black lint & workflow reorganization

This commit is contained in:
Devon R 2022-02-22 07:38:37 +00:00 committed by GitHub
parent 70b577e94b
commit 76983d7c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 37 deletions

View File

@ -6,18 +6,23 @@ on:
types: [ opened, edited ]
jobs:
build-dists:
dists-and-docs:
runs-on: ubuntu-latest
name: dists
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.x' ]
name: dists & docs ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up CPython
- name: Set up CPython ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
@ -34,40 +39,33 @@ jobs:
name: distributions
path: dist/*
build-docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ en, ja ]
name: docs (${{ matrix.language }})
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up CPython
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
# Install all features
pip install -e .[docs,speed,voice]
- name: Build docs
shell: bash
run: |
cd docs && sphinx-build -b html -D language=${SPHINX_LANGUAGE} -a -n -T -W --keep-going . _build
env:
SPHINX_LANGUAGE: ${{ matrix.language }}
cd docs
- name: Upload artifacts
EXIT_STATUS=0
# Build English docs
sphinx-build -b html -D language=en -a -n -T -W --keep-going . _build_en || EXIT_STATUS=$?
# Build Japanese docs
sphinx-build -b html -D language=ja -a -n -T -W --keep-going . _build_ja || EXIT_STATUS=$?
exit ${EXIT_STATUS}
- name: Upload EN docs
uses: actions/upload-artifact@v2
if: always()
with:
name: docs-${{matrix.language}}
path: docs/_build/*
name: docs-en
path: docs/_build_en/*
- name: Upload JA docs
uses: actions/upload-artifact@v2
if: always()
with:
name: docs-ja
path: docs/_build_ja/*

View File

@ -1,4 +1,4 @@
name: pyright
name: lint
on:
push:
@ -8,20 +8,26 @@ on:
jobs:
check:
runs-on: ubuntu-latest
name: check
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.x' ]
name: check ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up CPython
- name: Set up CPython ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: ${{ matrix.python-version }}
- name: Install dependencies
id: install-deps
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip setuptools wheel black
pip install -U -r requirements.txt
- name: Setup node.js
@ -33,8 +39,13 @@ jobs:
run: |
npm install -g pyright
- name: Type check
- name: Run pyright
run: |
# It is OK for the types to not pass at this stage
# We are just running it as a quick reference check
pyright || echo "Type checking did not pass"
- name: Run black
if: ${{ always() && steps.install-deps.outcome == 'success' }}
run: |
black --check --verbose discord