CodeQL #180
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: CodeQL | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: 45 13 * * 6 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-python-${{ matrix.python-version }}-codeql-${{ hashFiles('requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-python-${{ matrix.python-version }}-codeql-${{ hashFiles('requirements*.txt') }} | |
${{ runner.os }}-python-${{ matrix.python-version }}-codeql- | |
${{ runner.os }}-python | |
${{ runner.os }}- | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip setuptools wheel | |
- name: Install dependencies | |
run: | | |
pip install -I -r requirements.txt -r requirements-dev.txt | |
# Set the `CODEQL-PYTHON` environment variable to the Python executable | |
# that includes the dependencies | |
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV | |
- name: Run flake8 | |
run: flake8 --count --max-line-length=120 . | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: python | |
# If you wish to specify custom queries, you can do so here or in a config file. | |
# By default, queries listed here will override any specified in a config file. | |
# Prefix the list here with "+" to use these queries and those in the config file. | |
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | |
# queries: security-extended,security-and-quality | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
with: | |
category: /language:python |