ci: Use 7z format for Windows build artifacts

This commit updates the CI workflow to output .7z archives for the
Windows build artifacts.

The 7z format uses the LZMA compression algorithm, which offers
significantly improved data compression ratio.

The `-l` option is used such that symbolic links are stored as copies
of the linked files because Windows requires administrator privileges
to create symbolic links.

Note that 7z performs multi-threaded compression by default.

For more details, refer to the issue zephyrproject-rtos/sdk-ng#567.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2022-10-04 23:07:10 +09:00
parent f95874d1de
commit 5aa5274365
2 changed files with 21 additions and 23 deletions

View File

@ -252,7 +252,7 @@ jobs:
"name": "windows-x86_64", "name": "windows-x86_64",
"runner": "zephyr-runner-linux-x64-4xlarge", "runner": "zephyr-runner-linux-x64-4xlarge",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3", "container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "zip" "archive": "7z"
},' },'
fi fi
@ -309,7 +309,7 @@ jobs:
"runner": "windows-2019-8c", "runner": "windows-2019-8c",
"container": "", "container": "",
"bundle-host": "windows-x86_64", "bundle-host": "windows-x86_64",
"bundle-archive": "zip" "bundle-archive": "7z"
},' },'
fi fi
@ -413,7 +413,7 @@ jobs:
sudo apt-get install -y autoconf automake bison flex gettext \ sudo apt-get install -y autoconf automake bison flex gettext \
help2man libboost-dev libboost-regex-dev \ help2man libboost-dev libboost-regex-dev \
libncurses5-dev libtool-bin libtool-doc \ libncurses5-dev libtool-bin libtool-doc \
pkg-config texinfo zip pkg-config texinfo p7zip
# Install dependencies for cross compilation # Install dependencies for cross compilation
if [ "${{ matrix.host.name }}" == "linux-aarch64" ]; then if [ "${{ matrix.host.name }}" == "linux-aarch64" ]; then
@ -758,10 +758,9 @@ jobs:
XZ_OPT="-T0" \ XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} \ ${TAR} -Jcvf ${ARCHIVE_FILE} \
--owner=0 --group=0 -C ${OUTPUT_BASE}/${OUTPUT_DIR} ${{ matrix.target }} --owner=0 --group=0 -C ${OUTPUT_BASE}/${OUTPUT_DIR} ${{ matrix.target }}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then elif [ "${{ matrix.host.archive }}" == "7z" ]; then
pushd ${OUTPUT_BASE}/${OUTPUT_DIR} pushd ${OUTPUT_BASE}/${OUTPUT_DIR}
zip -r ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} \ 7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} ${{ matrix.target }}
${{ matrix.target }}
popd popd
fi fi
@ -985,7 +984,7 @@ jobs:
# Install common dependencies # Install common dependencies
sudo apt-get update sudo apt-get update
sudo apt-get install -y zip sudo apt-get install -y p7zip
# Set environment variables # Set environment variables
echo "TAR=tar" >> $GITHUB_ENV echo "TAR=tar" >> $GITHUB_ENV
@ -1030,9 +1029,8 @@ jobs:
XZ_OPT="-T0" \ XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} --owner=0 --group=0 \ ${TAR} -Jcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
-C . cmake -C . cmake
elif [ "${{ matrix.host.archive }}" == "zip" ]; then elif [ "${{ matrix.host.archive }}" == "7z" ]; then
zip -r ${ARCHIVE_FILE} \ 7z a -t7z -l ${ARCHIVE_FILE} cmake
cmake
fi fi
# Compute checksum # Compute checksum
@ -1075,7 +1073,7 @@ jobs:
# Install common dependencies # Install common dependencies
sudo apt-get update sudo apt-get update
sudo apt-get install -y jq zip sudo apt-get install -y jq p7zip
# Set environment variables # Set environment variables
echo "TAR=tar" >> $GITHUB_ENV echo "TAR=tar" >> $GITHUB_ENV
@ -1135,8 +1133,8 @@ jobs:
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
EXTRACT="${TAR} -Jxvf" EXTRACT="${TAR} -Jxvf"
elif [ "${{ matrix.host.archive }}" == "zip" ]; then elif [ "${{ matrix.host.archive }}" == "7z" ]; then
EXTRACT="unzip" EXTRACT="7z x -o."
fi fi
# Create bundle directory # Create bundle directory
@ -1189,8 +1187,8 @@ jobs:
XZ_OPT="-T0" \ XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_NAME}_minimal.${EXT} --owner=0 --group=0 \ ${TAR} -Jcvf ${ARCHIVE_NAME}_minimal.${EXT} --owner=0 --group=0 \
-C . ${ARCHIVE_DIR} -C . ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then elif [ "${{ matrix.host.archive }}" == "7z" ]; then
zip -r ${ARCHIVE_NAME}_minimal.${EXT} ${ARCHIVE_DIR} 7z a -t7z -l ${ARCHIVE_NAME}_minimal.${EXT} ${ARCHIVE_DIR}
fi fi
# Stage toolchains # Stage toolchains
@ -1219,8 +1217,8 @@ jobs:
XZ_OPT="-T0" \ XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_NAME}.${EXT} --owner=0 --group=0 \ ${TAR} -Jcvf ${ARCHIVE_NAME}.${EXT} --owner=0 --group=0 \
-C . ${ARCHIVE_DIR} -C . ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then elif [ "${{ matrix.host.archive }}" == "7z" ]; then
zip -r ${ARCHIVE_NAME}.${EXT} ${ARCHIVE_DIR} 7z a -t7z -l ${ARCHIVE_NAME}.${EXT} ${ARCHIVE_DIR}
fi fi
# Compute checksum # Compute checksum
@ -1327,7 +1325,7 @@ jobs:
shopt -u dotglob shopt -u dotglob
# Install required system packages # Install required system packages
choco install ccache dtc-msys2 gperf jq ninja wget unzip choco install ccache dtc-msys2 gperf jq ninja wget 7zip
# Upgrade pip # Upgrade pip
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
@ -1384,8 +1382,8 @@ jobs:
BUNDLE_FILE=${BUNDLE_NAME}.${{ matrix.testenv.bundle-archive }} BUNDLE_FILE=${BUNDLE_NAME}.${{ matrix.testenv.bundle-archive }}
if [ "${{ matrix.testenv.bundle-archive }}" == "tar.xz" ]; then if [ "${{ matrix.testenv.bundle-archive }}" == "tar.xz" ]; then
${TAR} -Jxvf ${ARTIFACT_ROOT}/${BUNDLE_FILE} -C tools ${TAR} -Jxvf ${ARTIFACT_ROOT}/${BUNDLE_FILE} -C tools
elif [ "${{ matrix.testenv.bundle-archive }}" == "zip" ]; then elif [ "${{ matrix.testenv.bundle-archive }}" == "7z" ]; then
unzip ${ARTIFACT_ROOT}/${BUNDLE_FILE} -d tools 7z x -otools ${ARTIFACT_ROOT}/${BUNDLE_FILE}
fi fi
# Run setup script # Run setup script

View File

@ -37,7 +37,7 @@ set /p VERSION=<sdk_version
REM # Resolve release download base URI REM # Resolve release download base URI
set DL_REL_BASE=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v%VERSION% set DL_REL_BASE=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v%VERSION%
set DL_TOOLCHAIN_FILENAME=toolchain_windows-x86_64_%%t.zip set DL_TOOLCHAIN_FILENAME=toolchain_windows-x86_64_%%t.7z
REM # Print banner REM # Print banner
echo Zephyr SDK %VERSION% Setup echo Zephyr SDK %VERSION% Setup
@ -54,7 +54,7 @@ call :check_command cmake 90
if [%ERRORLEVEL%] neq [0] goto end if [%ERRORLEVEL%] neq [0] goto end
call :check_command wget 91 call :check_command wget 91
if [%ERRORLEVEL%] neq [0] goto end if [%ERRORLEVEL%] neq [0] goto end
call :check_command unzip 92 call :check_command 7z 92
if [%ERRORLEVEL%] neq [0] goto end if [%ERRORLEVEL%] neq [0] goto end
REM # Enter interactive mode if enabled REM # Enter interactive mode if enabled
@ -152,7 +152,7 @@ for %%t in (%INST_TOOLCHAINS%) do (
) )
REM # Extract archive REM # Extract archive
unzip -q !TOOLCHAIN_FILENAME! 7z x -o. !TOOLCHAIN_FILENAME!
if [!ERRORLEVEL!] neq [0] ( if [!ERRORLEVEL!] neq [0] (
echo ERROR: Toolchain archive extraction failed echo ERROR: Toolchain archive extraction failed
set EXITCODE=21 set EXITCODE=21