Skip to content

Commit 48ef2e9

Browse files
yamtxiaoxiang781216
authored andcommitted
Add macOS builds
Blacklist some configs in a few test lists as they don't work on macOS. (See the comments in the test lists why.) They are still covered by the nightly builds.
1 parent bf7e19b commit 48ef2e9

File tree

4 files changed

+158
-16
lines changed

4 files changed

+158
-16
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
pull_request:
1717

1818
jobs:
19-
build:
19+
build-linux:
2020
runs-on: ubuntu-18.04
2121
env:
2222
DOCKER_BUILDKIT: 1
@@ -65,3 +65,50 @@ jobs:
6565
run: |
6666
cd testing
6767
./cibuild.sh -x -G testlist/${{matrix.boards}}.dat
68+
69+
build-macos:
70+
runs-on: macos-10.15
71+
72+
strategy:
73+
matrix:
74+
boards: [arm-01, arm-02, arm-03, arm-04, arm-05, arm-06, arm-07, arm-08, arm-09, arm-10, arm-11, arm-12, arm-13, mips-riscv-x86-xtensa, sim]
75+
76+
steps:
77+
- name: Checkout nuttx repo
78+
uses: actions/checkout@v2
79+
with:
80+
repository: apache/incubator-nuttx
81+
path: nuttx
82+
fetch-depth: 0
83+
84+
- name: Fetch nuttx tags
85+
run: |
86+
cd nuttx
87+
git fetch --tags
88+
89+
- name: Checkout apps repo
90+
uses: actions/checkout@v2
91+
with:
92+
repository: apache/incubator-nuttx-apps
93+
path: apps
94+
fetch-depth: 0
95+
96+
- name: Checkout testing repo
97+
uses: actions/checkout@v2
98+
with:
99+
repository: apache/incubator-nuttx-testing
100+
path: testing
101+
102+
- name: Restore cache
103+
id: cache-tools
104+
uses: actions/cache@v1
105+
env:
106+
cache-name: ${{ runner.os }}-cache-tools
107+
with:
108+
path: prebuilt
109+
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
110+
111+
- name: Run builds
112+
run: |
113+
cd testing
114+
./cibuild.sh -i -x -G testlist/${{matrix.boards}}.dat

cibuild.sh

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@ nuttx=$WD/../nuttx
2323
apps=$WD/../apps
2424
tools=$WD/../tools
2525
prebuilt=$WD/../prebuilt
26+
os=$(uname -s)
2627

27-
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain c-cache"
28+
case $os in
29+
Darwin)
30+
install="python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain"
31+
mkdir -p ${prebuilt}/homebrew
32+
export HOMEBREW_CACHE=${prebuilt}/homebrew
33+
;;
34+
Linux)
35+
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain c-cache"
36+
;;
37+
esac
2838

2939
function add_path {
3040
PATH=$1:$PATH
@@ -37,6 +47,38 @@ function python-tools {
3747
add_path $PYTHONUSERBASE/bin
3848
}
3949

50+
function u-boot-tools {
51+
if ! type mkimage > /dev/null; then
52+
case $os in
53+
Darwin)
54+
brew install u-boot-tools
55+
;;
56+
esac
57+
fi
58+
}
59+
60+
function discoteq-flock {
61+
if ! type flock > /dev/null; then
62+
case $os in
63+
Darwin)
64+
brew tap discoteq/discoteq
65+
brew install flock
66+
;;
67+
esac
68+
fi
69+
}
70+
71+
function elf-toolchain {
72+
if ! type x86_64-elf-gcc > /dev/null; then
73+
case $os in
74+
Darwin)
75+
brew install x86_64-elf-gcc
76+
;;
77+
esac
78+
fi
79+
x86_64-elf-gcc --version
80+
}
81+
4082
function gen-romfs {
4183
add_path $prebuilt/genromfs/usr/bin
4284

@@ -87,11 +129,20 @@ function arm-gcc-toolchain {
87129
add_path $prebuilt/gcc-arm-none-eabi/bin
88130

89131
if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
132+
local flavor
133+
case $os in
134+
Darwin)
135+
flavor=mac
136+
;;
137+
Linux)
138+
flavor=x86_64-linux
139+
;;
140+
esac
90141
cd $prebuilt
91-
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
92-
tar jxf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
142+
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
143+
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
93144
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
94-
rm gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
145+
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
95146
fi
96147
arm-none-eabi-gcc --version
97148
}
@@ -110,11 +161,20 @@ function riscv-gcc-toolchain {
110161
add_path $prebuilt/riscv64-unknown-elf-gcc/bin
111162

112163
if [ ! -f "$prebuilt/riscv64-unknown-elf-gcc/bin/riscv64-unknown-elf-gcc" ]; then
164+
local flavor
165+
case $os in
166+
Darwin)
167+
flavor=x86_64-apple-darwin
168+
;;
169+
Linux)
170+
flavor=x86_64-linux-ubuntu14
171+
;;
172+
esac
113173
cd $prebuilt
114-
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
115-
tar zxf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
116-
mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14 riscv64-unknown-elf-gcc
117-
rm riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
174+
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
175+
tar zxf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
176+
mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor} riscv64-unknown-elf-gcc
177+
rm riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
118178
fi
119179
riscv64-unknown-elf-gcc --version
120180
}
@@ -124,10 +184,19 @@ function xtensa-esp32-gcc-toolchain {
124184

125185
if [ ! -f "$prebuilt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" ]; then
126186
cd $prebuilt
127-
wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
128-
xz -d xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
129-
tar xf xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
130-
rm xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
187+
case $os in
188+
Darwin)
189+
wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
190+
tar xzf xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
191+
rm xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
192+
;;
193+
Linux)
194+
wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
195+
xz -d xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
196+
tar xf xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
197+
rm xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
198+
;;
199+
esac
131200
fi
132201
xtensa-esp32-elf-gcc --version
133202
pip install esptool
@@ -206,7 +275,17 @@ function install_tools {
206275
}
207276

208277
function run_builds {
209-
local ncpus=`grep -c ^processor /proc/cpuinfo`
278+
local ncpus
279+
280+
case $os in
281+
Darwin)
282+
ncpus=$(sysctl -n machdep.cpu.thread_count)
283+
;;
284+
Linux)
285+
ncpus=`grep -c ^processor /proc/cpuinfo`
286+
;;
287+
esac
288+
210289
options+="-j $ncpus"
211290

212291
for build in $builds; do

testlist/mips-riscv-x86-xtensa.dat

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
/mips,CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
1+
# PINGUINOL toolchain doesn't provide macOS binaries
2+
# with the same name
3+
# /mips,CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
24

35
/risc-v,CONFIG_RV32IM_TOOLCHAIN_GNU_RVGL
46
-gapuino:nsh
57
-nr5m100-nexys4:nsh
68

7-
/x86
9+
# x86_64-elf-gcc from homebrew doesn't seem to
10+
# provide __udivdi3 etc for -m32
11+
# /x86
812

913
/xtensa

testlist/sim.dat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
33
-sim:nxwm
44
-sim:rpproxy
55
-sim:rpserver
6+
7+
# X11
8+
# macOS doesn't have X11
9+
-sim:nxlines
10+
-sim:touchscreen
11+
-sim:nx11
12+
-sim:nsh2
13+
14+
# CONFIG_SIM_M32=y
15+
# The recent versions of macOS is 64-bit only
16+
-sim:loadable
17+
-sim:module32

0 commit comments

Comments
 (0)