-
Notifications
You must be signed in to change notification settings - Fork 128
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
Run release from CI workflow #1634
Conversation
f65e19f
to
e7931cf
Compare
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.
In general this seems fine. It's an improvement over the current thing in terms of testing. Note it does mean that the release process will take much longer (not a nonstarter, but noting it).
A downside is that it does not test the changes created by devel/release
It's not just the source code changes created by devel/release
that aren't tested, but that the actual release distributions (also currently created by devel/release
) aren't ever tested themselves. Only the source code form is tested.
In the future, I'd encourage reorganizing to a stricter CI/CD flow where distribution artifacts are always built and those artifacts are the things tested and ultimately released (if appropriate). (For an example, see what I did for Nextstrain CLI.)
.github/workflows/ci.yaml
Outdated
@@ -348,3 +354,50 @@ jobs: | |||
echo "If there are changes to the Augur CLI, please manually adjust files under 'docs/usage/cli/'." >&2 | |||
exit 1 | |||
fi | |||
|
|||
release: | |||
if: github.event_name == 'workflow_call' && github.workflow == 'Release' |
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.
non-blocking
This is an oddly tight binding of the two workflows to me. If we're going to do it, let's condition on the workflow file path instead of its name (which seems much more subject to change, and thus breakage)?
Alternatively, why condition here at all beyond the workflow_call
event?
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.
Updated to condition on file path + branch:
augur/.github/workflows/ci.yaml
Lines 359 to 360 in fc40285
# Only run when called by the release workflow on the default branch | |
if: github.event_name == 'workflow_call' && github.workflow_ref == format('{0}/.github/workflows/release.yaml@refs/heads/{1}', github.repository, github.event.repository.default_branch) |
Alternatively, why condition here at all beyond the
workflow_call
event?
Conditioning only on workflow_call
would mean "run release steps when the CI workflow is called by another workflow" which seems too loosely coupled. The CI workflow could be called by another workflow for other reasons in which release shouldn't happen.
If anything, I think the workflow_call
condition is redundant and can be removed. The path being anything other than .github/workflows/ci.yaml
implies workflow_call
as the triggering event.
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.
Conditioning only on workflow_call would mean "run release steps when the CI workflow is called by another workflow" which seems too loosely coupled. The CI workflow could be called by another workflow for other reasons in which release shouldn't happen.
The workflow_call
trigger requires a version
input, so any call of it with a version seems to me like a release is intended.
In any case, the larger point is that I think the coupling here between the two workflows is weird and an artifact of trying to preserve the "Release" workflow.
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.
I see. I meant for this PR to be a small change to prevent release on failing tests. Maybe it'd be better to drop the "Release" workflow, but that needs a larger discussion around aligning release procedures between Augur/Auspice/Nextstrain CLI. I'll keep it in this PR.
The
workflow_call
trigger requires aversion
input, so any call of it with a version seems to me like a release is intended.
True, but when browsing the code I think (2) reads better than (1):
-
release: # Only run when the triggered by workflow_call with input.version if: github.event_name == 'workflow_call' needs: [pytest-cram]
-
release: # Only run when called by the release workflow on the default branch if: github.workflow_ref == format('{0}/.github/workflows/release.yaml@refs/heads/{1}', github.repository, github.event.repository.default_branch) needs: [pytest-cram]
Checking default branch is important. With (1) it could happen in release.yaml, but (2) comes with added context of actual release steps.
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.
I meant for this PR to be a small change to prevent release on failing tests.
Yep, and that's fine, hence why I said at the top: "In general this seems fine. It's an improvement over the current thing in terms of testing." :-)
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.
I've removed the workflow_call
condition in #1675
That is already the case prior to this PR, but point taken. I'll create a separate issue for improvements once this PR is merged. |
35e4d98
to
ea511e4
Compare
This leverages the existing test matrix setup for CI which can sufficiently replace devel/test. A downside is that it does not test the changes created by devel/release, but those should not have an impact on test results.
ea511e4
to
fc40285
Compare
This was flawed: even though ci.yaml is called by another workflow, the `github` context is associated with the caller workflow¹ so event_name is "workflow_dispatch" during a release run. It doesn't make sense to update the condition to match "workflow_dispatch", since there are valid reasons for running ci.yaml using workflow_dispatch. I think it makes more sense to simply remove this half of the condition as redundant². The other half of the condition sufficiently ensures that the job is run only when called by the release workflow on the default branch. ¹ <https://docs.github.com/en/actions/sharing-automations/reusing-workflows> ² <#1634 (comment)>
Description of proposed changes
This leverages the existing test matrix setup for CI which can sufficiently replace devel/test. A downside is that it does not test the changes created by devel/release, but those should not have an impact on test results.
Related issue(s)
Closes #1633
Checklist
release
job is skipped for PR runPost-merge: next release happens successfullyit did not, see Bug in release workflow: it doesn't actually release anymore #1674