Merge pull request #20 from wey-gu/more_coverage #80
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| node-version: ["22"] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[all]" | |
| pip install -e ".[dev]" | |
| pip install types-psutil | |
| - name: Run stable tests and examples | |
| # As the coverage trigger already runs the tests, we don't need to run them again. | |
| if: matrix.python-version != '3.11' | |
| run: | | |
| python scripts/dev.py | |
| env: | |
| PYTHONPATH: . | |
| - name: Generate coverage report for codecov | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| pip install coverage[toml] pytest-cov | |
| pytest tests/ examples/ --cov=py_pglite --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true | |
| files: ./coverage.xml | |
| name: codecov-umbrella | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| test-package: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Test package installation | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| pip install dist/*.whl | |
| - name: Test installed package | |
| run: | | |
| python -c "import py_pglite; print(f'Successfully imported py-pglite {py_pglite.__version__}')" | |
| python -c "from py_pglite import PGliteManager, PGliteConfig; print('All imports working')" | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install safety bandit[toml] | |
| - name: Run Safety CLI to check for vulnerabilities | |
| uses: pyupio/safety-action@v1 | |
| with: | |
| api-key: ${{ secrets.SAFETY_API_KEY }} | |
| - name: Security scan with Bandit | |
| run: | | |
| bandit -r py_pglite/ -c .bandit -f json -o bandit-report.json || true | |
| bandit -r py_pglite/ -c .bandit |