Skip to content

Commit 43308f8

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 43308f8

File tree

1 file changed

+75
-5
lines changed

1 file changed

+75
-5
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,14 +1022,47 @@ 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 |
1040+
sudo apt-key add -
1041+
echo "deb https://qemu.weilnetz.de/debian/ testing contrib" |
1042+
sudo tee /etc/apt/sources.list.d/cygwin.list
1043+
apt-get update
1044+
1045+
apt-get install -y \
1046+
mingw64-x86-64-glib2.0 \
1047+
mingw64-x86-64-pixman
1048+
fi
1049+
10251050
# Set environment variables
10261051
echo "TAR=tar" >> $GITHUB_ENV
1052+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10271053
10281054
- name: Set up build environment (macOS)
10291055
if: ${{ runner.os == 'macOS' }}
10301056
run: |
1057+
# Create case-sensitive workspace volume for macOS
1058+
WORKSPACE="/Volumes/Workspace"
1059+
hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1060+
-volname Workspace -type SPARSE -size 150g -fs HFSX
1061+
hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1062+
10311063
# Set environment variables
10321064
echo "TAR=gtar" >> $GITHUB_ENV
1065+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10331066
10341067
- name: Check out source code
10351068
if: ${{ github.event_name != 'pull_request_target' }}
@@ -1078,7 +1111,7 @@ jobs:
10781111
echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10791112
echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10801113
1081-
- name: Build Linux host tools
1114+
- name: Build host tools (Linux)
10821115
if: startsWith(matrix.host.name, 'linux-')
10831116
run: |
10841117
POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1111,6 +1144,47 @@ jobs:
11111144
md5sum ${ARCHIVE_FILE} > md5.sum
11121145
sha256sum ${ARCHIVE_FILE} > sha256.sum
11131146
1147+
- name: Build host tools (non-Linux)
1148+
if: "!startsWith(matrix.host.name, 'linux-')"
1149+
run: |
1150+
# Create output directory
1151+
mkdir -p ${WORKSPACE}/hosttools
1152+
1153+
# Build QEMU
1154+
QEMU_BUILD="${WORKSPACE}/build/qemu"
1155+
QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1156+
QEMU_PREFIX="${WORKSPACE}/hosttools/qemu"
1157+
1158+
mkdir -p ${QEMU_BUILD}
1159+
pushd ${QEMU_BUILD}
1160+
scripts/build_qemu.sh \
1161+
${{ matrix.host.name }} \
1162+
${GITHUB_WORKSPACE}/qemu \
1163+
${QEMU_PREFIX}
1164+
popd
1165+
1166+
# TODO: Build ARC QEMU
1167+
# TODO: Build Xilinx QEMU
1168+
# TODO: Build OpenOCD
1169+
1170+
# Create archive
1171+
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1172+
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.xz
1173+
1174+
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1175+
XZ_OPT="-T0" \
1176+
${TAR} -Jcvf ${ARCHIVE_FILE} \
1177+
--owner=0 --group=0 -C ${WORKSPACE} hosttools
1178+
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1179+
pushd ${WORKSPACE}
1180+
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} hosttools
1181+
popd
1182+
fi
1183+
1184+
# Compute checksum
1185+
md5sum ${ARCHIVE_FILE} > md5.sum
1186+
sha256sum ${ARCHIVE_FILE} > sha256.sum
1187+
11141188
- name: Setup debug session
11151189
if: always() && needs.setup.outputs.debug == 'hosttools'
11161190
uses: mxschmitt/action-tmate@v3
@@ -1128,7 +1202,6 @@ jobs:
11281202
popd
11291203
11301204
- name: Upload toolchain build artifact
1131-
if: startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11321205
uses: actions/upload-artifact@v4
11331206
with:
11341207
name: hosttools_${{ matrix.host.name }}
@@ -1137,9 +1210,6 @@ jobs:
11371210
md5.sum
11381211
sha256.sum
11391212
1140-
# TODO: Add host tool build process for macOS hosts.
1141-
# TODO: Add host tool build process for Windows hosts.
1142-
11431213
# Build CMake package
11441214
build-cmake-pkg:
11451215
name: CMake Package (${{ matrix.host.name }})

0 commit comments

Comments
 (0)