-
Notifications
You must be signed in to change notification settings - Fork 147
Add GitHub actions #222
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
Add GitHub actions #222
Conversation
|
Ha, just today I got something working that I haven't put in a pr request yet for. I haven't yet had a chance to look at yours but it sounds like we've duplicated some bits, but we also both have stuff the other doesn't. I've been doing the work in a pull request against my own fork here dbaarda#1. I've got windows builds and tests including rdiff working with vcpkg popt! And man, that was an adventure! I'll put together a pull request of my stuff and go through yours tomorrow, and see how we can merge our efforts. |
|
I saw that you've assigned this ticket to you, but have not found the branch in progress. 😄 Anyway, feel free to use this PR as is, or split it up. And I am happy to work on it if you need me.
|
|
I was working in a PR on my own fork because I used github's UI for adding a new workflow and it asked if I wanted to make a PR out of it, I answered "yes", and to my surprise it created the PR against my own fork, not the main upstream librsync. Since I had no idea what I was doing, I figured I might as well keep fiddling with it there since there was a high chance it would turn into a disaster that needed to be abandoned anyway. In the end I did get it working, but if you look at the commit history it's full of failed experiments. I was thinking I would just make a new PR out of the branch, but seeing your work I'm thinking now of splitting it up into digestible pieces. I also have some questions about how you did things that I'd like to bounce off you because I'm new to this.
|
|
Hey @dbaarda , good to see that many questions. 😄
I have burned my fingers before to not update the base image. The problem could be that you want to install a package (the latest version of the package) and it won't work with the installed dependencies. This problem does not happen too frequently, but there are chances. I ran into this when I wanted to release something quick, and then had to spend extra hours to find out what's wrong.
Both is fine. I like explicitly name the build dependencies... I found it also useful, to reference the CI script to users, who want to build the project. My thoughts on the
I did not do any caching on GitHub. I think for this project, the builds are reasonably fast. (I have more heavy weight projects.) If you want to use caching not for speed, but to create a stable environment when only the code changes, I would recommend to use docker images. Where the image contains all dependencies (build and runtime). Not sure if this is also the fastest, because you need to load the docker image, but no need to install packages. I found the purpose of the CI job is to catch the build environment changes too. Those are the errors which I won't catch on my development machine. Stable build environments (like dockerized builds) are useful for big project, with many dependencies and long compilation times.
As you said,
I would make a matrix from these, and extend with the special cases if there are any. Maybe you should try to merge one of the PRs, and see how it works. I think it's hard to prepare for everything in advance. You will see how it works for this project, and can adjust later. If builds gets slower, you turn on caching. If the build fails too many times for strange dependency reasons, you migrate to docker. etc... It's hard to make it right from the beginning. 😄 |
|
More questions :-)
These tools are pretty cool and I've not used them before. In general I like to use Debian's packages as a vote-of-confidence in the level of maturity/support for a project and for selecting/using reliable releases. If it's not in Debian, it's probably too fringe to use, and using the packaged version ensures I'm using a reliable release that is compatible with the rest of my system. It also makes setup instructions simpler; "just apt-get these". There would have to be pretty compelling reasons to use a more bleeding-edge version. The iwyu stuff is particularly nice. What it doesn't seem to have is a cmdline/mode where it can fix your code, and only spits out reports. It would be nice to include it as part of the "make tidy" target. |
|
Hey @dbaarda ,
I am not a debian (nor ubuntu) user. I was not aware that these tools are packaged well for this platforms. (Was searched for it with duck-duck-go, but have not found them.) If the OS package is available that's easier to use than compile from sources.
I think the tool is silent if it has nothing to do. So, we can fail it on non-empty output.
The beauty of linux packages. 😄 It's not in
This is a long story, but the short version is this:
Clang-SA and Clang-tidy is two different tools. The
Yes, the code is in pretty good shape. Running these tools just help you to keep it like that. (Specially if there are multiple contributors, when the level of tidiness can vary. 😄 ) In PRs it can be valuable to see if formal requirements of the change is passed or not. To working with other languages (Java, Kotlin, Rust) I saw that these kind of tools are better integrated into the build system. So, developers can run them regularly. And the CI can fail if these checks are violated... To adopt this practices in C project is much harder, because of dependency management is harder. (Not only the project's dependencies, but the tools are also harder to install.) I just wanted to show that Clang project provided a good tool set beyond the compiler. These tools can help you to keep the code quality on a level. (I have not even recommended the Let me know if you need changes on the PR. |
This is the final result of experiments done in #1 slightly modified to incorporate suggestions from rizsotto in librsync#222. The original experiments had a messy commit history including many dead-ends so this cleaner patch was created rather than merge all that mess. It includes testing on ubuntu, macos, and windows for Release builds with a variety of cmake options, and a Debug build on ubuntu. The options include testing with clang, Ninja, static libs, and excluding rdiff. It installs all required packages using apt-get, brew, or vcpkg to fully build and test rdiff on all platforms.
|
OK, I've split my messy experiment PR against my own fork into a few different PR's for different pieces and merged all the stuff that was not directly github action related. This included #223 and #224. The stuff that was github action related I've tided up and put into a new PR #225. This only includes the CI "Check" workflow, and it doesn't directly replicate the old travis checks because I've decided to include updating things for cmake best practices and better coverage. I'd appreciate your comments/recommendations. I think it's better and has a few more tweaks than what you have here for the CI workflow, but I'm open to any reasons why you might think I've done it wrong. What I don't have in my PR is your extra clang-tidy, clang-sa, and iwyu workflows. I do want these, so it would be good if this patch could be updated to incorporate whatever we end up choosing for the CI solution. |
|
I think I want to try these using the existing deb packages for things to see how they compare. I'm not sure what the best way to do that is, as depending on how it goes, it might be better to use these instead. I think I'll do it by creating another alternative pull request and see how it goes. |
|
After fiddling around with build-analyze and clang-tidy, and digging through docs about them both, I've come to the conclusion that build-analyze is actually a subset of clang-tidy. It appears clang-tidy does have all the static analyser checks, at least according to the lists of checks they both support. The docs also say clang-tidy does clang static analysis checks; https://clang.llvm.org/extra/clang-tidy/ I've found some old comments online hinting that maybe it didn't work as advertised in the past, but it now appears to be working, as all the things found by analyze-build were found by clang-tidy using the same checks. It looks like clang-tidy is actually some kind of framework for aggregating all sorts of checks together, and the static analysis checks have now been added under it. So I'm going to drop the analyze-build checks and just use clang-tidy and iwyu. |
This is a "linter" that checks code for errors, taken from PR librsync#222 by riszotto.
|
Thanks for the updates @dbaarda . It seems that my knowledge is rusted on the Clang project, since I am not reading the dev mailing list. 😄 |
|
I've now effectively re-implemented all this in #229 which is now merged, and which included a bunch of other related stuff like adding make targets to run the lint checks locally and updated documentation. So I'm going to close this PR. Thank you very much for submitting it as it taught me lots. I've credited you in the NEWS.md for the PR's that were inspired/copied from this one. |
I've seen the #215 ticket, and I have some CMake and GitHub actions experience... so I've thought I can be useful here.
The solution I provided here can be refined, so please comment on the PR which parts you would like to have some rework.