99 branches :
1010 - main
1111 - dev
12+ workflow_dispatch :
13+ inputs :
14+ commit_sha :
15+ description : " Commit SHA for testing"
16+ required : false
17+ default : " "
18+ type : string
1219
1320jobs :
1421 run-genai-engine-linter :
@@ -32,12 +39,33 @@ jobs:
3239 - uses : ./.github/workflows/composite-actions/setup-poetry
3340 with :
3441 working-directory : genai-engine
35- - name : Run pre-commit
42+ with-groups : dev
43+ - name : Run isort
44+ id : isort
45+ continue-on-error : true
3646 run : |
37- poetry -C genai-engine run pre-commit install
38- CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }})
39- echo "$CHANGED_FILES" | xargs poetry -C genai-engine run pre-commit run --color always --verbose --files
40-
47+ poetry -C genai-engine run isort src --profile black --check
48+ - name : Run autoflake
49+ id : autoflake
50+ continue-on-error : true
51+ run : |
52+ poetry -C genai-engine run autoflake --remove-all-unused-imports --in-place --check --recursive --quiet src
53+ - name : Run black
54+ id : black
55+ continue-on-error : true
56+ run : |
57+ poetry -C genai-engine run black --check src
58+ # TODO: Uncomment this when mypy is fixed
59+ # - name: Run mypy
60+ # id: mypy
61+ # continue-on-error: true
62+ # run: |
63+ # poetry -C genai-engine run mypy src
64+ - name : Check linter results
65+ if : steps.isort.outcome == 'failure' || steps.autoflake.outcome == 'failure' || steps.black.outcome == 'failure'
66+ run : |
67+ echo "One or more linters failed"
68+ exit 1
4169
4270 run-ml-engine-linter :
4371 if : |
@@ -60,20 +88,39 @@ jobs:
6088 - uses : ./.github/workflows/composite-actions/setup-poetry
6189 with :
6290 working-directory : ml-engine
91+ with-groups : linters
6392 - name : Generate GenAI Client
6493 run : |
6594 pip install openapi-generator-cli[jdk4py]
6695 openapi-generator-cli generate -g python \
6796 -i ./genai-engine/staging.openapi.json \
6897 -o ./ml-engine/src/genai_client \
6998 --skip-validate-spec --package-name genai_client
70- - name : Run linters
99+ - name : Run isort
100+ id : isort
101+ continue-on-error : true
71102 run : |
72- poetry -C ml-engine install --with linters
73- poetry -C ml-engine run autoflake --remove-all-unused-imports --in-place --recursive src/ml_engine
74- poetry -C ml-engine run isort src/ml_engine --profile black
75- poetry -C ml-engine run black src/ml_engine
76-
103+ poetry -C ml-engine run isort src/ml_engine --profile black --check
104+ - name : Run autoflake
105+ id : autoflake
106+ continue-on-error : true
107+ run : |
108+ poetry -C ml-engine run autoflake --remove-all-unused-imports --in-place --check --recursive --quiet src/ml_engine
109+ - name : Run black
110+ id : black
111+ continue-on-error : true
112+ run : |
113+ poetry -C ml-engine run black --check src/ml_engine
114+ - name : Run mypy
115+ id : mypy
116+ continue-on-error : true
117+ run : |
118+ poetry -C ml-engine run mypy src/ml_engine
119+ - name : Check linter results
120+ if : steps.isort.outcome == 'failure' || steps.autoflake.outcome == 'failure' || steps.black.outcome == 'failure' || steps.mypy.outcome == 'failure'
121+ run : |
122+ echo "One or more linters failed"
123+ exit 1
77124
78125 run-genai-engine-changelog-cop :
79126 if : |
98145 curl -L -o "oasdiff.deb" https://github.com/Tufin/oasdiff/releases/download/v1.11.7/oasdiff_1.11.7_linux_amd64.deb
99146 dpkg -i oasdiff.deb
100147 - name : Generate changelog
148+ env :
149+ GENAI_ENGINE_SECRET_STORE_KEY : changeme_secret_store_key
101150 run : |
102151 export PYTHONPATH=src
103152 poetry -C genai-engine run generate_changelog
@@ -107,9 +156,9 @@ jobs:
107156 with :
108157 name : changelog-artifacts
109158 path : |
110- new.openapi.json
111- staging.openapi.json
112- src/api_changelog.md
159+ genai-engine/ new.openapi.json
160+ genai-engine/ staging.openapi.json
161+ genai-engine/ src/api_changelog.md
113162
114163 run-genai-engine-unit-tests :
115164 if : |
@@ -129,6 +178,8 @@ jobs:
129178 working-directory : genai-engine
130179 - name : Run unit tests
131180 shell : bash
181+ env :
182+ GENAI_ENGINE_SECRET_STORE_KEY : changeme_secret_store_key
132183 run : |
133184 set -o pipefail
134185 poetry -C genai-engine run pytest --cov --cov=genai-engine/src \
@@ -151,6 +202,48 @@ jobs:
151202 genai-engine/report.xml
152203 pytest-coverage.txt
153204
205+ run-genai-engine-alembic-migration-check :
206+ if : |
207+ (
208+ github.event_name == 'pull_request' ||
209+ (github.event_name == 'push' && github.ref_type == 'branch')
210+ )
211+ runs-on : ubuntu-latest
212+ container : python:3.12.9-bullseye
213+ services :
214+ postgres :
215+ image : postgres:15
216+ ports :
217+ - " 5432:5432"
218+ env :
219+ POSTGRES_PASSWORD : changeme_pg_password
220+ POSTGRES_DB : arthur_genai_engine
221+ volumes :
222+ - postgres_data:/var/lib/postgresql/data
223+ steps :
224+ - uses : actions/checkout@v5
225+ with :
226+ fetch-depth : ${{ env.GIT_DEPTH }}
227+ - uses : ./.github/workflows/composite-actions/setup-git
228+ with :
229+ safe-directory : ${{ runner.workspace }}
230+ - uses : ./.github/workflows/composite-actions/setup-poetry
231+ with :
232+ working-directory : genai-engine
233+ - name : Run alembic migration check
234+ env :
235+ POSTGRES_USER : postgres
236+ POSTGRES_PASSWORD : changeme_pg_password
237+ POSTGRES_URL : postgres
238+ POSTGRES_PORT : 5432
239+ POSTGRES_DB : arthur_genai_engine
240+ POSTGRES_USE_SSL : false
241+ GENAI_ENGINE_SECRET_STORE_KEY : changeme_secret_store_key
242+ PYTHONPATH : " src:$PYTHONPATH"
243+ run : |
244+ cd genai-engine
245+ poetry run alembic upgrade head
246+
154247 run-ml-engine-unit-tests :
155248 if : |
156249 (
@@ -183,9 +276,13 @@ jobs:
183276 run : |
184277 poetry -C ml-engine run pytest
185278
186-
187279 build-genai-engine-docker-images :
188- needs : [run-genai-engine-linter, run-genai-engine-changelog-cop, run-genai-engine-unit-tests]
280+ needs :
281+ [
282+ run-genai-engine-linter,
283+ run-genai-engine-changelog-cop,
284+ run-genai-engine-unit-tests,
285+ ]
189286 environment : shared-protected-branch-secrets
190287 if : |
191288 contains(github.event.head_commit.message, 'Increment arthur-engine version to') &&
@@ -209,7 +306,7 @@ jobs:
209306 - name : Set up Docker Buildx
210307 uses : docker/setup-buildx-action@v3.11.1
211308 - name : Log in to Docker Hub
212- uses : docker/login-action@v3.5 .0
309+ uses : docker/login-action@v3.6 .0
213310 with :
214311 username : ${{ secrets.DOCKER_HUB_USERNAME }}
215312 password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
@@ -228,7 +325,6 @@ jobs:
228325 push : true
229326 platforms : linux/amd64
230327
231-
232328 build-ml-engine-docker-images :
233329 needs : [run-ml-engine-linter, run-ml-engine-unit-tests]
234330 environment : shared-protected-branch-secrets
@@ -255,7 +351,7 @@ jobs:
255351 --skip-validate-spec --package-name genai_client
256352 sed -i 's/license = "NoLicense"/license = "Unlicense"/g' ./ml-engine/src/genai_client/pyproject.toml
257353 - name : Log in to Docker Hub
258- uses : docker/login-action@v3.5 .0
354+ uses : docker/login-action@v3.6 .0
259355 with :
260356 username : ${{ secrets.DOCKER_HUB_USERNAME }}
261357 password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
@@ -289,7 +385,6 @@ jobs:
289385 docker push docker.arthur.ai/arthur/scope/ml-engine:latest-dev
290386 fi
291387
292-
293388 push-all-cfts :
294389 needs : [build-genai-engine-docker-images, build-ml-engine-docker-images]
295390 environment : shared-protected-branch-secrets
@@ -372,3 +467,20 @@ jobs:
372467 run : |
373468 git tag -a "${{ env.VERSION }}" -m "Create tag for Arthur Engine ${{ env.VERSION }}"
374469 git push origin "${{ env.VERSION }}"
470+
471+ deploy-genai-engine-cloudformation :
472+ needs : [push-tag]
473+ if : |
474+ contains(github.event.head_commit.message, 'Increment arthur-engine version to') &&
475+ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
476+ runs-on : ubuntu-latest
477+ container : node:20-alpine
478+ environment : shared-protected-branch-secrets
479+ steps :
480+ - name : Trigger GitLab Pipeline
481+ uses : fjogeleit/http-request-action@v1.16.5
482+ with :
483+ url : " https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROJECT_ID }}/trigger/pipeline"
484+ method : POST
485+ contentType : application/x-www-form-urlencoded
486+ data : " token=${{ secrets.DEPLOY_TRIGGER_TOKEN }}&ref=main&variables[TRIGGER_JOB]=deploy_arthur_engine&variables[ARTHUR_ENGINE_COMMIT_SHA]=${{ inputs.commit_sha || github.sha }}"
0 commit comments