ci: add type, linting and security checks

This commit is contained in:
Alexandre Teles 2023-04-10 22:08:14 -03:00
parent 00d7cc0cfa
commit 74bb1010da
No known key found for this signature in database
GPG Key ID: DB1C7FA46B1007F0
3 changed files with 97 additions and 0 deletions

16
.github/workflows/black.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Black formatter
on:
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./src"

55
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: "CodeQL"
on:
pull_request:
branches: [ "dev" ]
workflow_dispatch:
env:
default_branch: dev
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.default_branch }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.3'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ];
then pip install -r requirements.txt;
fi
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
setup-python-dependencies: false
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

26
.github/workflows/mypy.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: MyPy
on:
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
mypy:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11.3
architecture: x64
- name: Checkout
uses: actions/checkout@v3
- name: Install mypy
run: pip install mypy
- name: Run mypy
uses: sasanquaneuf/mypy-github-action@main
with:
checkName: 'mypy'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}