Skip to content

Add entry point script for Prism Viewer desktop application and gener… #3

Add entry point script for Prism Viewer desktop application and gener…

Add entry point script for Prism Viewer desktop application and gener… #3

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run Python tests
run: |
pytest tests/ --cov=src --cov-report=xml --cov-report=html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: python
name: python-coverage
test-django:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Django dependencies
run: |
cd src/web/backend
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Django tests
run: |
cd src/web/backend
python manage.py test
- name: Check Django migrations
run: |
cd src/web/backend
python manage.py makemigrations --check --dry-run
test-react:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: src/web/frontend/package-lock.json
- name: Install React dependencies
run: |
cd src/web/frontend
npm ci
- name: Run React tests
run: |
cd src/web/frontend
npm test -- --coverage --watchAll=false
- name: Build React app
run: |
cd src/web/frontend
npm run build
lint-and-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8 black isort
- name: Run Python linting
run: |
flake8 src/ tests/ --max-line-length=88 --extend-ignore=E203,W503
black --check src/ tests/
isort --check-only src/ tests/
- name: Set up Node.js for ESLint
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install and run ESLint
run: |
cd src/web/frontend
npm ci
npm run lint || true # Don't fail on lint errors for now
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Bandit security scan
run: |
python -m pip install bandit
bandit -r src/ -f json -o bandit-report.json || true
- name: Run Safety check
run: |
python -m pip install safety
safety check --json --output safety-report.json || true
- name: Upload security reports
uses: actions/upload-artifact@v3
with:
name: security-reports
path: |
bandit-report.json
safety-report.json
build-desktop:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build desktop application
run: |
pyinstaller --onefile --windowed --name PrismViewer src/desktop/main_window.py
- name: Upload desktop build
uses: actions/upload-artifact@v3
with:
name: desktop-build-${{ matrix.os }}
path: dist/
deploy-staging:
runs-on: ubuntu-latest
needs: [test-python, test-django, test-react, lint-and-format]
if: github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v3
- name: Deploy to staging
run: |
echo "Deploying to staging environment..."
# Add actual deployment commands here
deploy-production:
runs-on: ubuntu-latest
needs: [test-python, test-django, test-react, lint-and-format, security-scan]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Deploy to production
run: |
echo "Deploying to production environment..."
# Add actual deployment commands here