Restructure files #1
This file contains 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: VisionSync CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["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 dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest pytest-cov pytest-asyncio mypy black isort safety | |
- name: Run tests | |
run: | | |
pytest | |
- name: Type checking | |
run: | | |
mypy core systems | |
- name: Code formatting | |
run: | | |
black --check core systems tests | |
isort --check-only core systems tests | |
- name: Security check | |
run: | | |
safety check | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pylint | |
- name: Lint with flake8 | |
run: | | |
flake8 core systems tests --count --max-complexity=10 --max-line-length=88 --statistics | |
- name: Lint with pylint | |
run: | | |
pylint core systems tests | |
docker: | |
runs-on: ubuntu-latest | |
needs: [test, lint] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: | | |
visionsync/core:latest | |
visionsync/core:${{ github.sha }} | |
cache-from: type=registry,ref=visionsync/core:buildcache | |
cache-to: type=registry,ref=visionsync/core:buildcache,mode=max | |
deploy: | |
runs-on: ubuntu-latest | |
needs: docker | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to production | |
run: | | |
echo "Deploying VisionSync version ${{ github.sha }}" | |
# Add actual deployment steps here |