Skip to content

CodeQL

CodeQL #277

name: CodeQL
on:
push:
branches:
- master
paths:
- "nikas/**"
- ".github/workflows/codeql-analysis.yml"
pull_request:
branches:
- master
paths:
- "nikas/**"
- ".github/workflows/codeql-analysis.yml"
schedule:
- cron: "0 10 * * 6"
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript", "python"]
os: ["ubuntu-latest"]
python-version: ["3.9", "3.10"]
steps:
- name: Cancel previous workflow
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
if: matrix.language == 'python'
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
# Dependencies are in setup.py, so use it as cache key
cache-dependency-path: "setup.py"
- name: Install dependencies
# Use pip instead of python setup.py develop to get caching from
# "setup-python" action
run: pip install -e .
if: matrix.language == 'python'
- name: Install test suite & style check dependencies
run: pip install pytest pytest-cov flake8 nose
if: matrix.language == 'python'
- name: Create .env
uses: 1arp/[email protected]
if: matrix.language == 'python'
with:
file: ".env.pypi"
content: |
PYPI_TEST_PASSWORD=password
PYPI_TOKEN=pypi-AgEIc1233S5
- name: Run style check
if: matrix.language == 'python'
run: make flakes
- name: Run coverage check, fail if <70%
if: matrix.language == 'python'
run: |
make coverage
coverage report --fail-under 70