.github/workflows/ci.yml
name: CI
on:
- push
- pull_request
env:
PYTHON_VERSION: "3.10"
jobs:
codestyle:
name: Codestyle (black+isort)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Check code formatting with black and isort
run: poe black --diff --check && poe isort --diff --check
# mypy:
# name: mypy
# if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# submodules: recursive
#
# - name: Set up Python ${{ env.PYTHON_VERSION }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
#
# - name: Cache Virtual Environment
# uses: actions/cache@v3
# with:
# path: |
# ~/.cache/pip
# ~/.cache/pypoetry
# key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
#
# - name: Setup poetry
# run: |
# pip install poetry poethepoet
# poetry install -n --no-root
#
# - name: Check typing with mypy
# run: poe mypy
linter:
name: Linter (flake8)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Check code style with wemake-python-styleguide
run: poe flake8
# - name: Lint with wemake-python-styleguide
# uses: wemake-services/wemake-python-styleguide@0.16.0
# with:
# reporter: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'github-pr-review' || 'terminal' }}
# env:
# GITHUB_TOKEN: ${{ secrets.github_token }}
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check cog docs
run: |
set -e
if ! [[ -f pubsub.md ]]; then
echo ::error::Could not find pubsub documentation
exit 1
fi
ok=1
for category in */; do
cd $category
for cog in $(ls); do
[[ -d $cog ]] || continue
if ! [[ -f $cog/documentation.md ]]; then
ok=0
echo ::error::Could not find documentation for $category$cog
fi
done
cd ..
done
if [[ $ok -ne 1 ]]; then
exit 1
fi
- name: Lint docs
uses: docker://avtodev/markdown-lint:v1
with:
config: .linter.yml
args: .