-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Publishing preview packages daily (Lombiq Technologies: OCORE-151) #15552
Conversation
This reverts commit 4d3a93d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the main_ci?
.github/workflows/preview_ci.yml
Outdated
- uses: actions/checkout@v4 | ||
with: | ||
# Necessary to count commits below. We assume that no more than 50 commits are pushed in a day to main. | ||
fetch-depth: 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why any number if not 1? I assume a single commit existence should trigger the build? So if any option is passed maybe 1? (I do that in CI builds for benchmarks to speed-up the clones).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it doesn't need to be. I was thinking wrong. 1
is the default anyway.
.github/workflows/preview_ci.yml
Outdated
id: check-commits | ||
shell: pwsh | ||
run: | | ||
$commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no commits in the span then the response is empty, so maybe easier to check for that.
.github/workflows/preview_ci.yml
Outdated
- uses: actions/setup-node@v3 | ||
if: steps.check-commits.outputs.commit-count > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to just stop the workflow altogether in one step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in an analogous way to C#'s return
. This is the only way to skip steps conditionally, use a single job, and make the workflow succeed even if the steps were skipped (which I think should happen; the run was successful, even if we didn't need to publish).
Alternatives:
- Having a separate job that produces a true/false, and then make the second job depend on that. This is what Miek did. The downside of this is that this check is a separate VM instance just for the script.
- Canceling the workflow, like here. That would show the workflow as canceled when the condition wasn't met instead of succeeding.
This reverts commit a73fc5f.
Fixes #15548
The
main
build-test workflow remains without package publishing for each commit (for directmain
commits and to run functional tests for each PR merge). Package publishing now only happens once a day, only if new commits were added in the last 24 hours.Sample runs with just the first 3 steps of the workflow: