Skip to content

Commit 5cc87f4

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 f915121 commit 5cc87f4

File tree

1 file changed

+74
-5
lines changed

1 file changed

+74
-5
lines changed

.github/workflows/ci.yml

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,14 +1026,46 @@ 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+
# Install MinGW-w64 toolchain
1036+
apt-get install -y \
1037+
binutils-mingw-w64 \
1038+
gcc-mingw-w64 \
1039+
g++-mingw-w64 \
1040+
mingw-w64-tools
1041+
1042+
# Install extra MinGW-w64 libraries requried for QEMU build
1043+
gpg --keyserver keyserver.ubuntu.com --recv-keys E08C21D5677450AD
1044+
gpg --export --armor E08C21D5677450AD | apt-key add -
1045+
echo "deb https://qemu.weilnetz.de/debian/ testing contrib" > /etc/apt/sources.list.d/cygwin.list
1046+
apt-get update
1047+
1048+
apt-get install -y \
1049+
mingw64-x86-64-glib2.0 \
1050+
mingw64-x86-64-pixman
1051+
fi
1052+
10291053
# Set environment variables
10301054
echo "TAR=tar" >> $GITHUB_ENV
1055+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10311056
10321057
- name: Set up build environment (macOS)
10331058
if: ${{ runner.os == 'macOS' }}
10341059
run: |
1060+
# Create case-sensitive workspace volume for macOS
1061+
WORKSPACE="/Volumes/Workspace"
1062+
hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1063+
-volname Workspace -type SPARSE -size 150g -fs HFSX
1064+
hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1065+
10351066
# Set environment variables
10361067
echo "TAR=gtar" >> $GITHUB_ENV
1068+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10371069
10381070
- name: Check out source code
10391071
if: ${{ github.event_name != 'pull_request_target' }}
@@ -1082,7 +1114,7 @@ jobs:
10821114
echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10831115
echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10841116
1085-
- name: Build Linux host tools
1117+
- name: Build host tools (Linux)
10861118
if: startsWith(matrix.host.name, 'linux-')
10871119
run: |
10881120
POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1115,6 +1147,47 @@ jobs:
11151147
md5sum ${ARCHIVE_FILE} > md5.sum
11161148
sha256sum ${ARCHIVE_FILE} > sha256.sum
11171149
1150+
- name: Build host tools (non-Linux)
1151+
if: "!startsWith(matrix.host.name, 'linux-')"
1152+
run: |
1153+
# Create output directory
1154+
mkdir -p ${WORKSPACE}/hosttools
1155+
1156+
# Build QEMU
1157+
QEMU_BUILD="${WORKSPACE}/build/qemu"
1158+
QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1159+
QEMU_PREFIX="${WORKSPACE}/hosttools/qemu"
1160+
1161+
mkdir -p ${QEMU_BUILD}
1162+
pushd ${QEMU_BUILD}
1163+
${GITHUB_WORKSPACE}/scripts/build_qemu.sh \
1164+
${{ matrix.host.name }} \
1165+
${GITHUB_WORKSPACE}/qemu \
1166+
${QEMU_PREFIX}
1167+
popd
1168+
1169+
# TODO: Build ARC QEMU
1170+
# TODO: Build Xilinx QEMU
1171+
# TODO: Build OpenOCD
1172+
1173+
# Create archive
1174+
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1175+
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.xz
1176+
1177+
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1178+
XZ_OPT="-T0" \
1179+
${TAR} -Jcvf ${ARCHIVE_FILE} \
1180+
--owner=0 --group=0 -C ${WORKSPACE} hosttools
1181+
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1182+
pushd ${WORKSPACE}
1183+
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} hosttools
1184+
popd
1185+
fi
1186+
1187+
# Compute checksum
1188+
md5sum ${ARCHIVE_FILE} > md5.sum
1189+
sha256sum ${ARCHIVE_FILE} > sha256.sum
1190+
11181191
- name: Setup debug session
11191192
if: always() && needs.setup.outputs.debug == 'hosttools'
11201193
uses: mxschmitt/action-tmate@v3
@@ -1132,7 +1205,6 @@ jobs:
11321205
popd
11331206
11341207
- name: Upload toolchain build artifact
1135-
if: startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11361208
uses: actions/upload-artifact@v4
11371209
with:
11381210
name: hosttools_${{ matrix.host.name }}
@@ -1141,9 +1213,6 @@ jobs:
11411213
md5.sum
11421214
sha256.sum
11431215
1144-
# TODO: Add host tool build process for macOS hosts.
1145-
# TODO: Add host tool build process for Windows hosts.
1146-
11471216
# Build CMake package
11481217
build-cmake-pkg:
11491218
name: CMake Package (${{ matrix.host.name }})

0 commit comments

Comments
 (0)