mgbam commited on
Commit
4610542
·
verified ·
1 Parent(s): c33cb65

Update ci.yaml

Browse files
Files changed (1) hide show
  1. ci.yaml +65 -14
ci.yaml CHANGED
@@ -1,23 +1,34 @@
1
- # ci.yaml
 
 
 
 
2
  name: CI
3
 
4
  on:
5
  push:
6
- branches: [ main ]
7
  pull_request:
8
- branches: [ main ]
 
 
 
 
9
 
10
  jobs:
 
 
 
11
  lint-and-test:
12
  runs-on: ubuntu-latest
13
  strategy:
14
  matrix:
15
- python-version: [3.9, 3.10, 3.11]
16
  steps:
17
- - uses: actions/checkout@v3
18
 
19
- - name: Set up Python
20
- uses: actions/setup-python@v4
21
  with:
22
  python-version: ${{ matrix.python-version }}
23
 
@@ -25,25 +36,65 @@ jobs:
25
  run: |
26
  python -m pip install --upgrade pip
27
  pip install -r requirements.txt
28
- pip install flake8 pytest
 
 
29
 
30
- - name: Lint with flake8
31
  run: |
 
32
  flake8 .
33
 
34
  - name: Run pytest
35
  run: |
36
- pytest --maxfail=1 --disable-warnings -q
37
 
38
- build-and-deploy:
 
 
 
 
 
 
 
 
39
  needs: lint-and-test
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  runs-on: ubuntu-latest
 
 
 
41
  if: github.ref == 'refs/heads/main' && github.event_name == 'push'
42
  steps:
43
- - uses: actions/checkout@v3
44
 
45
  - name: Build Docker image
46
  run: |
47
- docker build -t anycoder:latest .
48
 
49
- # You could add deployment steps here (e.g., push to registry, deploy to cloud)
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # .github/workflows/ci.yaml
2
+ # --------------------------------------------------------------
3
+ # AnyCoder AI – Continuous Integration pipeline
4
+ # --------------------------------------------------------------
5
+
6
  name: CI
7
 
8
  on:
9
  push:
10
+ branches: [main]
11
  pull_request:
12
+ branches: [main]
13
+
14
+ env:
15
+ PYTHON_VERSION_MATRIX: "3.9,3.10,3.11"
16
+ DOCKER_IMAGE: anycoder:latest
17
 
18
  jobs:
19
+ # --------------------------------------------------------------
20
+ # 1. Lint & Test (Python)
21
+ # --------------------------------------------------------------
22
  lint-and-test:
23
  runs-on: ubuntu-latest
24
  strategy:
25
  matrix:
26
+ python-version: [${{ fromJSON(env.PYTHON_VERSION_MATRIX) }}]
27
  steps:
28
+ - uses: actions/checkout@v4
29
 
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v5
32
  with:
33
  python-version: ${{ matrix.python-version }}
34
 
 
36
  run: |
37
  python -m pip install --upgrade pip
38
  pip install -r requirements.txt
39
+ pip install flake8 pytest nbmake
40
+ # style / typing (optional)
41
+ pip install black==24.2.0 mypy
42
 
43
+ - name: Lint with flake8 & black‑check
44
  run: |
45
+ black --check .
46
  flake8 .
47
 
48
  - name: Run pytest
49
  run: |
50
+ pytest -q
51
 
52
+ - name: Validate notebooks with nbmake
53
+ run: |
54
+ pytest --nbmake notebooks/
55
+
56
+ # --------------------------------------------------------------
57
+ # 2. Build static front‑end (HTML/CSS/JS) – no node needed
58
+ # --------------------------------------------------------------
59
+ build-frontend:
60
+ runs-on: ubuntu-latest
61
  needs: lint-and-test
62
+ steps:
63
+ - uses: actions/checkout@v4
64
+ - name: Archive static assets
65
+ uses: actions/upload-artifact@v4
66
+ with:
67
+ name: static-assets
68
+ path: |
69
+ static/index.html
70
+ static/style.css
71
+ static/index.js
72
+
73
+ # --------------------------------------------------------------
74
+ # 3. Docker build & (optional) publish
75
+ # --------------------------------------------------------------
76
+ build-and-deploy:
77
  runs-on: ubuntu-latest
78
+ needs:
79
+ - lint-and-test
80
+ - build-frontend
81
  if: github.ref == 'refs/heads/main' && github.event_name == 'push'
82
  steps:
83
+ - uses: actions/checkout@v4
84
 
85
  - name: Build Docker image
86
  run: |
87
+ docker build -t ${{ env.DOCKER_IMAGE }} .
88
 
89
+ # Optionally push to GHCR / DockerHub
90
+ # - name: Log in to registry
91
+ # uses: docker/login-action@v3
92
+ # with:
93
+ # registry: ghcr.io
94
+ # username: ${{ github.actor }}
95
+ # password: ${{ secrets.GHCR_TOKEN }}
96
+ #
97
+ # - name: Push image
98
+ # run: |
99
+ # docker tag ${{ env.DOCKER_IMAGE }} ghcr.io/${{ github.repository }}:latest
100
+ # docker push ghcr.io/${{ github.repository }}:latest