mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-26 18:31:11 +00:00
Build and run a test in CI (#10835)
* Actually build tests on Linux and allow RelWithDebInfo They weren't being built. Also cleaned up --config flags which enables RelWithDebInfo on Linux, now that Ninja Multi-Config is used, it's quite trivial. * Remove obsolete Slic3r Perl tests The directory doesn't exist, they're already gone. * Add GH job for running unit tests * Move unit test execution to script and upload test results * Don't run scheduled builds on forks * Only deploy from SoftFever/OrcaSlicer Will stop failures on forks * Use artifact instead of cache * Tweak archive and checkout paths Keep getting error: ``` /home/runner/work/_temp/902d0a0a-6d23-4fe0-a643-8b5cc4efd25b.sh: line 1: scripts/run_unit_tests.sh: Permission denied ``` That seems to be because I didn't use actions/checkout, the working directory is never setup correctly? So using checkout to get scripts directory. Unsure if archive will preserve the `build/tests/` prefix; will find out soon. * Use tar to package directory and write results to correct directory Tar preserves filenames and directory structure * Use tar -xvf not -xzf Muscle memory failed me * Add testing wiki page * Save test logs on failure and choose correct directory for junit * Consolidate apt install steps, use for unit tests too, disable non-Linux builds Temporarily disable non-Linux builds to save time while developing this. Cache the apt packages to save some time searching apt and downloading them again (though I realize this is also downloading, but hopefully by something closer and faster). Remove all the redundant packages listed in the workflow and debian distribution lists. * Remove apt install steps from workflow `./build-linux.sh -u` is supposed to install all needed packages, so it should build without needing anything besides that. If I'm wrong this commit will be dropped. * Need composite action checked out locally * Re-enable non-Linux builds now that it's working * Skip a deploy and a notarize in forks They only succeed in the main repo. * Fix multi-build for non-Release builds: share CONFIG * Correct build errors in unit tests Indeterminate method signatures resolved. Updated script to build all the tests. * Fix -g vs -e for RelWithDebInfo * Change CONFIG->BUILD_CONFIG Missed one in prior commits * Reduce wasteful redundant build artifact copies 1. Don't copy the artifacts and leave them; make a hard link first; only make a copy only while creating AppImage. 2. Don't tar up the `package` directory; nothing uses this tar AFAICT * Fix directory name * Change jigsaw auth test URLs to httpbin.org No idea why the basic auth doesn't work, but it doesn't work for `curl` CLI either. This does. * Remove force-build It got reverted at https://github.com/SoftFever/OrcaSlicer/commit/e3f049829bff3ac4de9fd271768948efc150e4c3 for unknown reasons. * Add timeout for unit tests in GitHub Actions workflow (#11146) --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Despite the script name, this doesn't necessarily create an "image";
|
||||
# it sets up a compatibility script wrapper for the binary and arranges some resources.
|
||||
|
||||
export ROOT=$(echo $ROOT | grep . || pwd)
|
||||
export NCORES=`nproc --all`
|
||||
CONFIG=Release
|
||||
|
||||
while getopts ":ih" opt; do
|
||||
while getopts ":ihR:" opt; do
|
||||
case ${opt} in
|
||||
i )
|
||||
export BUILD_IMAGE="1"
|
||||
;;
|
||||
h ) echo "Usage: ./build_linux_image.sh [-i]"
|
||||
h ) echo "Usage: ./build_linux_image.sh [-i][-R config]"
|
||||
echo " -i: Generate Appimage (optional)"
|
||||
exit 0
|
||||
echo " -R: Specify from which config to obtain the binary: Release, RelWithDebInfo, or Debug"
|
||||
exit 1
|
||||
;;
|
||||
R )
|
||||
CONFIG=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -18,30 +26,26 @@ done
|
||||
echo -n "[9/9] Generating Linux app..."
|
||||
#{
|
||||
# create directory and copy into it
|
||||
if [ -d "package" ]
|
||||
then
|
||||
rm -rf package/*
|
||||
rm -rf package/.* 2&>/dev/null
|
||||
else
|
||||
mkdir package
|
||||
if [ -d "package" ]; then
|
||||
rm -rf package
|
||||
fi
|
||||
mkdir package/bin
|
||||
mkdir -p package/bin
|
||||
|
||||
# copy Resources
|
||||
# Copy Resources
|
||||
cp -Rf ../resources package/resources
|
||||
|
||||
# Find and copy the @SLIC3R_APP_CMD@ binary from Multi-Config build
|
||||
if [ -f "src/Release/@SLIC3R_APP_CMD@" ]; then
|
||||
cp -f src/Release/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
|
||||
# Find and hard link the @SLIC3R_APP_CMD@ binary from Multi-Config build
|
||||
ORIGINAL_BINARY_LOCATION=""
|
||||
if [ -f "src/${CONFIG}/@SLIC3R_APP_CMD@" ]; then
|
||||
ORIGINAL_BINARY_LOCATION="$(realpath "src/${CONFIG}/@SLIC3R_APP_CMD@")"
|
||||
elif [ -f "src/@SLIC3R_APP_CMD@" ]; then
|
||||
# Fallback for single-config builds
|
||||
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
|
||||
ORIGINAL_BINARY_LOCATION="$(realpath "src/@SLIC3R_APP_CMD@")"
|
||||
else
|
||||
echo "Error: @SLIC3R_APP_CMD@ binary not found in any configuration directory"
|
||||
exit 1
|
||||
fi
|
||||
# remove unneeded po from resources
|
||||
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
|
||||
cp -fl "${ORIGINAL_BINARY_LOCATION}" package/bin/@SLIC3R_APP_CMD@
|
||||
|
||||
# create bin
|
||||
cat << EOF >@SLIC3R_APP_CMD@
|
||||
@@ -76,10 +80,13 @@ exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"
|
||||
EOF
|
||||
|
||||
chmod ug+x @SLIC3R_APP_CMD@
|
||||
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
|
||||
pushd package > /dev/null
|
||||
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
|
||||
popd > /dev/null
|
||||
cp -fl @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
|
||||
# Nothing uses this tar? Remove if nobody has complained and it's been a while since this comment added.
|
||||
# Original commit was https://github.com/SoftFever/OrcaSlicer/commit/f5a4862da52fc68f77b5201ddf330a9800d83228
|
||||
# and it doesn't appear to have been used there either.
|
||||
#pushd package > /dev/null
|
||||
#tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
|
||||
#popd > /dev/null
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
@@ -87,11 +94,20 @@ if [[ -n "$BUILD_IMAGE" ]]
|
||||
then
|
||||
echo -n "Creating Appimage for distribution..."
|
||||
#{
|
||||
pushd package > /dev/null
|
||||
# AppImage script modifies files in place, so make a copy and clean up after.
|
||||
rm -rf package_appimage
|
||||
cp -Rf package package_appimage
|
||||
pushd package_appimage > /dev/null
|
||||
chmod +x ../build_appimage.sh
|
||||
../build_appimage.sh
|
||||
popd > /dev/null
|
||||
mv package/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage"
|
||||
if ../build_appimage.sh; then
|
||||
# Clean up on success.
|
||||
popd > /dev/null
|
||||
mv package_appimage/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage"
|
||||
rm -fR package_appimage
|
||||
else
|
||||
# Leave files on failure so you can debug.
|
||||
popd > /dev/null
|
||||
fi
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user