From 84d8b16b6523b5a8317c1c8b8c97927d567c596b Mon Sep 17 00:00:00 2001 From: Milad Khoshdel Date: Tue, 15 Sep 2026 23:27:23 +0330 Subject: [PATCH] ci: add quality and security workflows --- .github/workflows/code-quality.yml | 31 ++++++++++++++++++++++++ .github/workflows/codeql.yml | 39 ++++++++++++++++++++++++++++++ .github/workflows/python-tests.yml | 12 +++++++-- 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/code-quality.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..da1735a --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,31 @@ +name: Code quality + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: code-quality-${{ github.ref }} + cancel-in-progress: true + +jobs: + ruff: + name: Ruff + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v7 + + - name: Check for lint violations + uses: astral-sh/ruff-action@v4.1.0 + with: + version: "0.16.0" + args: check --output-format=github + + - name: Check formatting + run: ruff format --check --diff diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..5fad41d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "23 3 * * 1" + workflow_dispatch: + +permissions: + actions: read + contents: read + security-events: write + +concurrency: + group: codeql-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze Python + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Check out repository + uses: actions/checkout@v7 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: python + build-mode: none + queries: security-extended + + - name: Analyze + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index f0cbdae..7a9456c 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -3,6 +3,14 @@ name: Python tests on: push: pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: python-tests-${{ github.ref }} + cancel-in-progress: true jobs: test: @@ -15,10 +23,10 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }}