Skip to content

Commit 64e6729

Browse files
committed
GHA to train a model
1 parent 5b1931d commit 64e6729

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/train_model.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- train_model
7+
8+
jobs:
9+
build_and_test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v1
16+
17+
- name: Set up Python
18+
run: uv python install 3.11
19+
20+
- name: Install the dependencies
21+
run: |
22+
uv sync --all-extras
23+
24+
- name: Run pre-commit checks
25+
run: |
26+
uv run pre-commit run --all-files
27+
28+
- name: Run pytest
29+
run: |
30+
uv run pytest
31+
32+
- name: Authenticate with GCP
33+
env:
34+
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
35+
run: |
36+
echo "$GCP_SERVICE_ACCOUNT_KEY" > gcp-key.json
37+
gcloud auth activate-service-account --key-file=gcp-key.json
38+
export GOOGLE_APPLICATION_CREDENTIALS=gcp-key.json
39+
40+
- name: Train Model
41+
env:
42+
MLFLOW_TRACKING_URI_DEV: ${{ secrets.MLFLOW_TRACKING_URI_DEV }}
43+
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcp-key.json
44+
run: |
45+
uv run python script/3_train_model.py \
46+
--git_sha $(git rev-parse HEAD) \
47+
--git_branch $(git rev-parse --abbrev-ref HEAD)

0 commit comments

Comments
 (0)