File size: 2,900 Bytes
4610542
 
 
 
 
668e783
 
 
 
4610542
668e783
4610542
 
 
 
 
668e783
 
4610542
 
 
668e783
 
 
 
4610542
668e783
4610542
668e783
4610542
 
668e783
 
 
 
 
 
 
4610542
 
 
668e783
4610542
668e783
4610542
668e783
 
 
 
4610542
668e783
4610542
 
 
 
 
 
 
 
 
668e783
4610542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668e783
4610542
 
 
668e783
 
4610542
668e783
 
 
4610542
668e783
4610542
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# .github/workflows/ci.yaml
# --------------------------------------------------------------
# AnyCoder AI – Continuous Integration pipeline
# --------------------------------------------------------------

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  PYTHON_VERSION_MATRIX: "3.9,3.10,3.11"
  DOCKER_IMAGE: anycoder:latest

jobs:
# --------------------------------------------------------------
# 1.  Lint & Test (Python)
# --------------------------------------------------------------
  lint-and-test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [${{ fromJSON(env.PYTHON_VERSION_MATRIX) }}]
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install flake8 pytest nbmake
          # style / typing (optional)
          pip install black==24.2.0 mypy

      - name: Lint with flake8 & black‑check
        run: |
          black --check .
          flake8 .

      - name: Run pytest
        run: |
          pytest -q

      - name: Validate notebooks with nbmake
        run: |
          pytest --nbmake notebooks/

# --------------------------------------------------------------
# 2.  Build static front‑end (HTML/CSS/JS) – no node needed
# --------------------------------------------------------------
  build-frontend:
    runs-on: ubuntu-latest
    needs: lint-and-test
    steps:
      - uses: actions/checkout@v4
      - name: Archive static assets
        uses: actions/upload-artifact@v4
        with:
          name: static-assets
          path: |
            static/index.html
            static/style.css
            static/index.js

# --------------------------------------------------------------
# 3.  Docker build & (optional) publish
# --------------------------------------------------------------
  build-and-deploy:
    runs-on: ubuntu-latest
    needs:
      - lint-and-test
      - build-frontend
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    steps:
      - uses: actions/checkout@v4

      - name: Build Docker image
        run: |
          docker build -t ${{ env.DOCKER_IMAGE }} .

      # Optionally push to GHCR / DockerHub
      # - name: Log in to registry
      #   uses: docker/login-action@v3
      #   with:
      #     registry: ghcr.io
      #     username: ${{ github.actor }}
      #     password: ${{ secrets.GHCR_TOKEN }}
      #
      # - name: Push image
      #   run: |
      #     docker tag ${{ env.DOCKER_IMAGE }} ghcr.io/${{ github.repository }}:latest
      #     docker push ghcr.io/${{ github.repository }}:latest