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

Use ccache to save CI build time #426

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

csinrn
Copy link
Contributor

@csinrn csinrn commented Sep 11, 2024

This PR make use of ccache to accelerate the CI build time.

I did not add ccache on Windows platform. In my test, ccache does not work well on Windows. It views all calls as uncacheable call. I guess it is because windows is not fully supported (Demo run, uncachable calls is 34/34).
As a result, I did not add ccache in windows build.


Test result:

  • Devbuild.yml

    • Before cache (Demo run)
      MacOS ~12min
      Ubuntu ~10min
    • An Ideal cache hit (0 code change) (Demo run)
      MacOS ~5min
      Ubuntu ~2min
    • Cached, but with code change (I rebase my branch to modmesh main with 41 new commits )
(Demo run)
      MacOS ~9min
      Ubuntu ~8min
  • Lint.yml

    • Before cache: Demo run
      MacOS: ~14min
      Ubuntu: ~9min
    • After cache: Demo run
      MacOS: ~13min
      Ubuntu: ~7min

ccache does not help a lot in lint.yml.

@csinrn
Copy link
Contributor Author

csinrn commented Sep 11, 2024

@tigercosmos :)

@tigercosmos
Copy link
Collaborator

Sweet. It's now faster. :)

@yungyuc yungyuc added build Build system and automation test testing and continuous integration labels Sep 11, 2024
Copy link
Member

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

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

This looks good to me. I am merging the PR. Follow-up discussions can stay in this PR or use a new issue/conversation.


How reliable is ccache?

ccache does not help a lot in lint.yml.

Maybe it does not support clang-tidy very well?


In addition to compiler cache, is there a way to cache dependencies / environments?

@@ -72,6 +72,13 @@ jobs:
echo "flake8 path: $(which flake8)"
echo "flake8 version: $(flake8 --version)"

- name: ccache
Copy link
Member

Choose a reason for hiding this comment

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

The job standalone_buffer runs fairly fast. If it uses ccache, the PR implies all building jobs is supposed to use ccache. Is my assumption correct?

Is it a common practice to apply ccache to all building jobs in Github Actions?

@yungyuc yungyuc merged commit b5352e5 into solvcon:master Sep 11, 2024
12 checks passed
@csinrn
Copy link
Contributor Author

csinrn commented Sep 13, 2024

@yungyuc Thanks for the feedbacks.

How reliable is ccache?

Considering that it is a 2.3k star repo, and I have seen ccache in some business code building, I would say it should be quite reliable.

Maybe it does not support clang-tidy very well?

That's a good point and I have never thought of that. I found several posts online that point out clang-tidy does not work well with ccache. It would be good to find a better way to accelerate clang-tidy in github action.

In addition to compiler cache, is there a way to cache dependencies / environments?

Yes. Github cache action can do that. Theoretically, pip install and qt install can benefit from that. I did not apply this in the PR because:

  1. Our qt install action has already made use of Github cache action deep in the jurplel/install-qt-action@v4 action. So our qt install has already been cached.
  2. Generally, our pip install process in all platforms take 10-30s. It is quick. Considering that Github cache action has its own execution overhead, we cannot save a lot of time using Github cache action for pip install.

The job standalone_buffer runs fairly fast. If it uses ccache, the PR implies all building jobs is supposed to use ccache. Is my assumption correct?

Yes. I think so.

Is it a common practice to apply ccache to all building jobs in Github Actions?

There are about 5 custom github actions about ccache so I would say it is usable, but I would not say it is popular.

@yungyuc
Copy link
Member

yungyuc commented Sep 14, 2024

@yungyuc Thanks for the feedbacks.

How reliable is ccache?

Considering that it is a 2.3k star repo, and I have seen ccache in some business code building, I would say it should be quite reliable.

Number of stars (fame) is an hint for, but does not constitute an evidence or argument for its reliability. If you have time, it benefits the team to formulate an analysis for how reliable the tool is.

In the same time, since it is installed in the CI flow, we can experience its reliability ourselves. But we should be careful to avoid making baseless assumption (on the reliability) before an analysis is available.

Maybe it does not support clang-tidy very well?

That's a good point and I have never thought of that. I found several posts online that point out clang-tidy does not work well with ccache. It would be good to find a better way to accelerate clang-tidy in github action.

This sounds like an interesting topic. clang-tidy performs rather complicated static analysis. Maybe ccache is not working well for all static analyzers?

If we continue to discuss this, a separate conversation will be productive.

In addition to compiler cache, is there a way to cache dependencies / environments?

Yes. Github cache action can do that. Theoretically, pip install and qt install can benefit from that. I did not apply this in the PR because:

  1. Our qt install action has already made use of Github cache action deep in the jurplel/install-qt-action@v4 action. So our qt install has already been cached.
  2. Generally, our pip install process in all platforms take 10-30s. It is quick. Considering that Github cache action has its own execution overhead, we cannot save a lot of time using Github cache action for pip install.

Yeah, qt could be one of the hotspot before install-qt-action was employed. This is a good analysis.

The job standalone_buffer runs fairly fast. If it uses ccache, the PR implies all building jobs is supposed to use ccache. Is my assumption correct?

Yes. I think so.

Is it a common practice to apply ccache to all building jobs in Github Actions?

There are about 5 custom github actions about ccache so I would say it is usable, but I would not say it is popular.

What do you mean by '5 custom github actions about ccache'?

@csinrn
Copy link
Contributor Author

csinrn commented Sep 18, 2024

Thanks @yungyuc.
I'll research more on ccache and clang-tidy, and try to find out whether we can improve the CI again.

What do you mean by '5 custom github actions about ccache'?

There is a marketplace for github actions. There are 5 ccache related actions there. I find the ccache action there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build system and automation test testing and continuous integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants