-
Notifications
You must be signed in to change notification settings - Fork 26
91 lines (82 loc) · 2.68 KB
/
push-to-main.yml
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
on:
push:
branches:
- main
env:
TAG: "latest"
jobs:
check-branch:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.image-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Find Image Tag
id: image-tag
env:
BRANCH: ${{ github.ref_name }}
COMMIT: ${{ github.sha }}
run: |
if [ "${{ github.event_name }}" == 'pull_request' ]; then
echo "tag=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
else
if [ "$BRANCH" == "main" ]; then
echo "tag=${{ env.TAG }}" >> "$GITHUB_OUTPUT"
else
echo "tag=$COMMIT" >> "$GITHUB_OUTPUT"
fi
fi
check-change:
runs-on: ubuntu-latest
outputs:
base: ${{ steps.filter.outputs.base }}
modeling: ${{ steps.filter.outputs.modeling }}
s3: ${{ steps.filter.outputs.s3 }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
base:
- 'pyproject.toml'
- 'dockerfiles/Dockerfile.base'
- '.github/workflows/build-push.yml'
modeling:
- 'src/**'
- 'model_training/**'
- 'hack/**'
- '.github/workflows/train-model.yml'
s3:
- 'model_training/s3/**'
build-push:
needs: [check-change, check-branch]
uses: ./.github/workflows/build-push.yml
with:
base_change: ${{ needs.check-change.outputs.base }}
s3_change: ${{ needs.check-change.outputs.s3 }}
image_repo: ${{ vars.IMAGE_REPO }}
image_tag: ${{ needs.check-branch.outputs.tag }}
push: true
secrets:
docker_username: ${{ secrets.BOT_NAME }}
docker_password: ${{ secrets.BOT_TOKEN }}
train-model:
needs: [check-change, check-branch, build-push]
if: ${{ needs.check-change.outputs.modeling == 'true' }}
strategy:
matrix:
instance_type: [i3.metal]
uses: ./.github/workflows/train-model.yml
with:
pipeline_name: std_v0.7.11
instance_type: ${{ matrix.instance_type }}
ami_id: 'ami-0e4d0bb9670ea8db0'
github_repo: ${{ github.repository }}
model_server_image: ${{ vars.IMAGE_REPO }}/kepler_model_server:${{ needs.check-branch.outputs.tag }}
trainers: LogisticRegressionTrainer,ExponentialRegressionTrainer,SGDRegressorTrainer,GradientBoostingRegressorTrainer,XgboostFitTrainer
secrets:
self_hosted_github_token: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}