Skip to content

Commit fdcd18b

Browse files
author
Helga UK
committed
ci: add CodeQL and ruff workflows
1 parent 6407871 commit fdcd18b

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

.env

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ── Logging ───────────────────────────────────────────────────────────────────
2+
WRITE_LOG_TO_DISK = True
3+
LOGGING_LEVEL = INFO
4+
DIR_LOGS = /home/helga/logs
5+
6+
# ── Telegram ──────────────────────────────────────────────────────────────────
7+
TELEGRAM_ENABLED = True
8+
TELEGRAM_BOT_KEY = '719820567:AAFemM86lRaHyAfep79j-FxMmSgRu2bfCqI'
9+
TELEGRAM_BOT_CHAT_ID = '-1001339599443'
10+
11+
# ── Google Maps ───────────────────────────────────────────────────────────────
12+
MAPS_API_KEY = '-1001339599443'
13+
14+
# ── Feature flags ─────────────────────────────────────────────────────────────
15+
ENABLE_NGINX_MONITOR = true
16+
ENABLE_UNIFI_MONITOR = false
17+
ENABLE_HA_MONITOR = true
18+
ENABLE_FAIL2BAN_MONITOR = true
19+
20+
# ── Log file paths ────────────────────────────────────────────────────────────
21+
LOG_PATH_USER = /var/log/user.log
22+
LOG_PATH_AUTH = /var/log/auth.log
23+
LOG_PATH_FAIL2BAN = /var/log/fail2ban.log
24+
LOG_PATH_HA = /home/helga/nfs/k8sdata/home-assistant/home-assistant.log
25+
LOG_PATH_UNIFI =
26+
27+
# ── Nginx container log glob ──────────────────────────────────────────────────
28+
NGINX_LOG_GLOB = /var/log/containers/mortylabs-web-*_default_mortylabs-web-*.log
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
on:
14+
push:
15+
branches: [ main ]
16+
pull_request:
17+
# The branches below must be a subset of the branches above
18+
branches: [ main ]
19+
schedule:
20+
- cron: '0 6 * * 1' # Monday 06:00 UTC - start the week with a clean bill
21+
jobs:
22+
analyze:
23+
name: Analyze
24+
runs-on: ubuntu-latest
25+
permissions:
26+
actions: read
27+
contents: read
28+
security-events: write
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
language: [ 'python' ]
33+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
34+
# Learn more:
35+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.11'
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
49+
50+
# Initializes the CodeQL tools for scanning.
51+
- name: Initialize CodeQL
52+
uses: github/codeql-action/init@v4
53+
with:
54+
languages: ${{ matrix.language }}
55+
queries: +security-extended,security-and-quality
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
60+
61+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
62+
# If this step fails, then you should remove it and run the build manually (see below)
63+
- name: Autobuild
64+
uses: github/codeql-action/autobuild@v4
65+
66+
# ℹ️ Command-line programs to run using the OS shell.
67+
# 📚 https://git.io/JvXDl
68+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
69+
# and modify them (or add more) to build your code if your project
70+
# uses a compiled language
71+
#- run: |
72+
# make bootstrap
73+
# make release
74+
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@v4
77+
with:
78+
category: "/language:python"
79+
output: results
80+
81+
- name: Upload SARIF results as artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: codeql-results
85+
path: results
86+
retention-days: 30

.github/workflows/ruff.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Ruff"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
ruff:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: astral-sh/ruff-action@v3

0 commit comments

Comments
 (0)