Skip to content
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

Merged
merged 31 commits into from
Mar 28, 2024

Conversation

Piedone
Copy link
Member

@Piedone Piedone commented Mar 19, 2024

Fixes #15548

The main build-test workflow remains without package publishing for each commit (for direct main 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:

@Piedone Piedone marked this pull request as ready for review March 19, 2024 20:50
@Piedone Piedone requested a review from agriffard as a code owner March 19, 2024 20:50
@Piedone Piedone requested a review from MikeAlhayek March 19, 2024 20:51
Copy link
Member

@MikeAlhayek MikeAlhayek left a 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 Show resolved Hide resolved
- 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
Copy link
Member

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).

Copy link
Member Author

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.

id: check-commits
shell: pwsh
run: |
$commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines
Copy link
Member

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.

- uses: actions/setup-node@v3
if: steps.check-commits.outputs.commit-count > 0
Copy link
Member

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?

Copy link
Member Author

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.

.github/workflows/preview_ci.yml Show resolved Hide resolved
@MikeAlhayek MikeAlhayek merged commit 303daba into OrchardCMS:main Mar 28, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Daily preview package publish instead of on every commit to main
3 participants