-
Notifications
You must be signed in to change notification settings - Fork 4
171 lines (149 loc) · 5.4 KB
/
release.yaml
File metadata and controls
171 lines (149 loc) · 5.4 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: release
on:
release:
types: [published]
env:
REGISTRY: docker.io
CMS_IMAGE_NAME: cogstacksystems/cogstack-modelserve
MLFLOW_UI_IMAGE_NAME: cogstacksystems/cogstack-mlflow-ui
jobs:
ensure-branch:
runs-on: ubuntu-latest
outputs:
is-valid: ${{ steps.ensure-branch.outputs.is-valid }}
steps:
- name: Ensures release is from the production branch only
id: ensure-branch
run: |
TARGET_BRANCH="${{ github.event.release.target_commitish }}"
if [ "$TARGET_BRANCH" != "production" ]; then
echo "Only releases from the 'production' branch are allowed but found: $TARGET_BRANCH"
echo "is-valid=false" >> "$GITHUB_OUTPUT"
exit 1
else
echo "Target release branch is: $TARGET_BRANCH"
echo "is-valid=true" >> "$GITHUB_OUTPUT"
fi
qc:
runs-on: ubuntu-latest
needs: ensure-branch
if: needs.ensure-branch.outputs.is-valid == 'true'
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.9.30"
python-version: "3.11"
- name: Install dependencies
run: |
uv sync --lock --extra dev --extra docs --extra llm
uv run python -m ensurepip
- name: Run unit tests
run: |
uv run pytest -v tests/app --cov --cov-report=html:coverage_reports #--random-order
- name: Run integration tests
run: |
uv run pytest -s -v tests/integration
release:
runs-on: ubuntu-latest
needs: [ensure-branch, qc]
if: needs.ensure-branch.outputs.is-valid == 'true'
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract the tag
run: |
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract CMS meta
id: cms_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.CMS_IMAGE_NAME }}
- name: Build and push CMS image
uses: docker/build-push-action@v6
id: build_and_push_cms
with:
platforms: linux/amd64,linux/arm64
context: .
file: docker/Dockerfile
push: true
github-token: ${{ github.token }}
tags: |
${{ env.REGISTRY }}/${{ env.CMS_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
labels: ${{ steps.cms_meta.outputs.labels }}
- name: Attest CMS image artifacts
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.CMS_IMAGE_NAME }}
subject-digest: ${{ steps.build_and_push_cms.outputs.digest }}
push-to-registry: true
- name: Inspect the released image
run: |
docker pull ${{ env.REGISTRY }}/${{ env.CMS_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
docker image inspect ${{ env.REGISTRY }}/${{ env.CMS_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
release-extra:
runs-on: ubuntu-latest
needs: [ensure-branch, qc]
if: needs.ensure-branch.outputs.is-valid == 'true'
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract the tag
run: |
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Mlflow UI meta
id: mlflow_ui_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.MLFLOW_UI_IMAGE_NAME }}
- name: Build and push Mlflow UI image
uses: docker/build-push-action@v6
id: build_and_push_mlflow_ui
with:
platforms: linux/amd64,linux/arm64
context: .
file: docker/mlflow/server/Dockerfile
push: true
github-token: ${{ github.token }}
tags: |
${{ env.REGISTRY }}/${{ env.MLFLOW_UI_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
labels: ${{ steps.mlflow_ui_meta.outputs.labels }}
- name: Attest Mlflow UI image artifacts
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.MLFLOW_UI_IMAGE_NAME }}
subject-digest: ${{ steps.build_and_push_mlflow_ui.outputs.digest }}
push-to-registry: true
- name: Inspect the released image
run: |
docker pull ${{ env.REGISTRY }}/${{ env.MLFLOW_UI_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
docker image inspect ${{ env.REGISTRY }}/${{ env.MLFLOW_UI_IMAGE_NAME }}:${{ env.RELEASE_VERSION }}