generated from shivpalSW/dvc-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (67 loc) · 2.47 KB
/
ci-cd.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
####### uncomment below lines to use CML without AWS credentials
####### add ci-cd steps here
# name: train-NLP-ML-usecase
# on: [push]
# jobs:
# run:
# runs-on: [ubuntu-latest]
# steps:
# - uses: actions/checkout@v2
# - uses: iterative/setup-cml@v1
# - uses: actions/setup-python@v2
# with:
# python-version: '3.7'
# - name: Update Node.js to v16
# run: sudo apt-get install -y nodejs npm
# - name: cml_run & Install Dependencies and Reproduce DVC
# run: |
# # Your ML workflow commands
# pip install --upgrade pip
# pip install -r requirements.txt
# dvc repro --force -v ## v >>> verbose
# echo "# REPORTS" >> report.md
# echo "## metrics" >> report.md
# cat scores.json >> report.md
# - name: Comment on Last Commit
# run: cml comment create report.md ## >> CML COMMAND USE TO COMMENT ON LAST COMMIT
# env:
# repo_token: ${{secrets.GITHUB_TOKEN}}
###uncomment below lines to use CML with AWS credentials
name: train-NLP-ML-usecase
on: [push]
jobs:
deploy-runner:
runs-on: [ubuntu-latest]
steps:
- uses: iterative/setup-cml@v1
- uses: actions/checkout@v2
- name: 'Deploy runner in EC2'
shell: bash
env:
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
cml-runner \
--cloud aws \
--cloud-region us-west \
--cloud-type=m \ ### above line is for medium size data .we may incure some chagrges from AWS (we can use t2.macro but run may fail )
--labels=cml-runner
model-training:
needs: deploy-runner
runs-on: [self-hosted, cml-runner]
container: docker://iterativeai/cml:0-dvc2-base1
steps:
- uses: actions/checkout@v2
- name: "Train my model"
env:
repo_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
# Your ML workflow commands
pip install --upgrade pip
pip install -r requirements.txt
dvc repro -v ## v >>> verbose
echo "# REPORTS" >> report.md
echo "## metrics" >> report.md
cat scores.json >> report.md
cml comment create report.md # >> CML COMMAND USE TO COMMENT ON LAST COMMIT