Skip to content

feat(example-get-started): update ci, studio link, proper rules #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading