Skip to content

Commit 8613f09

Browse files
committed
[WIP] ci: Add non-Linux host tool build step
This commit adds a step that build the host tools for macOS and Windows hosts. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 04c7928 commit 8613f09

File tree

1 file changed

+63
-5
lines changed

1 file changed

+63
-5
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,14 +1026,35 @@ jobs:
10261026
- name: Set up build environment (Linux)
10271027
if: ${{ runner.os == 'Linux' }}
10281028
run: |
1029+
# Create workspace directory
1030+
WORKSPACE="${RUNNER_TEMP}/workspace"
1031+
mkdir -p ${WORKSPACE}
1032+
1033+
# Install dependencies for cross compilation
1034+
if [ "${{ matrix.host.name }}" == "windows-x86_64" ]; then
1035+
# Make MinGW-w64 win32 cross toolchain available in PATH
1036+
echo "/opt/mingw-w64-win32/bin" >> $GITHUB_PATH
1037+
1038+
# Configure pkgconfig discovery path
1039+
echo "PKG_CONFIG_PATH=/opt/mingw-w64-win32/x86_64-w64-mingw32/lib/pkgconfig" >> $GITHUB_ENV
1040+
fi
1041+
10291042
# Set environment variables
10301043
echo "TAR=tar" >> $GITHUB_ENV
1044+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10311045
10321046
- name: Set up build environment (macOS)
10331047
if: ${{ runner.os == 'macOS' }}
10341048
run: |
1049+
# Create case-sensitive workspace volume for macOS
1050+
WORKSPACE="/Volumes/Workspace"
1051+
hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1052+
-volname Workspace -type SPARSE -size 150g -fs HFSX
1053+
hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1054+
10351055
# Set environment variables
10361056
echo "TAR=gtar" >> $GITHUB_ENV
1057+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10371058
10381059
- name: Check out source code
10391060
if: ${{ github.event_name != 'pull_request_target' }}
@@ -1082,7 +1103,7 @@ jobs:
10821103
echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10831104
echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10841105
1085-
- name: Build Linux host tools
1106+
- name: Build host tools (Linux)
10861107
if: startsWith(matrix.host.name, 'linux-')
10871108
run: |
10881109
POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1115,6 +1136,47 @@ jobs:
11151136
md5sum ${ARCHIVE_FILE} > md5.sum
11161137
sha256sum ${ARCHIVE_FILE} > sha256.sum
11171138
1139+
- name: Build host tools (non-Linux)
1140+
if: "!startsWith(matrix.host.name, 'linux-')"
1141+
run: |
1142+
# Create output directory
1143+
mkdir -p ${WORKSPACE}/hosttools
1144+
1145+
# Build QEMU
1146+
QEMU_BUILD="${WORKSPACE}/build/qemu"
1147+
QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1148+
QEMU_PREFIX="${WORKSPACE}/hosttools/qemu"
1149+
1150+
mkdir -p ${QEMU_BUILD}
1151+
pushd ${QEMU_BUILD}
1152+
${GITHUB_WORKSPACE}/scripts/build_qemu.sh \
1153+
${{ matrix.host.name }} \
1154+
${GITHUB_WORKSPACE}/qemu \
1155+
${QEMU_PREFIX}
1156+
popd
1157+
1158+
# TODO: Build ARC QEMU
1159+
# TODO: Build Xilinx QEMU
1160+
# TODO: Build OpenOCD
1161+
1162+
# Create archive
1163+
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1164+
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.${{ matrix.host.archive }}
1165+
1166+
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1167+
XZ_OPT="-T0" \
1168+
${TAR} -Jcvf ${ARCHIVE_FILE} \
1169+
--owner=0 --group=0 -C ${WORKSPACE} hosttools
1170+
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1171+
pushd ${WORKSPACE}
1172+
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} hosttools
1173+
popd
1174+
fi
1175+
1176+
# Compute checksum
1177+
md5sum ${ARCHIVE_FILE} > md5.sum
1178+
sha256sum ${ARCHIVE_FILE} > sha256.sum
1179+
11181180
- name: Setup debug session
11191181
if: always() && needs.setup.outputs.debug == 'hosttools'
11201182
uses: mxschmitt/action-tmate@v3
@@ -1132,7 +1194,6 @@ jobs:
11321194
popd
11331195
11341196
- name: Upload toolchain build artifact
1135-
if: startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11361197
uses: actions/upload-artifact@v4
11371198
with:
11381199
name: hosttools_${{ matrix.host.name }}
@@ -1141,9 +1202,6 @@ jobs:
11411202
md5.sum
11421203
sha256.sum
11431204
1144-
# TODO: Add host tool build process for macOS hosts.
1145-
# TODO: Add host tool build process for Windows hosts.
1146-
11471205
# Build CMake package
11481206
build-cmake-pkg:
11491207
name: CMake Package (${{ matrix.host.name }})

0 commit comments

Comments
 (0)