64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
name: CML Report
|
|
on: pull_request
|
|
jobs:
|
|
run:
|
|
runs-on: [ubuntu-latest]
|
|
steps:
|
|
- uses: iterative/setup-cml@v2
|
|
- uses: iterative/setup-dvc@v1
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 2
|
|
# Needed for https://github.com/iterative/example-repos-dev/issues/225
|
|
- name: Installs JSON5
|
|
run: npm install -g json5
|
|
- name: Generate metrics report
|
|
env:
|
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
cml ci
|
|
if [ $GITHUB_REF = refs/heads/main ]; then
|
|
PREVIOUS_REF=HEAD~1
|
|
else
|
|
PREVIOUS_REF=main
|
|
git fetch origin main:main
|
|
fi
|
|
|
|
dvc pull eval
|
|
dvc plots diff $PREVIOUS_REF workspace \
|
|
--show-vega --targets ROC | json5 > vega.json
|
|
vl2svg vega.json roc.svg
|
|
|
|
dvc plots diff $PREVIOUS_REF workspace \
|
|
--show-vega --targets Precision-Recall | json5 > vega.json
|
|
vl2svg vega.json prc.svg
|
|
|
|
dvc plots diff $PREVIOUS_REF workspace \
|
|
--show-vega --targets Confusion-Matrix | json5 > vega.json
|
|
vl2svg vega.json confusion.svg
|
|
|
|
cp eval/plots/images/importance.png importance_workspace.png
|
|
|
|
git checkout $PREVIOUS_REF -- dvc.lock
|
|
cp eval/plots/images/importance.png importance_previous.png
|
|
|
|
dvc_report=$(dvc exp diff $PREVIOUS_REF --md)
|
|
|
|
cat <<EOF > report.md
|
|
# CML Report
|
|
## Plots
|
|

|
|

|
|

|
|
#### Feature Importance: ${PREVIOUS_REF}
|
|

|
|
#### Feature Importance: workspace
|
|

|
|
|
|
## Metrics and Params
|
|
### ${PREVIOUS_REF} → workspace
|
|
${dvc_report}
|
|
EOF
|
|
|
|
cml comment create --publish --pr=false report.md
|