Feature/test branch #5
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Name of the GitHub Actions workflow | |
| name: Python Virtual Environment Creator Tests | |
| # Define when this workflow should be triggered | |
| on: | |
| # Trigger on push events to main and develop branches | |
| push: | |
| branches: [ main, develop ] | |
| # Trigger on pull requests to main and develop branches | |
| pull_request: | |
| branches: [ main, develop ] | |
| # Define the jobs to run as part of this workflow | |
| jobs: | |
| # Job for running tests across different environments | |
| test: | |
| # Dynamic name showing OS and Python version being tested | |
| name: Test on ${{ matrix.os }} / Python ${{ matrix.python-version }} | |
| # OS to run the job on, pulled from matrix strategy | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| # Continue running other matrix combinations even if one fails | |
| fail-fast: false | |
| # Define test matrix - will run tests on all combinations of these | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| # Check out the repository code | |
| - uses: actions/checkout@v3 | |
| # Set up Python environment with specified version | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: x64 | |
| # Install required Python packages for testing | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # Run static type checking with mypy in strict mode | |
| - name: Run type checking | |
| run: | | |
| mypy src tests | |
| # Run tests with pytest and generate coverage report | |
| - name: Run tests with coverage | |
| run: | | |
| pytest tests -v --cov=src. --cov-report=xml | |
| # Upload test coverage data to Codecov | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} | |
| fail_ci_if_error: false | |
| # Job for code linting checks | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out repository code | |
| - uses: actions/checkout@v3 | |
| # Set up Python 3.11 environment for linting | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| # Install linting tools | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install -r requirements.txt | |
| # Run various linting checks: | |
| # - flake8 for code style and errors | |
| # - black for code formatting | |
| # - isort for import sorting | |
| - name: Run linters # noqa: E501 | |
| run: | | |
| flake8 src tests | |
| black src tests --check | |
| isort src tests --check-only --profile black # noqa: E501 | |
| # Job for security vulnerability scanning | |
| security: | |
| name: Security checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out repository code | |
| - uses: actions/checkout@v3 | |
| # Set up Python 3.11 environment for security checks | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| # Install security scanning tools | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install -r requirements.txt | |
| # Run security checks: | |
| # - bandit for code security issues | |
| # - safety for known vulnerabilities in dependencies | |
| - name: Run security checks | |
| run: | | |
| bandit -r src tests |