You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/04/09 05:20:57 UTC

[incubator-nuttx-testing] 03/04: Add macOS builds

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-testing.git

commit 48ef2e9b562678348efb5ff944f2f8354e19b754
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Mon Mar 30 14:20:42 2020 +0900

    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.
---
 .github/workflows/build.yml        |  49 ++++++++++++++++-
 cibuild.sh                         | 105 ++++++++++++++++++++++++++++++++-----
 testlist/mips-riscv-x86-xtensa.dat |   8 ++-
 testlist/sim.dat                   |  12 +++++
 4 files changed, 158 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cf37b70..63522f7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -16,7 +16,7 @@ on:
   pull_request:
 
 jobs:
-  build:
+  build-linux:
     runs-on: ubuntu-18.04
     env:
       DOCKER_BUILDKIT: 1
@@ -65,3 +65,50 @@ jobs:
         run: |
           cd testing
           ./cibuild.sh -x -G testlist/${{matrix.boards}}.dat
+
+  build-macos:
+    runs-on: macos-10.15
+
+    strategy:
+      matrix:
+        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]
+
+    steps:
+    - name: Checkout nuttx repo
+      uses: actions/checkout@v2
+      with:
+        repository: apache/incubator-nuttx
+        path: nuttx
+        fetch-depth: 0
+
+    - name: Fetch nuttx tags
+      run: |
+        cd nuttx
+        git fetch --tags
+
+    - name: Checkout apps repo
+      uses: actions/checkout@v2
+      with:
+        repository: apache/incubator-nuttx-apps
+        path: apps
+        fetch-depth: 0
+
+    - name: Checkout testing repo
+      uses: actions/checkout@v2
+      with:
+        repository: apache/incubator-nuttx-testing
+        path: testing
+
+    - name: Restore cache
+      id: cache-tools
+      uses: actions/cache@v1
+      env:
+        cache-name: ${{ runner.os }}-cache-tools
+      with:
+        path: prebuilt
+        key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
+
+    - name: Run builds
+      run: |
+        cd testing
+        ./cibuild.sh -i -x -G testlist/${{matrix.boards}}.dat
diff --git a/cibuild.sh b/cibuild.sh
index c3f678f..8f9f0f4 100755
--- a/cibuild.sh
+++ b/cibuild.sh
@@ -23,8 +23,18 @@ nuttx=$WD/../nuttx
 apps=$WD/../apps
 tools=$WD/../tools
 prebuilt=$WD/../prebuilt
+os=$(uname -s)
 
-install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain c-cache"
+case $os in
+  Darwin)
+    install="python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain"
+    mkdir -p ${prebuilt}/homebrew
+    export HOMEBREW_CACHE=${prebuilt}/homebrew
+    ;;
+  Linux)
+    install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain c-cache"
+    ;;
+esac
 
 function add_path {
   PATH=$1:$PATH
@@ -37,6 +47,38 @@ function python-tools {
   add_path $PYTHONUSERBASE/bin
 }
 
+function u-boot-tools {
+  if ! type mkimage > /dev/null; then
+    case $os in
+      Darwin)
+        brew install u-boot-tools
+        ;;
+    esac
+  fi
+}
+
+function discoteq-flock {
+  if ! type flock > /dev/null; then
+    case $os in
+      Darwin)
+        brew tap discoteq/discoteq
+        brew install flock
+        ;;
+    esac
+  fi
+}
+
+function elf-toolchain {
+  if ! type x86_64-elf-gcc > /dev/null; then
+    case $os in
+      Darwin)
+        brew install x86_64-elf-gcc
+        ;;
+    esac
+  fi
+  x86_64-elf-gcc --version
+}
+
 function gen-romfs {
   add_path $prebuilt/genromfs/usr/bin
 
@@ -87,11 +129,20 @@ function arm-gcc-toolchain {
   add_path $prebuilt/gcc-arm-none-eabi/bin
 
   if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
+    local flavor
+    case $os in
+      Darwin)
+        flavor=mac
+        ;;
+      Linux)
+        flavor=x86_64-linux
+        ;;
+    esac
     cd $prebuilt
-    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
-    tar jxf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
+    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
+    tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
     mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
-    rm gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
+    rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
   fi
   arm-none-eabi-gcc --version
 }
@@ -110,11 +161,20 @@ function riscv-gcc-toolchain {
   add_path $prebuilt/riscv64-unknown-elf-gcc/bin
 
   if [ ! -f "$prebuilt/riscv64-unknown-elf-gcc/bin/riscv64-unknown-elf-gcc" ]; then
+    local flavor
+    case $os in
+      Darwin)
+        flavor=x86_64-apple-darwin
+        ;;
+      Linux)
+        flavor=x86_64-linux-ubuntu14
+        ;;
+    esac
     cd $prebuilt
-    wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
-    tar zxf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
-    mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14 riscv64-unknown-elf-gcc
-    rm riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
+    wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
+    tar zxf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
+    mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor} riscv64-unknown-elf-gcc
+    rm riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
   fi
   riscv64-unknown-elf-gcc --version
 }
@@ -124,10 +184,19 @@ function xtensa-esp32-gcc-toolchain {
 
   if [ ! -f "$prebuilt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" ]; then
     cd $prebuilt
-    wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
-    xz -d xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
-    tar xf xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
-    rm xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
+    case $os in
+      Darwin)
+        wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
+        tar xzf xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
+        rm xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
+        ;;
+      Linux)
+        wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
+        xz -d xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
+        tar xf xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
+        rm xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
+        ;;
+    esac
   fi
   xtensa-esp32-elf-gcc --version
   pip install esptool
@@ -206,7 +275,17 @@ function install_tools {
 }
 
 function run_builds {
-  local ncpus=`grep -c ^processor /proc/cpuinfo`
+  local ncpus
+
+  case $os in
+    Darwin)
+      ncpus=$(sysctl -n machdep.cpu.thread_count)
+      ;;
+    Linux)
+      ncpus=`grep -c ^processor /proc/cpuinfo`
+      ;;
+  esac
+
   options+="-j $ncpus"
 
   for build in $builds; do
diff --git a/testlist/mips-riscv-x86-xtensa.dat b/testlist/mips-riscv-x86-xtensa.dat
index 5bf4ba0..6add50e 100644
--- a/testlist/mips-riscv-x86-xtensa.dat
+++ b/testlist/mips-riscv-x86-xtensa.dat
@@ -1,9 +1,13 @@
-/mips,CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
+# PINGUINOL toolchain doesn't provide macOS binaries
+# with the same name
+# /mips,CONFIG_MIPS32_TOOLCHAIN_PINGUINOL
 
 /risc-v,CONFIG_RV32IM_TOOLCHAIN_GNU_RVGL
 -gapuino:nsh
 -nr5m100-nexys4:nsh
 
-/x86
+# x86_64-elf-gcc from homebrew doesn't seem to
+# provide __udivdi3 etc for -m32
+# /x86
 
 /xtensa
diff --git a/testlist/sim.dat b/testlist/sim.dat
index 17bb150..ce45887 100644
--- a/testlist/sim.dat
+++ b/testlist/sim.dat
@@ -3,3 +3,15 @@
 -sim:nxwm
 -sim:rpproxy
 -sim:rpserver
+
+# X11
+# macOS doesn't have X11
+-sim:nxlines
+-sim:touchscreen
+-sim:nx11
+-sim:nsh2
+
+# CONFIG_SIM_M32=y
+# The recent versions of macOS is 64-bit only
+-sim:loadable
+-sim:module32