Skip to content

Commit

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

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio authored and keith-packard committed Oct 22, 2022
1 parent 409600d commit c354967
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
45 changes: 25 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
"name": "linux-x86_64",
"runner": "zephyr_runner",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
Expand All @@ -225,7 +225,7 @@ jobs:
"name": "linux-aarch64",
"runner": "zephyr_runner",
"container": "ghcr.io/zephyrproject-rtos/sdk-build:v1.2.3",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
Expand All @@ -234,7 +234,7 @@ jobs:
"name": "macos-x86_64",
"runner": "zephyr_runner-macos-x86_64",
"container": "",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
Expand All @@ -243,7 +243,7 @@ jobs:
"name": "macos-aarch64",
"runner": "zephyr_runner-macos-x86_64",
"container": "",
"archive": "tar.gz"
"archive": "tar.xz"
},'
fi
Expand Down Expand Up @@ -289,7 +289,7 @@ jobs:
"runner": "ubuntu-20.04",
"container": "",
"bundle-host": "linux-x86_64",
"bundle-archive": "tar.gz"
"bundle-archive": "tar.xz"
},'
fi
Expand All @@ -299,7 +299,7 @@ jobs:
"runner": "macos-11",
"container": "",
"bundle-host": "macos-x86_64",
"bundle-archive": "tar.gz"
"bundle-archive": "tar.xz"
},'
fi
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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} \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/template_setup_posix
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,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"
Expand Down

0 comments on commit c354967

Please sign in to comment.