Skip to content

Commit

Permalink
feat(example-get-started): update ci, studio link, proper rules (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
shcheklein committed May 10, 2024
1 parent 1ab0473 commit 69d9e19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions example-get-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ git remote add origin git@github.com:<slug>/example-get-started.git
# close open PRs
gh pr close try-large-dataset
gh pr close tune-hyperparams
# remove existing tags, branches, experiments
git ls-remote origin | awk '{print $2}' | xargs -n 1 git push --delete origin || true
# force push branches
git push --force origin main
git push --force origin try-large-dataset
Expand Down
20 changes: 16 additions & 4 deletions example-get-started/code/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
report:
report:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'main'
image: dvcorg/cml:0-dvc3-base1
before_script:
- cml ci
- cml ci && cml --version
- npm install -g json5
script: |
if [ $CI_COMMIT_BRANCH = main ]; then
if [ $CI_COMMIT_REF_NAME = main ]; then
PREVIOUS_REF=HEAD~1
COMMIT_HASH1=$CI_COMMIT_BEFORE_SHA
COMMIT_HASH2=$CI_COMMIT_SHA
else
PREVIOUS_REF=main
git fetch --depth=1 origin main:main
COMMIT_HASH1=$CI_MERGE_REQUEST_DIFF_BASE_SHA
COMMIT_HASH2=$CI_COMMIT_SHA
fi
dvc pull eval
Expand All @@ -33,6 +40,7 @@ report:
cat <<EOF > report.md
# CML Report
[![DVC](https://img.shields.io/badge/-Open_in_Studio-grey?style=flat-square&logo=dvc)](https://studio.iterative.ai/team/Iterative/views/example-get-started-2gpv7kdqx2?panels=plots%2C%3Bcompare%2C&commits=${COMMIT_HASH2}%3B${COMMIT_HASH1}&activeCommits=${COMMIT_HASH1}%3Aprimary%3B${COMMIT_HASH2}%3Apurple)
## Plots
![ROC](./roc.svg)
![Precision-Recall](./prc.svg)
Expand All @@ -47,4 +55,8 @@ report:
${dvc_report}
EOF
cml comment create --publish --pr=false report.md
if [ $CI_COMMIT_REF_NAME = main ]; then
cml comment create --target=commit report.md
else
cml comment update --target=pr report.md
fi

0 comments on commit 69d9e19

Please sign in to comment.