Skip to content

Merge pull request #224 from andthum/dependabot/pip/flake8-pytest-sty… #613

Merge pull request #224 from andthum/dependabot/pip/flake8-pytest-sty…

Merge pull request #224 from andthum/dependabot/pip/flake8-pytest-sty… #613

# Scan the code for security vulnerabilities with CodeQL.
# See https://github.com/github/codeql-action
name: "CodeQL"
on:
push:
branches:
- "main"
- "develop"
pull_request:
# The branches below must be a subset of the branches above.
branches:
- "main"
- "develop"
jobs:
scan:
strategy:
matrix:
os:
- "ubuntu-latest"
python-version:
- "3.9"
runs-on: "${{ matrix.os }}"
permissions:
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: "${{ matrix.python-version }}"
- name: "Export ${HOME}/.local/bin to ${PATH}"
# Executable Python binaries are usually stored there.
run: 'echo "${HOME}/.local/bin" >> ${GITHUB_PATH}'
- name: "Get pip cache dir"
# pip's cache path depends on the operating system. See
# https://github.com/actions/cache/blob/main/examples.md#python---pip
# This requires pip >=20.1.
id: "pip-cache"
run: |
python -m pip install --user --upgrade pip
echo "dir=$(pip cache dir)" >> ${GITHUB_OUTPUT}
- name: "Create/Restore cache"
uses: "actions/cache@v4"
with:
path: "${{ steps.pip-cache.outputs.dir }}/**"
key: |
${{ runner.os }}-${{ matrix.python-version }}-${{ github.job }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}
${{ runner.os }}
- name: "Install/Upgrade setuptools and wheel"
run: "python -m pip install --user --upgrade setuptools wheel"
- name: "Install/Upgrade requirements of MDTools"
run: |
python -m pip install --user --upgrade -r requirements.txt
# Set the `CODEQL-PYTHON` environment variable to the Python
# executable that includes the dependencies.
echo "CODEQL_PYTHON=$(which python)" >> ${GITHUB_ENV}
- name: "Initialize CodeQL"
uses: "github/codeql-action/init@v3"
with:
languages: "python"
# Override the default behavior so that the action doesn't
# attempt to auto-install Python dependencies. See
# https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#analyzing-python-dependencies
setup-python-dependencies: false
- name: "Perform CodeQL Analysis"
uses: "github/codeql-action/analyze@v3"