1- name : CI-CD Docker to GHCR
1+ test :
2+ runs-on : ubuntu-latest
23
3- on :
4- push :
5- branches :
6- - main
7- workflow_dispatch :
4+ steps :
5+ - name : Check out repository
6+ uses : actions/checkout@v4
87
9- env :
10- REGISTRY : ghcr.io
11- IMAGE_NAME : gbadedata/ml-inference-api
8+ - name : Set up Python
9+ uses : actions/setup-python@v5
10+ with :
11+ python-version : " 3.11"
1212
13- jobs :
14- test :
15- runs-on : ubuntu-latest
13+ - name : Install dependencies
14+ run : |
15+ python -m pip install --upgrade pip
16+ pip install -r requirements.txt
17+ pip install pytest
1618
17- steps :
18- - name : Check out repository
19- uses : actions/checkout@v4
19+ - name : Train model artifact
20+ run : python model/train.py
2021
21- - name : Set up Python
22- uses : actions/setup-python@v5
23- with :
24- python-version : " 3.11"
25-
26- - name : Install dependencies
27- run : |
28- python -m pip install --upgrade pip
29- pip install -r requirements-dev.txt
30-
31- - name : Run tests
32- run : pytest
33-
34- build-and-push :
35- runs-on : ubuntu-latest
36- needs : test
37-
38- permissions :
39- contents : read
40- packages : write
41-
42- steps :
43- - name : Check out repository
44- uses : actions/checkout@v4
45-
46- - name : Log in to GHCR
47- uses : docker/login-action@v3
48- with :
49- registry : ${{ env.REGISTRY }}
50- username : ${{ github.actor }}
51- password : ${{ secrets.GITHUB_TOKEN }}
52-
53- - name : Extract Docker metadata
54- id : meta
55- uses : docker/metadata-action@v5
56- with :
57- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58- tags : |
59- type=raw,value=latest
60- type=sha
61-
62- - name : Build and push Docker image
63- uses : docker/build-push-action@v6
64- with :
65- context : .
66- push : true
67- tags : ${{ steps.meta.outputs.tags }}
68- labels : ${{ steps.meta.outputs.labels }}
22+ - name : Run tests
23+ run : pytest
0 commit comments