ci: Use tar.xz format for Linux and macOS build artifacts

This commit updates the CI workflow to output .tar.xz archives for the
Linux and macOS build artifacts.

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

Note that the `-T0` XZ option is used to perform multi-threaded
compression in spite of reduced compression ratio; otherwise,
compressing the distribution bundle may take tens of minutes to
complete.

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 21:03:03 +09:00
parent 01fbee4426
commit f95874d1de
2 changed files with 26 additions and 21 deletions

View File

@ -216,7 +216,7 @@ jobs:
"name": "linux-x86_64",
"runner": "zephyr-runner-linux-x64-4xlarge",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
@ -225,7 +225,7 @@ jobs:
"name": "linux-aarch64",
"runner": "zephyr-runner-linux-x64-4xlarge",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
@ -234,7 +234,7 @@ jobs:
"name": "macos-x86_64",
"runner": "zephyr_runner-macos-x86_64",
"container": "",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
@ -243,7 +243,7 @@ jobs:
"name": "macos-aarch64",
"runner": "zephyr_runner-macos-x86_64",
"container": "",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
@ -289,7 +289,7 @@ jobs:
"runner": "ubuntu-20.04",
"container": "",
"bundle-host": "linux-x86_64",
"bundle-archive": "tar.gz"
"bundle-archive": "tar.xz"
},'
fi
@ -299,7 +299,7 @@ jobs:
"runner": "macos-11",
"container": "",
"bundle-host": "macos-x86_64",
"bundle-archive": "tar.gz"
"bundle-archive": "tar.xz"
},'
fi
@ -754,8 +754,9 @@ jobs:
ARCHIVE_NAME=toolchain_${{ matrix.host.name }}_${{ matrix.target }}
ARCHIVE_FILE=${ARCHIVE_NAME}.${{ matrix.host.archive }}
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
${TAR} -zcvf ${ARCHIVE_FILE} \
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} \
--owner=0 --group=0 -C ${OUTPUT_BASE}/${OUTPUT_DIR} ${{ matrix.target }}
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
pushd ${OUTPUT_BASE}/${OUTPUT_DIR}
@ -918,9 +919,10 @@ jobs:
ARTIFACT=${ARTIFACT[0]}
ARTIFACT=$(basename ${ARTIFACT})
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.gz
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.xz
${TAR} -zcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
-C ${ARTIFACT_ROOT} ${ARTIFACT}
# Compute checksum
@ -1024,8 +1026,9 @@ jobs:
ARCHIVE_NAME=cmake_${{ matrix.host.name }}
ARCHIVE_FILE=${ARCHIVE_NAME}.${{ matrix.host.archive }}
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
${TAR} -zcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
XZ_OPT="-T0" \
${TAR} -Jcvf ${ARCHIVE_FILE} --owner=0 --group=0 \
-C . cmake
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
zip -r ${ARCHIVE_FILE} \
@ -1130,8 +1133,8 @@ jobs:
echo "BUNDLE_ARCHIVE_NAME=${ARCHIVE_NAME}" >> $GITHUB_ENV
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
EXTRACT="${TAR} -zxvf"
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
EXTRACT="${TAR} -Jxvf"
elif [ "${{ matrix.host.archive }}" == "zip" ]; then
EXTRACT="unzip"
fi
@ -1182,8 +1185,9 @@ jobs:
popd
# Create minimal (without toolchains) distribution bundle archive
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
${TAR} -zcvf ${ARCHIVE_NAME}_minimal.${EXT} --owner=0 --group=0 \
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
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}
@ -1211,8 +1215,9 @@ jobs:
popd
# Create full distribution bundle archive
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
${TAR} -zcvf ${ARCHIVE_NAME}.${EXT} --owner=0 --group=0 \
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
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}
@ -1377,8 +1382,8 @@ jobs:
# Extract distribution bundle archive
BUNDLE_FILE=${BUNDLE_NAME}.${{ matrix.testenv.bundle-archive }}
if [ "${{ matrix.testenv.bundle-archive }}" == "tar.gz" ]; then
${TAR} -zxvf ${ARTIFACT_ROOT}/${BUNDLE_FILE} -C tools
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
fi

View File

@ -186,7 +186,7 @@ esac
# Resolve release download base URI
dl_rel_base="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${version}"
dl_toolchain_filename='toolchain_${host}_${toolchain}.tar.gz'
dl_toolchain_filename='toolchain_${host}_${toolchain}.tar.xz'
# Print banner
echo "Zephyr SDK ${version} Setup"