-
Notifications
You must be signed in to change notification settings - Fork 57
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
Added Clang builds to Ubuntu, CentOS7, CentOS8 (+ ossl), MacOS, Debian9 and Windows-msys2 workflows #1666
Conversation
@ronaldtse |
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.
I'd suggest to remove redundant tests, where we (most likely) do not need to check different compilers.
Clang build and test for the following workflows:
Fixed:
|
* Added clang to msys workflow * Removed empty lines * Commented out test we think we do not need
* Added clang build\test to Msys workflow * Fixed ci scripts issues reported by lint
I believe this PR is ready for merge. All changes are listed in the previous comment:#1666 (comment) Some general considerations:
|
I agree. Let's merge this first and migrate to a package manager? |
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.
Thank you @maxirmx !
libtool | ||
bzip2 | ||
gzip | ||
) |
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.
Extra preceding whitespace for these lines?
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.
I do not agree. I made identation consistent. Without extra whitespace these 4 lines have identation that differs from the code before and after.
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.
Those seem to have 2-space indentation before the changes, or do I miss something?
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 it had double spaces before the changes and it has double spaces after changes.
I think there was a version in the middle that had wrong spacing.
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.
I think the version here is the version that has wrong spacing :)
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.
I agree with everything you say about spacing and empty lines.
Ping @ni4 @ribose-jeffreylau for one more review. |
@maxirmx it's okay to have this merged right now since it is only CI related. |
@ronaldtse |
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.
@maxirmx I left some comments above. Thanks!
export CC=gcc | ||
export CXX=g++ | ||
export CC=${CC-gcc} | ||
export CXX=${CXX-g++} |
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.
If $CC
(and $CXX
) are set to empty strings, after CC=${CC-gcc}
, $CC
would still remain as empty strings. Is this intended? (similar with $CXX
)
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.
Also, there is a trailing white space on line 9.
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 is protection against CC/CXX unset.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
Actually it is an interesting issue related to CI logic consistency.
CI logic is distributed accross YAML-shell scripts-cmake If thess shell scripts are always called from GHA you can ensure that CC and other variablle are set in YAML. Would you like to rely on this scenario only or hacve some extra logic that make scripts work reliably without GHA ?
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.
I see, I didn't know about cmake's behaviour on empty string CC :) Thanks!
Before your reply, I would have preferred export CC=${CC:-gcc}
with the extra colon, so CC
would actually explicitly take on the value of "gcc"
instead of becoming an empty string when CC
is originally unset.
Observe:
$ unset TEST
$ echo "${TEST-this is a test}"
this is a test
$ TEST=
$ echo "${TEST-this is a test}"
$ echo "${TEST:-this is a test}"
this is a test
Actually it is an interesting issue related to CI logic consistency.
CI logic is distributed accross YAML-shell scripts-cmake If thess shell scripts are always called from GHA you can ensure that CC and other variablle are set in YAML. Would you like to rely on this scenario only or hacve some extra logic that make scripts work reliably without GHA ?
For now, I think we can safely assume that these scripts are always run within GHA, as long as they live inside ci/
.
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.
Actually I also put export CC=${CC:-gcc} first but then I relized that if empty string comes from the upstream it does not hurt but may have some idea behind it.
libtool | ||
bzip2 | ||
gzip | ||
) |
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.
I think the version here is the version that has wrong spacing :)
@@ -522,6 +526,17 @@ linux_install_debian() { | |||
"${build_dependencies_deb[@]}" \ | |||
"$@" | |||
|
|||
if [ "${CC-gcc}" = "clang" ]; then |
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 issue as above --- with $CC
set to empty string, "${CC-gcc}"
would still be empty string. Is this intended?
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.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
mingw64/mingw-w64-x86_64-python3 | ||
) | ||
|
||
if [ "${CC-gcc}" = "gcc" ]; then |
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.
ditto
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.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
pacman --noconfirm -S --needed "${packages[@]}" | ||
|
||
if [ "${CC-gcc}" = "gcc" ]; then |
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.
ditto
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.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
@@ -833,7 +866,7 @@ build_example_pkgconfig() { | |||
pushd "$(mktemp -d)" || return 1 | |||
|
|||
# shellcheck disable=SC2046 | |||
gcc "${rnpsrc}/src/examples/generate.c" -ogenerate $(pkg-config --cflags --libs $pkgflags librnp) $gccflags | |||
${CC-gcc} "${rnpsrc}/src/examples/generate.c" -ogenerate $(pkg-config --cflags --libs $pkgflags librnp) $gccflags |
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.
ditto
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.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
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.
Here, when CC
is an empty string, ${CC-gcc}
would actually remain an empty string. See my comment above.
export PATH="${LOCAL_BUILDS}/rnp-build/lib:${LOCAL_BUILDS}/rnp-build/bin:${LOCAL_BUILDS}/rnp-build/src/lib:$PATH" | ||
if [[ "${CC-gcc}" = "clang" ]]; then |
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.
ditto
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.
CC="" will force cmake default which will be gcc. If CC is unset it will also force cmake default but it may fail at this line depending on shell settings.
@@ -32,11 +32,22 @@ prepare_build_prerequisites() { | |||
prepare_test_env() { | |||
prepare_build_tool_env | |||
|
|||
export LD_LIBRARY_PATH="${GPG_INSTALL}/lib:${BOTAN_INSTALL}/lib:${JSONC_INSTALL}/lib:${RNP_INSTALL}/lib:$LD_LIBRARY_PATH" | |||
export LD_LIBRARY_PATH="${GPG_INSTALL}/lib:${BOTAN_INSTALL}/lib:${JSONC_INSTALL}/lib:${RNP_INSTALL}/lib:${LD_LIBRARY_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.
Would an improvement be:
export ...="...:${RNP_INSTALL}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
so that if $LD_LIBRARY_PATH
is an empty string, there would not be a trailing colon?
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.
If $LD_LIBRARY_PATH is unset the script won't fail
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.
If $LD_LIBRARY_PATH is unset the script won't fail
In which case $LD_LIBRARY_PATH
would end up having a trailing :
at the end. I'm not familiar with the behaviour of $LD_LIBRARY_PATH
with empty components, but if it's what's commonly accepted then I'm fine with it :)
git | ||
automake | ||
autoconf | ||
libtool | ||
automake-wrapper | ||
gnupg2 | ||
make | ||
pkg-config | ||
pkg-config |
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.
There's a trailing white space here.
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup environment | ||
run: | | ||
. ci/gha/setup-env.inc.sh | ||
ci/install_noncacheable_dependencies.sh | ||
- name: Cache | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.CACHE_DIR }} | ||
key: ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ env.BUILD_MODE }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} | ||
- name: Build cache | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
set -x | ||
ci/install_cacheable_dependencies.sh | ||
- name: tests | ||
run: | | ||
set -x | ||
ci/run.sh | ||
ls -la "${RNP_INSTALL}/lib/"librnp*.so | ||
! ctest -N | grep 'ruby' > /dev/null | ||
! ls -la src/tests/ | grep 'ruby' > /dev/null |
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.
I think these lines have been indented by 11 white spaces? Maybe an accident?
@maxirmx some other side notes:
|
Does 'ni4-fix-rnp-hash-destructutor' follow this rule ? |
@maxirmx we usually use |
In this case there were no issue created for, so, yeah, no issue number. |
#1129