-
Notifications
You must be signed in to change notification settings - Fork 18
Enable Drone CI #155
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: develop
Are you sure you want to change the base?
Enable Drone CI #155
Conversation
|
An automated preview of the documentation is available at https://155.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-02-12 14:50:43 UTC |
de737a5 to
f5bb742
Compare
📝 WalkthroughWalkthroughUpdates CI configuration to raise compiler and C++ standard constraints and remove a linux build matrix entry; adds two CI orchestration scripts (.drone/drone.sh and .drone/drone.bat) to implement multi-mode workflows (boost, codecov, valgrind, coverity, cmake variants) and Windows-specific handling. Changes
Sequence Diagram(s)sequenceDiagram
participant Drone
participant Repo as Repository
participant BoostCI as boost-ci
participant Zlib as zlib
participant Builder as Build scripts
Drone->>Repo: invoke .drone/drone.sh or .drone/drone.bat
Repo->>Repo: determine DRONE_JOB_BUILDTYPE and branch
alt boost / boost-job
Repo->>BoostCI: git clone boost-ci (common_install)
BoostCI->>Repo: provide install scripts/config
Repo->>Zlib: git clone zlib (if needed)
Repo->>Builder: run build scripts (build.bat / build.sh / b2)
Builder->>Repo: produce artifacts / test results
else codecov/valgrind/coverity
Repo->>BoostCI: common_install
Repo->>Builder: run corresponding mode script (codecov/valgrind/coverity)
Builder->>Repo: upload/report results
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.drone/drone.bat:
- Around line 1-3: The batch file containing the lines "@ECHO ON" and "setlocal
enabledelayedexpansion" must use CRLF endings and be exempted from the
repository-wide LF rule: add a .gitattributes entry that forces CRLF for this
batch script (e.g. "drone.bat text eol=crlf"), commit that change, and convert
the existing file to Windows line endings (CRLF) in the repository so the
committed file no longer uses LF-only endings; ensure this new attribute
overrides the current "* text=auto eol=lf" rule.
🧹 Nitpick comments (6)
.drone/drone.bat (3)
5-11: Use quotedSETsyntax consistently for safety.Several
SETassignments (Lines 5, 10, 28, 29) use the unquoted form, which is susceptible to trailing whitespace being captured in the variable value. UseSET "VAR=value"consistently, as already done on Lines 30–32.♻️ Proposed fix
-set TRAVIS_OS_NAME=windows +set "TRAVIS_OS_NAME=windows" IF "!DRONE_BRANCH!" == "" ( for /F %%i in ("!GITHUB_REF!") do `@set` TRAVIS_BRANCH=%%~nxi ) else ( - SET TRAVIS_BRANCH=!DRONE_BRANCH! + SET "TRAVIS_BRANCH=!DRONE_BRANCH!" )Similarly for Lines 28–29:
-SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH! -SET BOOST_CI_SRC_FOLDER=%cd% +SET "BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH!" +SET "BOOST_CI_SRC_FOLDER=%cd%"
22-23: Unix commands (cp,rm) in a batch file rely on Git-for-Windows / MSYS2 being onPATH.These commands are not native to
cmd.exe. This typically works in Drone CI Windows images that bundle Git for Windows, but it's an implicit dependency. If portability is a concern, native equivalents (xcopy/robocopy,rmdir /s /q) are safer.
38-39: Consider updating pinned zlib version to current stable release.zlib v1.2.13 (October 2022) is pinned in the dependency clone. The current stable release is v1.3.1 (January 2024). Evaluate whether this pin is intentional or if the build should track a newer version.
.drone/drone.sh (3)
20-37:common_installfunction is well-structured.The function handles the boost-ci clone, OSX
cdquirk, and sourcing of the shared install script cleanly. One minor style nit: Line 22 uses backticks instead of$().♻️ Minor: prefer $() over backticks
- export SELF=`basename $REPO_NAME` + export SELF=$(basename "$REPO_NAME")
83-86: Use[[ ]]or chained[ ] && [ ]instead of-a/-oinside[ ].The
-aand-ooperators inside[ ]are POSIX-deprecated and have known parsing edge cases. Shellcheck flags this as SC2166.♻️ Proposed fix
-if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then +if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" ] && { [ "$TRAVIS_BRANCH" = "develop" ] || [ "$TRAVIS_BRANCH" = "master" ]; } && { [ "$DRONE_BUILD_EVENT" = "push" ] || [ "$DRONE_BUILD_EVENT" = "cron" ]; }; then
99-109:cmake1path: recursive submodule init may be very slow for the Boost superproject.Line 109 runs
git submodule update --init --recursiveon the entire Boost tree, which clones all ~140 Boost libraries. The commented-out Line 108 (boostdep) suggests a more targeted approach was considered. If only this library's dependencies are needed, a selective submodule init would significantly speed up CI.Also, Line 99 uses backticks — same style nit as Line 22.
|
|
||
| @ECHO ON | ||
| setlocal enabledelayedexpansion |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if .gitattributes exists and has any eol rules for .bat files
if [ -f .gitattributes ]; then
echo "=== .gitattributes exists ==="
cat .gitattributes
else
echo "=== .gitattributes does not exist ==="
fi
echo ""
echo "=== Checking line endings of .drone/drone.bat ==="
# Check the actual line endings of drone.bat
file .drone/drone.bat
# Also use od to inspect the actual bytes
echo ""
echo "=== First few lines with od to check line ending bytes ==="
head -5 .drone/drone.bat | od -c | head -20Repository: cppalliance/capy
Length of output: 322
🏁 Script executed:
#!/bin/bash
# Use cat -A to show line ending characters
echo "=== Checking line endings with cat -A (first 10 lines) ==="
head -10 .drone/drone.bat | cat -A
echo ""
echo "=== Checking if .drone/drone.bat uses LF or CRLF ==="
# Use od -An -tx1 to show hex bytes
head -2 .drone/drone.bat | od -An -tx1 | head -5
echo ""
echo "=== Using hexdump to inspect first line ==="
head -1 .drone/drone.bat | hexdump -C
echo ""
echo "=== Verify .gitattributes content ==="
cat .gitattributesRepository: cppalliance/capy
Length of output: 595
Critical: Batch file must use Windows (CRLF) line endings.
The file .drone/drone.bat uses Unix (LF-only) line endings. The Windows cmd.exe batch parser has known bugs with LF-only files — particularly around GOTO/CALL label resolution near 512-byte boundaries — which can cause silent script malfunction. Additionally, the current .gitattributes rule (* text=auto eol=lf) enforces LF line endings for all text files, including batch files.
Add a specific .gitattributes entry to override this for batch files:
.drone/drone.bat text eol=crlf
🧰 Tools
🪛 Blinter (1.0.112)
[error] 1-1: Unix line endings detected. Explanation: Batch file uses Unix line endings (LF-only) which can cause GOTO/CALL label parsing failures and script malfunction due to Windows batch parser 512-byte boundary bugs. Recommendation: Convert file to Windows line endings (CRLF). Use tools like dos2unix, notepad++, or configure git with 'git config core.autocrlf true'. Context: File uses Unix line endings (LF-only) - 47 LF sequences found
(E018)
🤖 Prompt for AI Agents
In @.drone/drone.bat around lines 1 - 3, The batch file containing the lines
"@ECHO ON" and "setlocal enabledelayedexpansion" must use CRLF endings and be
exempted from the repository-wide LF rule: add a .gitattributes entry that
forces CRLF for this batch script (e.g. "drone.bat text eol=crlf"), commit that
change, and convert the existing file to Windows line endings (CRLF) in the
repository so the committed file no longer uses LF-only endings; ensure this new
attribute overrides the current "* text=auto eol=lf" rule.
|
GCOVR code coverage report https://155.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-02-12 14:56:51 UTC |
f5bb742 to
ad43150
Compare
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.drone/drone.bat:
- Line 16: Replace the echoed strings that use single quotes (e.g., echo
'==================================> INSTALL' and the similar echoes at the
other locations) because cmd.exe prints single quotes literally; change them to
use either no quotes or double quotes (e.g., echo
"==================================> INSTALL" or echo
==================================> INSTALL) and make sure to escape the >
character as ^> to avoid redirection in batch scripts; update the echo
invocations accordingly.
- Around line 21-23: The batch file uses Unix utilities; replace the cp and rm
commands with native Windows equivalents: after the git clone of
"boost-ci-cloned" copy the directory using a Windows command (e.g., xcopy
boost-ci-cloned\ci . /E /I /Y or robocopy boost-ci-cloned\ci . /E) to preserve
contents, then remove the cloned folder with rmdir /S /Q boost-ci-cloned (or use
robocopy's cleanup). Update the lines that run "cp -prf boost-ci-cloned/ci ."
and "rm -rf boost-ci-cloned" to these native commands so the script runs under
cmd.exe without Unix tools.
🧹 Nitpick comments (4)
.drone/drone.sh (3)
83-86: Replace-a/-owith&&/||inside[ ].The POSIX
-aand-ooperators inside[ ]are poorly defined and can misparse when operands resemble test operators. ShellCheck SC2166 flags this.♻️ Proposed fix
-if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then +if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" ] && { [ "$TRAVIS_BRANCH" = "develop" ] || [ "$TRAVIS_BRANCH" = "master" ]; } && { [ "$DRONE_BUILD_EVENT" = "push" ] || [ "$DRONE_BUILD_EVENT" = "cron" ]; }; then
9-16:export VAR=$(cmd)masks command failures underset -e.Lines 9, 13, 16 (and similarly 22, 34, 99) use
export VAR=$(cmd)which preventsset -efrom catching a non-zero exit from the subshell. Splitting declaration and assignment would preserve the exit code. Low risk in practice here sincepwd,whoami, andbasenamerarely fail, but worth noting for correctness.Example fix for line 9
-export DRONE_BUILD_DIR=$(pwd) +DRONE_BUILD_DIR=$(pwd) +export DRONE_BUILD_DIR
88-114:cmake1: full recursive submodule init may be very slow.Line 109 runs
git submodule update --init --recursiveon the entire Boost superproject. For a single library build, usingboostdep(commented out on line 108) to initialize only required dependencies would be significantly faster. If build time is a concern, consider re-enabling theboostdepapproach..drone/drone.bat (1)
30-33: Quoting inconsistency inSET/ifcomparisons.Line 30 uses
%BOOST_BRANCH%(immediate expansion) while the rest of the block uses!VAR!(delayed expansion). Inside a parenthesizedifblock,%VAR%is expanded at parse time, not at execution time. IfBOOST_BRANCHis set earlier within the same block, using%won't reflect the updated value. Here it's checking an externally-set variable so it works, but mixing expansion styles is error-prone. Consider using!BOOST_BRANCH!consistently for clarity.
| if "%DRONE_JOB_BUILDTYPE%" == "boost" ( | ||
|
|
||
| echo "Running boost job" | ||
| echo '==================================> INSTALL' |
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.
Single quotes are printed literally in cmd.exe.
echo '==================================> INSTALL' will output the surrounding ' characters. Use double quotes or no quotes for cleaner output. Same applies to lines 37 and 41.
Proposed fix
-echo '==================================> INSTALL'
+echo ==================================^> INSTALLNote: > must be escaped with ^ in batch to prevent redirection.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| echo '==================================> INSTALL' | |
| echo ==================================^> INSTALL |
🤖 Prompt for AI Agents
In @.drone/drone.bat at line 16, Replace the echoed strings that use single
quotes (e.g., echo '==================================> INSTALL' and the similar
echoes at the other locations) because cmd.exe prints single quotes literally;
change them to use either no quotes or double quotes (e.g., echo
"==================================> INSTALL" or echo
==================================> INSTALL) and make sure to escape the >
character as ^> to avoid redirection in batch scripts; update the echo
invocations accordingly.
| git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 | ||
| cp -prf boost-ci-cloned/ci . | ||
| rm -rf boost-ci-cloned |
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.
🧩 Analysis chain
🏁 Script executed:
cat -n .drone/drone.batRepository: cppalliance/capy
Length of output: 1670
🏁 Script executed:
#!/bin/bash
# Check if other .bat files in the repo also use Unix commands like cp/rm
rg -n '\b(cp |rm |ls |mv |cat |grep )\b' --type-add 'bat:*.bat' --type batRepository: cppalliance/capy
Length of output: 42
🏁 Script executed:
find . -name "*.yml" -o -name "*.yaml" | head -20Repository: cppalliance/capy
Length of output: 246
🏁 Script executed:
rg -l "drone" --type ymlRepository: cppalliance/capy
Length of output: 87
🏁 Script executed:
find . -name ".drone*" -type f | head -20Repository: cppalliance/capy
Length of output: 73
🏁 Script executed:
cat -n .drone.starRepository: cppalliance/capy
Length of output: 1428
🏁 Script executed:
ls -la .drone/Repository: cppalliance/capy
Length of output: 291
Use native Windows commands instead of Unix utilities in batch file.
Lines 22–23 use cp -prf and rm -rf, which are Unix utilities that won't run natively in cmd.exe. While these may work if Git Bash is available on PATH, this creates a fragile dependency. The file should use native Windows commands:
Suggested fix
-cp -prf boost-ci-cloned/ci .
-rm -rf boost-ci-cloned
+xcopy /s /e /q /y boost-ci-cloned\ci ci\
+rmdir /s /q boost-ci-cloned📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 | |
| cp -prf boost-ci-cloned/ci . | |
| rm -rf boost-ci-cloned | |
| git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1 | |
| xcopy /s /e /q /y boost-ci-cloned\ci ci\ | |
| rmdir /s /q boost-ci-cloned |
🤖 Prompt for AI Agents
In @.drone/drone.bat around lines 21 - 23, The batch file uses Unix utilities;
replace the cp and rm commands with native Windows equivalents: after the git
clone of "boost-ci-cloned" copy the directory using a Windows command (e.g.,
xcopy boost-ci-cloned\ci . /E /I /Y or robocopy boost-ci-cloned\ci . /E) to
preserve contents, then remove the cloned folder with rmdir /S /Q
boost-ci-cloned (or use robocopy's cleanup). Update the lines that run "cp -prf
boost-ci-cloned/ci ." and "rm -rf boost-ci-cloned" to these native commands so
the script runs under cmd.exe without Unix tools.
Summary by CodeRabbit