mgbam commited on
Commit
668e783
·
verified ·
1 Parent(s): 4cb627f

Create ci.yaml

Browse files
Files changed (1) hide show
  1. ci.yaml +49 -0
ci.yaml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
24
+ - name: Install dependencies
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)