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 2024/01/09 13:50:15 UTC

(nuttx) branch master updated: tools/ci: add initial support for MSYS2

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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new eaf1d07809 tools/ci: add initial support for MSYS2
eaf1d07809 is described below

commit eaf1d078092b1b01a11d2af931f53c7a01da3b75
Author: simbit18 <10...@users.noreply.github.com>
AuthorDate: Mon Jan 8 18:15:00 2024 +0100

    tools/ci: add initial support for MSYS2
    
    removed uname from msys2 job
---
 .github/workflows/build.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++
 tools/ci/cibuild.sh         | 44 +++++++++++++++++++++++------
 tools/ci/testlist/msys2.dat |  8 ++++++
 3 files changed, 111 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2ce3afa911..83d5b916ca 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -219,3 +219,71 @@ jobs:
           name: macos-builds
           path: buildartifacts/
         continue-on-error: true
+
+  msys2:
+    needs: Fetch-Source
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        boards: [msys2]
+
+    defaults:
+      run:
+        shell: msys2 {0}
+    steps:
+      - uses: actions/checkout@v4
+      - uses: msys2/setup-msys2@v2
+        with:
+          msystem: MSYS
+          update: false
+          install: >-
+            base-devel
+            gcc
+            gperf
+            automake
+            autoconf
+            git
+            python3
+            ncurses-devel
+            unzip
+            zip
+            tio
+            zlib-devel
+            cmake
+            ninja
+            python-pip 
+            vim
+
+      - name: pip3 install
+        run: |
+          pip3 install --root-user-action=ignore --no-cache-dir pyelftools cxxfilt kconfiglib
+
+      - run: git config --global core.autocrlf false
+
+      - name: Download Source Artifact
+        uses: actions/download-artifact@v3
+        with:
+          name: source-bundle
+          path: .
+
+      - name: Extract sources
+        run: tar zxf sources.tar.gz
+
+      - name: Export NuttX Repo SHA
+        run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
+
+      - name: Run Builds
+        run: |
+          echo "::add-matcher::sources/nuttx/.github/gcc.json"
+          export ARTIFACTDIR=`pwd`/buildartifacts
+          git config --global --add safe.directory /github/workspace/sources/nuttx
+          git config --global --add safe.directory /github/workspace/sources/apps
+          cd sources/nuttx/tools/ci
+          ./cibuild.sh -g -i -A -C -R testlist/${{matrix.boards}}.dat
+
+      - uses: actions/upload-artifact@v3
+        with:
+          name: msys2-builds
+          path: buildartifacts/
+        continue-on-error: true
diff --git a/tools/ci/cibuild.sh b/tools/ci/cibuild.sh
index c2120f6dcb..20c2858e09 100755
--- a/tools/ci/cibuild.sh
+++ b/tools/ci/cibuild.sh
@@ -64,21 +64,35 @@ function arm-gcc-toolchain {
   add_path "${tools}"/gcc-arm-none-eabi/bin
 
   if [ ! -f "${tools}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
-    local flavor
+    local archivetool
+    local basefile
     case ${os} in
       Darwin)
-        flavor=-darwin
+        archivetool=tar
+        basefile=arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi
         ;;
       Linux)
-        flavor=
+       archivetool=tar
+        basefile=arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi
+        ;;
+      MSYS*)
+        archivetool=unzip
+        basefile=arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi
         ;;
     esac
     cd "${tools}"
-    wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar.xz
-    xz -d arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar.xz
-    tar xf arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar
-    mv arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi gcc-arm-none-eabi
-    rm arm-gnu-toolchain-13.2.Rel1${flavor}-x86_64-arm-none-eabi.tar
+    if [ "$archivetool" == "tar" ]; then
+      wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz
+      xz -d ${basefile}.tar.xz
+      tar xf ${basefile}.tar
+      mv ${basefile} gcc-arm-none-eabi
+      rm ${basefile}.tar
+    else
+      wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.zip
+      unzip -qo ${basefile}.zip
+      mv ${basefile} gcc-arm-none-eabi
+      rm ${basefile}.zip
+    fi
   fi
 
   command arm-none-eabi-gcc --version
@@ -177,6 +191,10 @@ function c-cache {
         cd ccache-3.7.7; ./configure --prefix="${tools}"/ccache; make; make install
         cd "${tools}"; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz
         ;;
+      MSYS*)
+        pacman -S --noconfirm --needed ccache
+        pacman -Q
+        ;;
     esac
   fi
 
@@ -590,6 +608,9 @@ case ${os} in
   Linux)
     install="arm-clang-toolchain arm-gcc-toolchain arm64-gcc-toolchain avr-gcc-toolchain binutils bloaty clang-tidy gen-romfs gperf kconfig-frontends mips-gcc-toolchain python-tools riscv-gcc-toolchain rust rx-gcc-toolchain sparc-gcc-toolchain xtensa-esp32-gcc-toolchain u-boot-tools util-linux wasi-sdk c-cache"
     ;;
+  MSYS*)
+    install="arm-gcc-toolchain kconfig-frontends"
+    ;;
 esac
 
   pushd .
@@ -598,7 +619,9 @@ esac
   done
   popd
 
-  setup_links
+  if [ -d "${CCACHE_DIR}" ]; then
+    setup_links
+  fi
   echo PATH="${EXTRA_PATH}"/"${PATH}" > "${tools}"/env.sh
 }
 
@@ -612,6 +635,9 @@ function run_builds {
     Linux)
       ncpus=$(grep -c ^processor /proc/cpuinfo)
       ;;
+    MSYS*)
+      ncpus=$(grep -c ^processor /proc/cpuinfo)
+      ;;
   esac
 
   options+="-j ${ncpus}"
diff --git a/tools/ci/testlist/msys2.dat b/tools/ci/testlist/msys2.dat
new file mode 100644
index 0000000000..c027fbd6ea
--- /dev/null
+++ b/tools/ci/testlist/msys2.dat
@@ -0,0 +1,8 @@
+# Chose a minimalistic subset of board/configs due to MSYS2 builds
+# being extremely slow on GitHub
+
+# ARM
+
+/arm/stm32/nucleo-l152re/configs/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
+
+/arm/stm32/nucleo-f4x1re/configs/f411-nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI