Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Workflows #1750

Merged
merged 9 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/workflows/bandit.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/check.yml
@@ -0,0 +1,38 @@
name: Checks
on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "requirements-dev.txt"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- run:
codespell --ignore-words-list="groupt,nd,ot,ro,falsy,BU" \
--exclude-file=".github/workflows/codespell.yml"
bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "requirements-dev.txt"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- run: bandit --recursive --skip B101,B104,B105,B110,B307,B311,B404,B603,B607 .
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -17,6 +17,10 @@ on:
schedule:
- cron: "26 6 * * 6"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
analyze:
# if: github.event.pull_request.user.type != 'Bot' && !contains(github.event.pull_request.labels.*.name, 'skip-ci')
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/codespell.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/docs.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,53 @@
name: Type Check and Lint
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "requirements-dev.txt"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Setup cache
id: cache-pylint
uses: actions/cache@v3
with:
path: .pylint.d
key: pylint
- name: Analyse code with pylint
run: |
pylint discord/ --exit-zero
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "requirements-dev.txt"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Setup cache
id: cache-mypy
uses: actions/cache@v3
with:
path: .mypy_cache
key: mypy
- name: Make mypy cache directory
run: mkdir -p -v .mypy_cache
- name: Run type checks with Mypy
run: mypy --non-interactive discord/
12 changes: 0 additions & 12 deletions .github/workflows/mypy.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/pylint.yml

This file was deleted.

57 changes: 43 additions & 14 deletions .github/workflows/python-app.yml → .github/workflows/test.yml
@@ -1,12 +1,13 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: Unit Tests

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -16,16 +17,24 @@ jobs:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3.1.0
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements-dev.txt"
check-latest: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements-dev.txt
- name: Setup cache
id: cache-pytest
uses: actions/cache@v3
with:
path: .pytest_cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-pytest
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -39,10 +48,30 @@ jobs:
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
files: ./coverage.xml
flags: pytest # optional
name: codecov-umbrella # optional
fail_ci_if_error: false # Enable once we have good coverage
verbose: true # optional (default = false)
files: coverage.xml
flags: ${{ matrix.os }}-${{ matrix.python-version }}
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install -U pip
pip install ".[docs]"
- name: Check Links
run: |
cd docs
make linkcheck
- name: Compile to html
run: |
cd docs
make html
3 changes: 3 additions & 0 deletions requirements-dev.txt
Expand Up @@ -6,3 +6,6 @@ pytest-asyncio~=0.20.1
mypy~=0.982
coverage~=6.5
pre-commit==2.20.0
codespell==2.1.0
bandit==1.7.4
flake8==5.0.4