-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (72 loc) · 2.21 KB
/
action-push.yaml
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
name: action-push
on:
push:
branches:
- 'feature/**'
paths:
- 'models/**/**.py'
jobs:
prepare:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
target-model: ${{ steps.target-model-name.outputs.result }}
steps:
- name: 'Target Branch'
run: echo '${{github.ref}}'
# - name: 'github dump'
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo "$GITHUB_CONTEXT"
- name: 'Get Target Model'
uses: actions/github-script@v5
id: target-model-name
with:
script: |
console.log(JSON.stringify(context));
return context.ref.match(/\/feature\/(\w+)/)[1];
result-encoding: string
- name: Get model name
run: echo "${{steps.target-model-name.outputs.result}}"
- uses: actions/checkout@v2
- name: Check working directory
id: check-wd
working-directory: ./models/${{steps.target-model-name.outputs.result}}
run: |
pwd
ls -al
run:
needs: prepare
runs-on: ubuntu-latest
# optionally use a convenient Ubuntu LTS + DVC + CML image
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
defaults:
run:
# TODO
working-directory: ./models/${{needs.prepare.outputs.target-model}}
steps:
- uses: actions/checkout@v2
- uses: iterative/setup-cml@v1
- name: Pip requirement
run: |
pip uninstall protobuf python3-protobuf
pip install --upgrade pip
pip install --upgrade protobuf
pip install -r requirements.txt
# - name: Train model
# run: |
# python train.py
- name: Write CML report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.ACC_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SEC_ID }}
run: |
# dvc pull
dvc repro
python evaluate.py
echo "## Model Metrics" >> report.md
dvc metrics diff HEAD --show-md >> report.md
echo "## Data" >> report.md
cml-publish cnf_matrix.png --md >> report.md
cml-send-comment report.md