-
Notifications
You must be signed in to change notification settings - Fork 17
50 lines (41 loc) · 1.6 KB
/
pipeline.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
name: Train and Deploy
on:
push:
branches:
- master
schedule:
- cron: '0 8 * * MON-FRI'
jobs:
train:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup GCP client
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download the latest dataset
run: |
gsutil cp gs://pipeline-example/heart-disease/dataset.csv datasets/default.csv
- name: Run training task
run: |
python steps/train.py --path=datasets/default.csv
- name: Upload new model and associated metrics
run: |
gsutil cp artifacts/pipeline.joblib gs://pipeline-example/heart-disease/models/latest.joblib
gsutil cp artifacts/pipeline.joblib gs://pipeline-example/heart-disease/models/${{ env.GITHUB_RUN_ID }}.joblib
gsutil cp artifacts/metrics.json gs://pipeline-example/heart-disease/models/metrics/${{ env.GITHUB_RUN_ID }}.joblib
- name: Deploy model as Cloud Function
run: |
gcloud functions deploy heart-disease --entry-point=predict_handler --runtime=python37 --project=${{ secrets.GCP_PROJECT_ID }} --allow-unauthenticated --trigger-http