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

ci: make sure tests fail in CI if gpg or taplo binaries are not found #5854

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Mar 2, 2025

Fixes #5696

Example failure: https://github.com/jj-vcs/jj/actions/runs/13611152082/job/38048476201?pr=5854#step:7:1543

(This can wait; since the CI passes on the PR, we know the problem this PR aims to detect is not occurring, at least at the commit the PR is synced to).

@ilyagr ilyagr marked this pull request as ready for review March 2, 2025 02:29
@@ -142,6 +142,12 @@ impl TestEnvironment {
}
}

/// Panic if `CI` environment variable is set to a non-empty value
pub fn ensure_running_outside_ci(reason: &str) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move to module-level function because this does nothing related to TestEnvironment.

/// Panic if `CI` environment variable is set to a non-empty value
pub fn ensure_running_outside_ci(reason: &str) {
let running_in_ci = std::env::var("CI").is_ok_and(|value| !value.is_empty());
assert!(!running_in_ci, "Running in CI, {reason}.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it's better to add JJ_TEST_FORCE_GPG or something. It might make sense for down-stream packagers to enable this flag.

Copy link
Contributor Author

@ilyagr ilyagr Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't follow the situation and the behavior that you have in mind. My first thought is that if we create such a variable, this could be changed to fail if either CI or JJ_GPG_... is defined.

Or do you want us to use some variable we manually set in our CI workflows?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just about naming. I think explicitly-named variable is better than CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is kind of a standard. I think most CI runners set it by default, I've seen it in GitHub and Sourcehut, I think.

Also, do we have a need of separate variables for taplo and gpg?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is kind of a standard. I think most CI runners set it by default

Oh, I didn't know that and assumed we would set CI=1 somewhere.

do we have a need of separate variables for taplo and gpg?

Downstream packagers might want to forcibly enable gpg tests, but not taplo? That wouldn't be a big deal if CI is the standard way to handle this kind of things, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

FR: fail tests if taplo/gnupg are not found in the CI environment
2 participants