Skip to content

Commit a23826f

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 1b697ad commit a23826f

File tree

1 file changed

+73
-5
lines changed

1 file changed

+73
-5
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,14 +1022,45 @@ jobs:
10221022
- name: Set up build environment (Linux)
10231023
if: ${{ runner.os == 'Linux' }}
10241024
run: |
1025+
# Create workspace directory
1026+
WORKSPACE="${RUNNER_TEMP}/workspace"
1027+
mkdir -p ${WORKSPACE}
1028+
1029+
# Install dependencies for cross compilation
1030+
if [ "${{ matrix.host.name }}" == "windows-x86_64" ]; then
1031+
# Install MinGW-w64 toolchain
1032+
apt-get install -y \
1033+
binutils-mingw-w64 \
1034+
gcc-mingw-w64 \
1035+
g++-mingw-w64 \
1036+
mingw-w64-tools
1037+
1038+
# Install extra MinGW-w64 libraries requried for QEMU build
1039+
wget -O - https://qemu.weilnetz.de/debian/gpg.key | apt-key add -
1040+
echo "deb https://qemu.weilnetz.de/debian/ testing contrib" | tee /etc/apt/sources.list.d/cygwin.list
1041+
apt-get update
1042+
1043+
apt-get install -y \
1044+
mingw64-x86-64-glib2.0 \
1045+
mingw64-x86-64-pixman
1046+
fi
1047+
10251048
# Set environment variables
10261049
echo "TAR=tar" >> $GITHUB_ENV
1050+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10271051
10281052
- name: Set up build environment (macOS)
10291053
if: ${{ runner.os == 'macOS' }}
10301054
run: |
1055+
# Create case-sensitive workspace volume for macOS
1056+
WORKSPACE="/Volumes/Workspace"
1057+
hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1058+
-volname Workspace -type SPARSE -size 150g -fs HFSX
1059+
hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1060+
10311061
# Set environment variables
10321062
echo "TAR=gtar" >> $GITHUB_ENV
1063+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10331064
10341065
- name: Check out source code
10351066
if: ${{ github.event_name != 'pull_request_target' }}
@@ -1078,7 +1109,7 @@ jobs:
10781109
echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10791110
echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10801111
1081-
- name: Build Linux host tools
1112+
- name: Build host tools (Linux)
10821113
if: startsWith(matrix.host.name, 'linux-')
10831114
run: |
10841115
POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1111,6 +1142,47 @@ jobs:
11111142
md5sum ${ARCHIVE_FILE} > md5.sum
11121143
sha256sum ${ARCHIVE_FILE} > sha256.sum
11131144
1145+
- name: Build host tools (non-Linux)
1146+
if: "!startsWith(matrix.host.name, 'linux-')"
1147+
run: |
1148+
# Create output directory
1149+
mkdir -p ${WORKSPACE}/hosttools
1150+
1151+
# Build QEMU
1152+
QEMU_BUILD="${WORKSPACE}/build/qemu"
1153+
QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1154+
QEMU_PREFIX="${WORKSPACE}/hosttools/qemu"
1155+
1156+
mkdir -p ${QEMU_BUILD}
1157+
pushd ${QEMU_BUILD}
1158+
scripts/build_qemu.sh \
1159+
${{ matrix.host.name }} \
1160+
${GITHUB_WORKSPACE}/qemu \
1161+
${QEMU_PREFIX}
1162+
popd
1163+
1164+
# TODO: Build ARC QEMU
1165+
# TODO: Build Xilinx QEMU
1166+
# TODO: Build OpenOCD
1167+
1168+
# Create archive
1169+
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1170+
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.xz
1171+
1172+
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1173+
XZ_OPT="-T0" \
1174+
${TAR} -Jcvf ${ARCHIVE_FILE} \
1175+
--owner=0 --group=0 -C ${WORKSPACE} hosttools
1176+
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1177+
pushd ${WORKSPACE}
1178+
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} hosttools
1179+
popd
1180+
fi
1181+
1182+
# Compute checksum
1183+
md5sum ${ARCHIVE_FILE} > md5.sum
1184+
sha256sum ${ARCHIVE_FILE} > sha256.sum
1185+
11141186
- name: Setup debug session
11151187
if: always() && needs.setup.outputs.debug == 'hosttools'
11161188
uses: mxschmitt/action-tmate@v3
@@ -1128,7 +1200,6 @@ jobs:
11281200
popd
11291201
11301202
- name: Upload toolchain build artifact
1131-
if: startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11321203
uses: actions/upload-artifact@v4
11331204
with:
11341205
name: hosttools_${{ matrix.host.name }}
@@ -1137,9 +1208,6 @@ jobs:
11371208
md5.sum
11381209
sha256.sum
11391210
1140-
# TODO: Add host tool build process for macOS hosts.
1141-
# TODO: Add host tool build process for Windows hosts.
1142-
11431211
# Build CMake package
11441212
build-cmake-pkg:
11451213
name: CMake Package (${{ matrix.host.name }})

0 commit comments

Comments
 (0)