Skip to content

Commit 06c3c1e

Browse files
Testing changes before merging to main
1 parent 6234b60 commit 06c3c1e

File tree

4 files changed

+532
-236
lines changed

4 files changed

+532
-236
lines changed

.github/workflows/python-ci.yml

Lines changed: 87 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,121 @@
11
# Name of the GitHub Actions workflow
2-
name: Python Virtual Environment Setup CI
2+
name: Python Virtual Environment Creator Tests
33

4-
# Define when this workflow should run
4+
# Define when this workflow should be triggered
55
on:
6+
# Trigger on push events to main and develop branches
67
push:
7-
branches: [ main ] # Trigger on pushes to main branch
8+
branches: [ main, develop ]
9+
# Trigger on pull requests to main and develop branches
810
pull_request:
9-
branches: [ main ] # Trigger on pull requests to main branch
11+
branches: [ main, develop ]
1012

11-
# Define the jobs to run
13+
# Define the jobs to run as part of this workflow
1214
jobs:
13-
# First job: testing across different OS and Python versions
15+
# Job for running tests across different environments
1416
test:
15-
# Dynamic OS selection based on matrix strategy
17+
# Dynamic name showing OS and Python version being tested
18+
name: Test on ${{ matrix.os }} / Python ${{ matrix.python-version }}
19+
# OS to run the job on, pulled from matrix strategy
1620
runs-on: ${{ matrix.os }}
1721
strategy:
22+
# Continue running other matrix combinations even if one fails
23+
fail-fast: false
24+
# Define test matrix - will run tests on all combinations of these
1825
matrix:
19-
# Define test matrix: will run tests on all combinations of these
20-
os: [ubuntu-latest, windows-latest, macos-latest] # Test on all major OS
21-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] # Test on multiple Python versions
26+
os: [ubuntu-latest, windows-latest, macos-latest]
27+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2228

2329
steps:
24-
# Step 1: Check out the repository code
30+
# Check out the repository code
2531
- uses: actions/checkout@v3
26-
27-
# Step 2: Set up Python environment
32+
33+
# Set up Python environment with specified version
2834
- name: Set up Python ${{ matrix.python-version }}
2935
uses: actions/setup-python@v4
3036
with:
3137
python-version: ${{ matrix.python-version }}
32-
33-
# Step 3: Install required Python packages
38+
architecture: x64
39+
40+
# Install required Python packages for testing
3441
- name: Install dependencies
3542
run: |
36-
python -m pip install --upgrade pip # Upgrade pip to latest version
37-
pip install pytest pytest-cov flake8 # Install testing and linting tools
38-
39-
# Step 4: Run code quality checks with flake8
40-
- name: Lint with flake8
41-
run: |
42-
# Check for specific critical errors
43-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
44-
# Check overall code quality
45-
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
46-
47-
# Step 5: Create a test virtual environment
48-
- name: Create test virtual environment
43+
python -m pip install --upgrade pip
44+
pip install pytest pytest-cov mypy types-setuptools
45+
46+
# Run static type checking with mypy in strict mode
47+
- name: Run type checking
4948
run: |
50-
python -m venv test_venv
51-
52-
# Step 6: Run tests with coverage reporting
53-
- name: Test VenvCreator
49+
mypy venv_creator.py test_venv_creator.py --strict
50+
51+
# Run tests with pytest and generate coverage report
52+
- name: Run tests with coverage
5453
run: |
55-
pytest --cov=. --cov-report=xml # Run tests and generate coverage report
56-
57-
# Step 7: Upload coverage reports to Codecov
54+
pytest test_venv_creator.py -v --cov=. --cov-report=xml
55+
56+
# Upload test coverage data to Codecov
5857
- name: Upload coverage to Codecov
5958
uses: codecov/codecov-action@v3
6059
with:
61-
file: ./coverage.xml # Coverage report file
62-
flags: unittests # Tag these results as unit tests
63-
fail_ci_if_error: true # Fail if upload to Codecov fails
60+
file: ./coverage.xml
61+
flags: unittests
62+
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
63+
fail_ci_if_error: false
64+
65+
# Job for code linting checks
66+
lint:
67+
name: Lint
68+
runs-on: ubuntu-latest
69+
steps:
70+
# Check out repository code
71+
- uses: actions/checkout@v3
72+
73+
# Set up Python 3.11 environment for linting
74+
- name: Set up Python
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: '3.11'
78+
79+
# Install linting tools
80+
- name: Install dependencies
81+
run: |
82+
python -m pip install --upgrade pip
83+
pip install flake8 black isort
84+
85+
# Run various linting checks:
86+
# - flake8 for code style and errors
87+
# - black for code formatting
88+
# - isort for import sorting
89+
- name: Run linters
90+
run: |
91+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
92+
black . --check
93+
isort . --check-only --profile black
6494
65-
# Second job: security scanning
95+
# Job for security vulnerability scanning
6696
security:
67-
runs-on: ubuntu-latest # Security checks only need to run on one OS
97+
name: Security checks
98+
runs-on: ubuntu-latest
6899
steps:
69-
# Step 1: Check out the repository code
100+
# Check out repository code
70101
- uses: actions/checkout@v3
71-
72-
# Step 2: Set up Python environment
102+
103+
# Set up Python 3.11 environment for security checks
73104
- name: Set up Python
74105
uses: actions/setup-python@v4
75106
with:
76-
python-version: '3.10' # Use Python 3.10 for security checks
77-
78-
# Step 3: Install security scanning tools
79-
- name: Install security scanning tools
107+
python-version: '3.11'
108+
109+
# Install security scanning tools
110+
- name: Install dependencies
80111
run: |
81-
pip install bandit safety # bandit for code scanning, safety for dependency checking
82-
83-
# Step 4: Run security scans
84-
- name: Run security scan
112+
python -m pip install --upgrade pip
113+
pip install bandit safety
114+
115+
# Run security checks:
116+
# - bandit for code security issues
117+
# - safety for known vulnerabilities in dependencies
118+
- name: Run security checks
85119
run: |
86-
bandit -r . # Recursively scan all Python files for security issues
87-
safety check # Check dependencies for known security vulnerabilities
120+
bandit -r . -c pyproject.toml
121+
safety check

.gitignore

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110+
.pdm.toml
111+
.pdm-python
112+
.pdm-build/
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115+
__pypackages__/
116+
117+
# Celery stuff
118+
celerybeat-schedule
119+
celerybeat.pid
120+
121+
# SageMath parsed files
122+
*.sage.py
123+
124+
# Environments
125+
.env
126+
.venv
127+
env/
128+
venv/
129+
ENV/
130+
env.bak/
131+
venv.bak/
132+
133+
# Spyder project settings
134+
.spyderproject
135+
.spyproject
136+
137+
# Rope project settings
138+
.ropeproject
139+
140+
# mkdocs documentation
141+
/site
142+
143+
# mypy
144+
.mypy_cache/
145+
.dmypy.json
146+
dmypy.json
147+
148+
# Pyre type checker
149+
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
#.idea/

0 commit comments

Comments
 (0)