Skip to content

Commit

Permalink
ci: Use 7z format for Windows build artifacts
Browse files Browse the repository at this point in the history
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#567.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio authored and keith-packard committed Oct 20, 2022
1 parent abe9a90 commit eb934dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ jobs:
"name": "windows-x86_64",
"runner": "zephyr_runner",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "zip"
"archive": "7z"
},'
fi
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
"runner": "windows-2019-8c",
"container": "",
"bundle-host": "windows-x86_64",
"bundle-archive": "zip"
"bundle-archive": "7z"
},'
fi
Expand Down Expand Up @@ -413,7 +413,7 @@ jobs:
sudo apt-get install -y autoconf automake bison flex gettext \
help2man libboost-dev libboost-regex-dev \
libncurses5-dev libtool-bin libtool-doc \
pkg-config texinfo zip
pkg-config texinfo p7zip
# Install dependencies for cross compilation
if [ "${{ matrix.host.name }}" == "linux-aarch64" ]; then
Expand Down Expand Up @@ -758,10 +758,9 @@ jobs:
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} \
--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}
zip -r ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} \
${{ matrix.target }}
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} ${{ matrix.target }}
popd
fi
Expand Down Expand Up @@ -985,7 +984,7 @@ jobs:
# Install common dependencies
sudo apt-get update
sudo apt-get install -y zip
sudo apt-get install -y p7zip
# Set environment variables
echo "TAR=tar" >> $GITHUB_ENV
Expand Down Expand Up @@ -1030,9 +1029,8 @@ jobs:
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
-C . cmake
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
zip -r ${ARCHIVE_FILE} \
cmake
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
7z a -t7z -l ${ARCHIVE_FILE} cmake
fi
# Compute checksum
Expand Down Expand Up @@ -1075,7 +1073,7 @@ jobs:
# Install common dependencies
sudo apt-get update
sudo apt-get install -y jq zip
sudo apt-get install -y jq p7zip
# Set environment variables
echo "TAR=tar" >> $GITHUB_ENV
Expand Down Expand Up @@ -1135,8 +1133,8 @@ jobs:
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
EXTRACT="${TAR} -Jxvf"
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
EXTRACT="unzip"
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
EXTRACT="7z x -o."
fi
# Create bundle directory
Expand Down Expand Up @@ -1189,8 +1187,8 @@ jobs:
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_NAME}_minimal.${EXT} --owner=0 --group=0 \
-C . ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
zip -r ${ARCHIVE_NAME}_minimal.${EXT} ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
7z a -t7z -l ${ARCHIVE_NAME}_minimal.${EXT} ${ARCHIVE_DIR}
fi
# Stage toolchains
Expand Down Expand Up @@ -1219,8 +1217,8 @@ jobs:
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_NAME}.${EXT} --owner=0 --group=0 \
-C . ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
zip -r ${ARCHIVE_NAME}.${EXT} ${ARCHIVE_DIR}
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
7z a -t7z -l ${ARCHIVE_NAME}.${EXT} ${ARCHIVE_DIR}
fi
# Compute checksum
Expand Down Expand Up @@ -1327,7 +1325,7 @@ jobs:
shopt -u dotglob
# 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
python3 -m pip install --upgrade pip
Expand Down Expand Up @@ -1384,8 +1382,8 @@ jobs:
BUNDLE_FILE=${BUNDLE_NAME}.${{ matrix.testenv.bundle-archive }}
if [ "${{ matrix.testenv.bundle-archive }}" == "tar.xz" ]; then
${TAR} -Jxvf ${ARTIFACT_ROOT}/${BUNDLE_FILE} -C tools
elif [ "${{ matrix.testenv.bundle-archive }}" == "zip" ]; then
unzip ${ARTIFACT_ROOT}/${BUNDLE_FILE} -d tools
elif [ "${{ matrix.testenv.bundle-archive }}" == "7z" ]; then
7z x -otools ${ARTIFACT_ROOT}/${BUNDLE_FILE}
fi
# Run setup script
Expand Down
6 changes: 3 additions & 3 deletions scripts/template_setup_win
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set /p VERSION=<sdk_version

REM # Resolve release download base URI
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
echo Zephyr SDK %VERSION% Setup
Expand All @@ -54,7 +54,7 @@ call :check_command cmake 90
if [%ERRORLEVEL%] neq [0] goto end
call :check_command wget 91
if [%ERRORLEVEL%] neq [0] goto end
call :check_command unzip 92
call :check_command 7z 92
if [%ERRORLEVEL%] neq [0] goto end

REM # Enter interactive mode if enabled
Expand Down Expand Up @@ -152,7 +152,7 @@ for %%t in (%INST_TOOLCHAINS%) do (
)

REM # Extract archive
unzip -q !TOOLCHAIN_FILENAME!
7z x -o. !TOOLCHAIN_FILENAME!
if [!ERRORLEVEL!] neq [0] (
echo ERROR: Toolchain archive extraction failed
set EXITCODE=21
Expand Down

0 comments on commit eb934dc

Please sign in to comment.