Add CI/CD workflows and security policy
This commit is contained in:
53
.github/workflows/test.yml
vendored
Normal file
53
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# Run tests on every push and pull request
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
pull_request:
|
||||
branches: [main, master, develop]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false # Don't cancel other jobs if one fails
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12"]
|
||||
|
||||
steps:
|
||||
# 1. Get the code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# 2. Set up Python
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
# 3. Install system dependencies (for pyzbar QR reading)
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libzbar0
|
||||
|
||||
# 4. Install the package with all dependencies
|
||||
- name: Install package
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
# 5. Run tests with coverage
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest --cov=stegasoo --cov-report=xml --cov-report=term-missing
|
||||
|
||||
# 6. Upload coverage report (optional - integrates with codecov.io)
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
if: matrix.python-version == '3.11' # Only upload once
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
fail_ci_if_error: false # Don't fail if codecov is down
|
||||
Reference in New Issue
Block a user