1919 - name : Checkout code
2020 uses : actions/checkout@v4
2121
22+ - name : Install Ruff
23+ run : pip install ruff
24+
25+ - name : Lint with Ruff
26+ run : ruff check .
27+
2228 test :
2329 name : Run Tests
2430 runs-on : ubuntu-latest
@@ -28,15 +34,52 @@ jobs:
2834 - name : Checkout code
2935 uses : actions/checkout@v4
3036
37+ - name : Set up Python
38+ uses : actions/setup-python@v5
39+ with :
40+ python-version : ' 3.11'
41+
42+ - name : Install dependencies
43+ run : |
44+ pip install pytest pytest-cov
45+ pip install -r requirements.txt # If you have one
46+
47+ - name : Run tests with coverage
48+ run : |
49+ pytest --cov=. --cov-fail-under=80
50+
3151 build :
3252 name : Build Docker Image
3353 runs-on : ubuntu-latest
3454 needs : [lint, test]
3555 if : github.event_name == 'push' || github.event_name == 'release'
3656 permissions :
3757 contents : read
38- actions : read
3958 packages : write
4059 steps :
4160 - name : Checkout code
4261 uses : actions/checkout@v4
62+
63+ - name : Log in to GitHub Container Registry
64+ uses : docker/login-action@v3
65+ with :
66+ registry : ghcr.io
67+ username : ${{ github.actor }}
68+ password : ${{ secrets.GITHUB_TOKEN }}
69+
70+ - name : Extract Docker metadata
71+ id : meta
72+ uses : docker/metadata-action@v5
73+ with :
74+ images : ghcr.io/${{ github.repository }}
75+ tags : |
76+ type=semver,pattern={{version}}
77+ type=raw,value=latest,enable=${{ github.event_name == 'release' }}
78+
79+ - name : Build and push
80+ uses : docker/build-push-action@v5
81+ with :
82+ context : .
83+ push : ${{ github.event_name == 'release' }}
84+ tags : ${{ steps.meta.outputs.tags }}
85+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments