-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 1.8 KB
/
Copy pathci.yml
File metadata and controls
72 lines (61 loc) · 1.8 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
quality:
name: Lint and test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install CI dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --editable ".[ci]"
- name: Run Ruff
run: python -m ruff check src tests scripts spark airflow/dags --select E4,E7,E9,F
- name: Run tests
run: python -m pytest -q
docker:
name: Build Docker image
needs: quality
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build API image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/ekrov/factoryvision-mlops:${{ github.sha }}
ghcr.io/ekrov/factoryvision-mlops:latest
cache-from: type=gha
cache-to: type=gha,mode=max