Skip to content

Commit ef89f2d

Browse files
authored
Merge branch 'dev' into work-fans-page
2 parents 6a62a77 + 3e3583b commit ef89f2d

File tree

7 files changed

+869
-3
lines changed

7 files changed

+869
-3
lines changed

.github/workflows/codeql.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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 Advanced"
13+
14+
on:
15+
push:
16+
paths-ignore:
17+
- 'BlocksScreen/lib/ui/**'
18+
- 'extras/**'
19+
- 'scripts/**'
20+
pull_request:
21+
paths-ignore:
22+
- 'BlocksScreen/lib/ui/**'
23+
- 'extras/**'
24+
- 'scripts/**'
25+
schedule:
26+
- cron: '27 5 * * 0'
27+
28+
jobs:
29+
analyze:
30+
name: Analyze (${{ matrix.language }})
31+
# Runner size impacts CodeQL analysis time. To learn more, please see:
32+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
33+
# - https://gh.io/supported-runners-and-hardware-resources
34+
# - https://gh.io/using-larger-runners (GitHub.com only)
35+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
36+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
37+
permissions:
38+
# required for all workflows
39+
security-events: write
40+
41+
# required to fetch internal or private CodeQL packs
42+
packages: read
43+
44+
# only required for workflows in private repositories
45+
actions: read
46+
contents: read
47+
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
include:
52+
- language: python
53+
build-mode: none
54+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
55+
# Use `c-cpp` to analyze code written in C, C++ or both
56+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
57+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
58+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
59+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
60+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
61+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
66+
# Add any setup steps before running the `github/codeql-action/init` action.
67+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
68+
# or others). This is typically only required for manual builds.
69+
# - name: Setup runtime (example)
70+
# uses: actions/setup-example@v1
71+
72+
# Initializes the CodeQL tools for scanning.
73+
- name: Initialize CodeQL
74+
uses: github/codeql-action/init@v4
75+
with:
76+
languages: ${{ matrix.language }}
77+
build-mode: ${{ matrix.build-mode }}
78+
# If you wish to specify custom queries, you can do so here or in a config file.
79+
# By default, queries listed here will override any specified in a config file.
80+
# Prefix the list here with "+" to use these queries and those in the config file.
81+
82+
# For more 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
83+
# queries: security-extended,security-and-quality
84+
85+
# If the analyze step fails for one of the languages you are analyzing with
86+
# "We were unable to automatically build your code", modify the matrix above
87+
# to set the build mode to "manual" for that language. Then modify this step
88+
# to build your code.
89+
# ℹ️ Command-line programs to run using the OS shell.
90+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
91+
- name: Run manual build steps
92+
if: matrix.build-mode == 'manual'
93+
shell: bash
94+
run: |
95+
echo 'If you are using a "manual" build mode for one or more of the' \
96+
'languages you are analyzing, replace this with the commands to build' \
97+
'your code, for example:'
98+
echo ' make bootstrap'
99+
echo ' make release'
100+
exit 1
101+
102+
- name: Perform CodeQL Analysis
103+
uses: github/codeql-action/analyze@v4
104+
with:
105+
category: "/language:${{matrix.language}}"

.github/workflows/dev-ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: dev-test-code
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths-ignore:
8+
- "scripts/**"
9+
- "BlocksScreen/lib/ui/**"
10+
- "extras/**"
11+
pull_request:
12+
branches:
13+
- dev
14+
paths-ignore:
15+
- "scripts/**"
16+
- "BlocksScreen/lib/ui/**"
17+
- "extras/**"
18+
jobs:
19+
ci-checks:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version: ["3.11.2"]
25+
test-type: [ruff, pylint, pytest]
26+
steps:
27+
- name: Checkout repo
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
cache: "pip"
35+
- name: Install dependencies
36+
run: |
37+
echo "Installing dependencies"
38+
python -m pip install --upgrade pip
39+
pip install scripts -r scripts/requirements-dev.txt
40+
41+
- name: Run Test ${{ matrix.test-type }}
42+
run: |
43+
echo "Starting test runs"
44+
if [ "${{ matrix.test-type }}" == "ruff" ]; then
45+
echo "Running Formatting Test"
46+
ruff check --output-format=github --target-version=py311 --config=pyproject.toml > ruff-output.txt 2>&1
47+
ruff format --diff --target-version=py311 --config=pyproject.toml >> ruff-output.txt 2>&1
48+
echo "Ruff finished"
49+
fi
50+
if [ "${{ matrix.test-type }}" == "pylint" ]; then
51+
echo "Running Code Test"
52+
pylint -j$(nproc) --recursive=y --rcfile=.pylintrc.dev . > pylint-output.txt 2>&1
53+
echo "Pylint finished"
54+
fi
55+
56+
if [ "${{ matrix.test-type }}" == "pytest" ]; then
57+
if [ -d "tests/" ] && [ "$(ls -A tests/)" ]; then
58+
echo "Running Python unit tests"
59+
pytest tests/'*.py' --doctest-modules --junitxml=junit/test-results.xml --cov=com --conv-report=xml --cov-report=html > pytest-output.txt 2>&1
60+
else
61+
echo "No tests directory no need to proceed with tests"
62+
fi
63+
fi
64+
65+
- name: Upload ruff artifact
66+
if: always() && matrix.test-type == 'ruff'
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ruff-results
70+
path: ruff-output.txt
71+
72+
- name: Upload Pylint Artifacts
73+
if: always() && matrix.test-type == 'pylint'
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: pylint-results
77+
path: pylint-output.txt
78+
79+
- name: Upload Pytest Artifacts
80+
if: always() && matrix.test-type == 'pytest' && hashFiles('pytest-output.txt', 'junit/test-results.xml', 'coverage.xml')
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: pytest-results
84+
path: |
85+
pytest_output.txt
86+
junit/test-results.xml
87+
coverage.xml
88+
htmlcov/
89+

.pylintrc.dev

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[MAIN]
2+
fail-under=7
3+
jobs=16
4+
ignore=tests,scripts,ui,extras
5+
ignore-paths=BlocksScreen/lib/ui
6+
py-version=3.11
7+
8+
9+
[FORMAT]
10+
max-line-length=88
11+

scripts/dev-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

scripts/requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ruff
2+
pylint
3+
pytest
4+
pytest-cov

scripts/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pefile==2023.2.7
77
PyQt6==6.7.1
88
PyQt6-Qt6==6.7.2
99
PyQt6_sip==13.8.0
10-
requests==2.32.3
10+
requests==2.32.4
1111
sdbus==0.12.0
1212
sdbus-networkmanager==2.0.0
1313
typing==3.7.4.3

0 commit comments

Comments
 (0)