-
Notifications
You must be signed in to change notification settings - Fork 0
Create main-ci-pipeline.yml #1
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
base: main
Are you sure you want to change the base?
Conversation
6f09a2b
to
ec58e6c
Compare
That doesn't work like this. We need to docker this. Especially watch the clang-format version. Should be 18+, otherwise there will be differences between the local pre-commit and CLion reformat and the pipeline. |
75110d9
to
de0adfc
Compare
Small Change
de0adfc
to
5f11da5
Compare
This ain't it yet, there are two main problems:
|
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.
Hi there! I am looking into this after a hint by @carme-hp. I have a few comments that might help, especially regarding clang-format. Feel free to ask questions!
And yes, providing a Docker or Apptainer container would be great (not sure how easy it would be with graphical applications, maybe Apptainer is easier there). But you can also do that in a follow-up PR.
- name: Download build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifacts |
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.
This seems to be unused at the moment. Are you trying to share something between jobs, or is it just a leftover?
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.
Yes, this is one of the main issues I am having right now. I am trying to share the cmake-build-debug dir created in the build job so we do not have to build the project again in every job. The dir is needed in the clang-tidy and the test job. However, this does not seem to work the way I want it to as the dir apparently cannot be found in the test job for example:
Run ctest --test-dir cmake-build-debug/test --rerun-failed --output-on-failure Failed to change working directory to "/home/runner/work/surviving-sarntal/surviving-sarntal/cmake-build-debug/test" : No such file or directory Internal ctest changing into directory: /home/runner/work/surviving-sarntal/surviving-sarntal/cmake-build-debug/test Error: Process completed with exit code 1.
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.
Independent of the direction you take next, I think that uploading/downloading artifacts is not intended for this use case.
I think this could be much easier if you indeed ran everything inside a container, because then you could write into a persistent directory (depends a bit on how you run the container).
Another alternative would be to not split multiple jobs, but just have one job with multiple 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.
Indeed. The persistent directory is why we will try with docker container next (see comment below) 👍
# Remove percentage symbol and compare numeric value | ||
COVERAGE_VALUE=$(echo "$COVERAGE" | sed 's/%//') | ||
if [ "$COVERAGE_VALUE" -lt 80 ]; then | ||
echo "Coverage is below 80%! Failing pipeline." | ||
# TODO once the test coverage is high enough, we should fail the pipeline here | ||
# exit 1 | ||
else | ||
echo "Coverage is sufficient: $COVERAGE_VALUE%" | ||
fi |
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.
You could also store the coverage value in a file and check if the PR increases or decreases the coverage. This would be easier to track than eventually (and cumulatively) dropping below a threshold.
Or run lcov
on both branches.
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.
That is a great idea! I will tackle this once the pipeline is up and running.
- name: Debug LLVM Binaries | ||
run: | | ||
sudo find /usr /lib /opt -name clang-format-18 -o -name clang-tidy-18 | ||
dpkg-query -L clang-format-18 || echo "clang-format-18 not found in package files" | ||
llvm-config --bindir || echo "llvm-config not installed or misconfigured" | ||
echo $PATH |
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.
All the clang-format setup looks too complicated. Do you know that you can get any clang-format version from pip?
https://pypi.org/project/clang-format/
You could also use a predefined clang-format action or, even better, use a predefined pre-commit hook. See an example in https://github.com/precice/precice/blob/develop/.pre-commit-config.yaml
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.
The setup was originally not that complicated. Those are just remnants of my efforts to debug the pipeline and will be removed.
I did not know that I could install clang via pip and I will try this tmrw.
I do have pre-commit hooks in place running clang-format and clang-tidy locally on the changed files. However we agreed on running the two in the pipeline as well on all our src files as there are some errors clang-tidy only catches when looking at all files.
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.
You could still run pre-commit on all files in the CI (pre-commit run -a
).
The advantage of integrating pre-commit in the CI is that you avoid duplication and get the same checks that a developer should also get locally.
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.
That is smart. Originally, we had a very weak runner which is why we split up the pre-commit linting into clang-format and clang-tidy. clang-tidy needs a build which took forever on our old runner, so we performed clang-format first so that the pipe "fails fast". However, now performance is no longer an issue, so it is sensible to reuse the pre-commit checks for the reasons you mentioned.
- name: Download build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifacts |
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.
Same comment as above: Do you need this?
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.
Yes, if it does what I assume it does, I need the compile_commands.json file which is outputted to cmake-build-debug during the build.
Update upload-artifact action from v3 to v4 as v3 support runs out Co-authored-by: Gerasimos Chourdakis <gerasimos.chourdakis@ipvs.uni-stuttgart.de>
Thank you very much for the review. I learned that @av-runner already has some experience with docker and even wrote a dockerfile for this project. We will take a look at this on Monday. Presumably using docker is a good solution. There are also no issues with running the pipeline in the container as we mock all output services in our tests. It should also avoid the problem with caching and reusing dependencies and build files we had so far. |
Translated the Gitlab CI/CD pipeline to GitHub Actions and (hopefully) corrected an error with the test coverage check on the way.
Test coverage still does not fail the pipeline, but there is a TODO that the "exit 1" should be uncommented once the coverage is raised to an appropriate level.