Skip to content

Commit 0e9da9c

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 4685972 commit 0e9da9c

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
@@ -1022,14 +1022,46 @@ 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+
gpg --keyserver keyserver.ubuntu.com --recv-keys E08C21D5677450AD
1040+
gpg --export --armor E08C21D5677450AD | apt-key add -
1041+
echo "deb https://qemu.weilnetz.de/debian/ testing contrib" > /etc/apt/sources.list.d/cygwin.list
1042+
apt-get update
1043+
1044+
apt-get install -y \
1045+
mingw64-x86-64-glib2.0 \
1046+
mingw64-x86-64-pixman
1047+
fi
1048+
10251049
# Set environment variables
10261050
echo "TAR=tar" >> $GITHUB_ENV
1051+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10271052
10281053
- name: Set up build environment (macOS)
10291054
if: ${{ runner.os == 'macOS' }}
10301055
run: |
1056+
# Create case-sensitive workspace volume for macOS
1057+
WORKSPACE="/Volumes/Workspace"
1058+
hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1059+
-volname Workspace -type SPARSE -size 150g -fs HFSX
1060+
hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1061+
10311062
# Set environment variables
10321063
echo "TAR=gtar" >> $GITHUB_ENV
1064+
echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10331065
10341066
- name: Check out source code
10351067
if: ${{ github.event_name != 'pull_request_target' }}
@@ -1078,7 +1110,7 @@ jobs:
10781110
echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10791111
echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10801112
1081-
- name: Build Linux host tools
1113+
- name: Build host tools (Linux)
10821114
if: startsWith(matrix.host.name, 'linux-')
10831115
run: |
10841116
POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1111,6 +1143,47 @@ jobs:
11111143
md5sum ${ARCHIVE_FILE} > md5.sum
11121144
sha256sum ${ARCHIVE_FILE} > sha256.sum
11131145
1146+
- name: Build host tools (non-Linux)
1147+
if: "!startsWith(matrix.host.name, 'linux-')"
1148+
run: |
1149+
# Create output directory
1150+
mkdir -p ${WORKSPACE}/hosttools
1151+
1152+
# Build QEMU
1153+
QEMU_BUILD="${WORKSPACE}/build/qemu"
1154+
QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1155+
QEMU_PREFIX="${WORKSPACE}/hosttools/qemu"
1156+
1157+
mkdir -p ${QEMU_BUILD}
1158+
pushd ${QEMU_BUILD}
1159+
${GITHUB_WORKSPACE}/scripts/build_qemu.sh \
1160+
${{ matrix.host.name }} \
1161+
${GITHUB_WORKSPACE}/qemu \
1162+
${QEMU_PREFIX}
1163+
popd
1164+
1165+
# TODO: Build ARC QEMU
1166+
# TODO: Build Xilinx QEMU
1167+
# TODO: Build OpenOCD
1168+
1169+
# Create archive
1170+
ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1171+
ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.tar.xz
1172+
1173+
if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1174+
XZ_OPT="-T0" \
1175+
${TAR} -Jcvf ${ARCHIVE_FILE} \
1176+
--owner=0 --group=0 -C ${WORKSPACE} hosttools
1177+
elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1178+
pushd ${WORKSPACE}
1179+
7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} hosttools
1180+
popd
1181+
fi
1182+
1183+
# Compute checksum
1184+
md5sum ${ARCHIVE_FILE} > md5.sum
1185+
sha256sum ${ARCHIVE_FILE} > sha256.sum
1186+
11141187
- name: Setup debug session
11151188
if: always() && needs.setup.outputs.debug == 'hosttools'
11161189
uses: mxschmitt/action-tmate@v3
@@ -1128,7 +1201,6 @@ jobs:
11281201
popd
11291202
11301203
- name: Upload toolchain build artifact
1131-
if: startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11321204
uses: actions/upload-artifact@v4
11331205
with:
11341206
name: hosttools_${{ matrix.host.name }}
@@ -1137,9 +1209,6 @@ jobs:
11371209
md5.sum
11381210
sha256.sum
11391211
1140-
# TODO: Add host tool build process for macOS hosts.
1141-
# TODO: Add host tool build process for Windows hosts.
1142-
11431212
# Build CMake package
11441213
build-cmake-pkg:
11451214
name: CMake Package (${{ matrix.host.name }})

0 commit comments

Comments
 (0)