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

Add CI script to manually build tarballs for the releases. #2228

Merged
merged 1 commit into from
May 23, 2024

Conversation

ni4
Copy link
Contributor

@ni4 ni4 commented May 7, 2024

It could be automated/refactored in some way (like for tag push), however let's have at least manual one for now.
Related to #2227

@ni4 ni4 requested review from ronaldtse and ribose-jeffreylau May 7, 2024 13:15
Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.64%. Comparing base (3c42d77) to head (02bf6ee).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2228   +/-   ##
=======================================
  Coverage   83.64%   83.64%           
=======================================
  Files         107      107           
  Lines       23168    23168           
=======================================
  Hits        19378    19378           
  Misses       3790     3790           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ribose-jeffreylau ribose-jeffreylau left a comment

Choose a reason for hiding this comment

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

Thanks @ni4 ! Left some suggestions for you... :)


# Check whether tarball builds
# cpack would use symantic versioning for file names, i.e. rnp-v0.17.1
RNP_TGZ=$(echo ${RNP_BLD}/*.tar.gz)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to enclose variables in double quotes:

-RNP_TGZ=$(echo ${RNP_BLD}/*.tar.gz)
+RNP_TGZ=$(echo "${RNP_BLD}"/*.tar.gz)

Fine for now, but could break the tar command below if somehow there is more than one .tar.gz present in the $RNP_BLD directory.

Quick and dirty 2nd take:

-RNP_TGZ=$(echo ${RNP_BLD}/*.tar.gz)
+RNP_TGZ=$(find "${RNP_BLD}" -maxdepth 1 -type f -name '*.tar.gz' | head -n 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

mkdir -p "${RNP_CHK}"

tar -xzf "${RNP_TGZ}" -C "${RNP_CHK}"
RNP_UNP=$(echo ${RNP_CHK}/*)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to enclose variables in double quotes:

-RNP_UNP=$(echo ${RNP_CHK}/*)
+RNP_UNP=$(echo "${RNP_CHK}"/*)

or, to prevent from returning multiple directories:

-RNP_UNP=$(echo ${RNP_CHK}/*)
+RNP_UNP=$(find "${RNP_CHK}" -maxdepth 1 -type d | head -n 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!


tar -xzf "${RNP_TGZ}" -C "${RNP_CHK}"
RNP_UNP=$(echo ${RNP_CHK}/*)
cmake -B ${RNP_CHK}/build -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON "${RNP_UNP}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to enclose variables in double quotes:

-cmake -B ${RNP_CHK}/build -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON "${RNP_UNP}"
+cmake -B "${RNP_CHK}"/build -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON "${RNP_UNP}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

tar -xzf "${RNP_TGZ}" -C "${RNP_CHK}"
RNP_UNP=$(echo ${RNP_CHK}/*)
cmake -B ${RNP_CHK}/build -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON "${RNP_UNP}"
cmake --build ${RNP_CHK}/build --parallel "$(nproc)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to enclose variables in double quotes:

-cmake --build ${RNP_CHK}/build --parallel "$(nproc)"
+cmake --build "${RNP_CHK}"/build --parallel "$(nproc)"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

# Check whether artifacts dir exists
RNP_ART="/opt/artifacts"
if [ ! -d "${RNP_ART}" ]; then
echo "Error: artifacts dir ${RNP_ART} doesn't exist. Create or mount it before running the script."
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer to direct error messages to stderr:

-echo "Error: artifacts dir ${RNP_ART} doesn't exist. Create or mount it before running the script."
+>&2 echo "Error: artifacts dir ${RNP_ART} doesn't exist. Create or mount it before running the script."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

@ni4 ni4 force-pushed the ni4-add-tarball-building-script branch from 23fafb7 to 6dddbe1 Compare May 8, 2024 13:10
@ni4
Copy link
Contributor Author

ni4 commented May 8, 2024

Thanks, @ribose-jeffreylau ! Fixed and re-pushed.

@ni4 ni4 requested a review from ribose-jeffreylau May 8, 2024 13:11
Copy link
Contributor

@ribose-jeffreylau ribose-jeffreylau left a comment

Choose a reason for hiding this comment

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

Thanks @ni4!

@ni4 ni4 requested review from maxirmx and antonsviridenko May 9, 2024 08:37
@ni4 ni4 force-pushed the ni4-add-tarball-building-script branch from 6dddbe1 to b79a303 Compare May 9, 2024 08:50
@antonsviridenko
Copy link
Contributor

Does it build the source tarball or the binary one?

@antonsviridenko
Copy link
Contributor

There is one failing test...

@ni4
Copy link
Contributor Author

ni4 commented May 13, 2024

Does it build the source tarball or the binary one?

It builds (and checks) source tarball, so it could be uploaded to the release artifacts. At some point it would be upgraded to run automatically on tag push or PR merge to the release branch :-)

There is one failing test...

Thanks, re-run it.

@ni4 ni4 mentioned this pull request May 13, 2024
Copy link
Member

@maxirmx maxirmx left a comment

Choose a reason for hiding this comment

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

The rationale behind ci-legacy folder was to stash there unused ci scripts and remove this folder eventually (or optionally)

Please consider moving this script to ci folder

@ni4 ni4 force-pushed the ni4-add-tarball-building-script branch from b79a303 to 02bf6ee Compare May 22, 2024 08:33
@ni4
Copy link
Contributor Author

ni4 commented May 22, 2024

@maxirmx Oh, sure. Thanks for noticing.

@ni4 ni4 requested a review from maxirmx May 23, 2024 09:05
@ni4
Copy link
Contributor Author

ni4 commented May 23, 2024

@maxirmx Is it good to merge now?

Copy link
Member

@maxirmx maxirmx left a comment

Choose a reason for hiding this comment

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

Thank you

@maxirmx maxirmx merged commit e69b091 into main May 23, 2024
137 checks passed
@maxirmx maxirmx deleted the ni4-add-tarball-building-script branch May 23, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants