Skip to content

#75/#79: Implemented ci for gh workflows check if build needed and fixed print docker images #80

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

tomuben
Copy link
Collaborator

@tomuben tomuben commented Apr 29, 2025

fixes #75
fixes #79

@tomuben tomuben changed the title #75: Implemented ci for gh workflows check if build needed #75/#79: Implemented ci for gh workflows check if build needed and fixed print docker images Apr 29, 2025
res = lib_get_flavor_ci_model.get_flavor_ci_model(build_config, "flavor_a")
assert res == FlavorCiConfig(
build_runner="ubuntu-22.04",
test_config=TestConfig(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think, the test sets missing the language tests


Print this help message:

$ exaslci --help
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$ exaslci --help
$ exaslc-ci --help


Get the list of available flavors and write to $GITHUB_OUT:

$ exaslct get-flavors --github-var flavors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$ exaslct get-flavors --github-var flavors
$ exaslc-ci get-flavors --github-var flavors


github_options = [
click.option(
"--github-var",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"--github-var",
"--github-output-var",

)

base_branch_option = click.option(
"--base-branch-name",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is usually a base-ref and not a branch. A ref can be anywhere in the history, it can be a commit hash, tag or branch



def get_all_affected_files(git_access: GitAccess, base_branch: str) -> List[Path]:
base_last_commit_sha = git_access.get_head_commit_sha_of_branch(base_branch)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not needed, because we get the ref from GitHub via the command line parameter



def get_build_config_model() -> BuildConfig:
build_config_path = Path.cwd() / "build_config.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using cwd, we probably need to do a backwards search, if we want to make it properly, however, the question is this needed here, because the project is mainly used in a well defined environment.


def test_get_build_runner(cli, mock_get_build_runner):
cli.run("--flavor", "flavor_a", "--github-var", "abc")
assert cli.succeeded
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why that complicated

With assert mock_calls == [call(flavor=...,] you can handle all the asserts in one assert and probably also get better diff in case of a bug.

Ah, I see you need to test the GitHubAccess, I think that is best done by a Matcher Object

mock_calls == [call(flavor=...,github_access=IsInstance(GithubAccess))]

assert mock_get_flavors.call_count == 1
assert len(mock_get_flavors.call_args.args) == 0
assert len(mock_get_flavors.call_args.kwargs) == 1
assert isinstance(mock_get_flavors.call_args.kwargs["github_access"], GithubAccess)
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment regarding mock_calls

assert isinstance(
mock_check_if_build_needed.call_args.kwargs["github_access"], GithubAccess
)
assert isinstance(
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment regarding mock_calls

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.

Printing docker images not working Implement CI for Github workflows - check if build needed
2 participants