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

masayuki pushed a commit to branch releases/10.0
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d750dbfda7c61ea0c799e39adfbde7657c558d10
Author: Brennan Ashton <[email protected]>
AuthorDate: Sun Oct 25 21:18:43 2020 -0700

    CI: Store artifacts durring build
    
    Add new option -A is added to tools/testbuild.sh that will take the
    created build executable and store it in a folder for the config
    that generated it under $ARTIFACTDIR which can be set via an
    environment variable or defaulted to $(TOPDIR)/buildartifacts
    
    This is also helpful for local testing because you can now run
    tools/testbuild.sh -A sim.dat and have all of the simulation
    targets generated without having to rebuild along the way.
    
    In the GitHub Actions workflow the artifacs are uploaded
    two two bundles one for macOS and one for Linux
    
    Signed-off-by: Brennan Ashton <[email protected]>
---
 .github/workflows/build.yml                      | 14 ++++++++++++--
 boards/xtensa/esp32/esp32-core/scripts/Config.mk |  1 +
 tools/Makefile.unix                              |  6 ++++++
 tools/Makefile.win                               |  5 +++++
 tools/cxd56/Config.mk                            |  2 +-
 tools/testbuild.sh                               | 15 ++++++++++++++-
 6 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9fa7f75..1760ec0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -161,8 +161,13 @@ jobs:
             export CCACHE_DIR=`pwd`/ccache
             mkdir $CCACHE_DIR
             cd sources/testing
-            ./cibuild.sh -c testlist/${{matrix.boards}}.dat
+            export ARTIFACTDIR=`pwd`/../../buildartifacts
+            ./cibuild.sh -A -c testlist/${{matrix.boards}}.dat
             ccache -s
+      - uses: actions/upload-artifact@v2
+        with:
+          name: linux-builds
+          path: buildartifacts/
 
   macOS:
     runs-on: macos-10.15
@@ -195,5 +200,10 @@ jobs:
           export CCACHE_DIR=`pwd`/ccache
           mkdir $CCACHE_DIR
           cd sources/testing
-          ./cibuild.sh -i -c testlist/${{matrix.boards}}.dat
+          export ARTIFACTDIR=`pwd`/../../buildartifacts
+          ./cibuild.sh -i -A -c testlist/${{matrix.boards}}.dat
           ccache -s
+      - uses: actions/upload-artifact@v2
+        with:
+          name: macos-builds
+          path: buildartifacts/
diff --git a/boards/xtensa/esp32/esp32-core/scripts/Config.mk 
b/boards/xtensa/esp32/esp32-core/scripts/Config.mk
index 0bedc52..a05af94 100644
--- a/boards/xtensa/esp32/esp32-core/scripts/Config.mk
+++ b/boards/xtensa/esp32/esp32-core/scripts/Config.mk
@@ -56,6 +56,7 @@ define POSTBUILD
                dd if=$(PARTITION_TABLE) bs=1 seek=$(shell printf "%d" 0x8000) 
of=flash_image.bin conv=notrunc && \
                dd if=$(NUTTXNAME).bin bs=1 seek=$(shell printf "%d" 0x10000) 
of=flash_image.bin conv=notrunc && \
                echo "Generated: flash_image.bin (it can be run with 
'qemu-system-xtensa -nographic -machine esp32 -drive 
file=flash_image.bin,if=mtd,format=raw')"; \
+               echo "flash_image.bin" >> $(NUTTXNAME).manifest; \
        fi
 endef
 endif
diff --git a/tools/Makefile.unix b/tools/Makefile.unix
index cdde943..1d2bb15 100644
--- a/tools/Makefile.unix
+++ b/tools/Makefile.unix
@@ -416,17 +416,22 @@ endif
        $(Q) if [ -w /tftpboot ] ; then \
                cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
        fi
+       echo $(BIN) > $(NUTTXNAME).manifest
+       printf "%s\n" *.map >> $(NUTTXNAME).manifest
 ifeq ($(CONFIG_INTELHEX_BINARY),y)
        @echo "CP: $(NUTTXNAME).hex"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) $(NUTTXNAME).hex
+       echo $(NUTTXNAME).hex >> $(NUTTXNAME).manifest
 endif
 ifeq ($(CONFIG_MOTOROLA_SREC),y)
        @echo "CP: $(NUTTXNAME).srec"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) $(NUTTXNAME).srec
+       echo $(NUTTXNAME).srec >> $(NUTTXNAME).manifest
 endif
 ifeq ($(CONFIG_RAW_BINARY),y)
        @echo "CP: $(NUTTXNAME).bin"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(NUTTXNAME).bin
+       echo $(NUTTXNAME).bin >> $(NUTTXNAME).manifest
 endif
 ifeq ($(CONFIG_UBOOT_UIMAGE),y)
        @echo "MKIMAGE: uImage"
@@ -435,6 +440,7 @@ ifeq ($(CONFIG_UBOOT_UIMAGE),y)
        $(Q) if [ -w /tftpboot ] ; then \
                cp -f uImage /tftpboot/uImage; \
        fi
+       echo "uImage" >> $(NUTTXNAME).manifest
 endif
        $(call POSTBUILD, $(TOPDIR))
 
diff --git a/tools/Makefile.win b/tools/Makefile.win
index df9d909..932e2c0 100644
--- a/tools/Makefile.win
+++ b/tools/Makefile.win
@@ -384,17 +384,22 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
        $(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) LINKLIBS="$(LINKLIBS)" 
USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
 endif
        $(Q) $(MAKE) -C $(ARCH_SRC) EXTRA_OBJS="$(EXTRA_OBJS)" 
LINKLIBS="$(LINKLIBS)" EXTRAFLAGS="$(KDEFINE) $(EXTRAFLAGS)" $(BIN)
+       echo $(BIN) > $(NUTTXNAME).manifest
+       printf '%s\n' *.map >> $(NUTTXNAME).manifest
 ifeq ($(CONFIG_INTELHEX_BINARY),y)
        @echo "CP: $(NUTTXNAME).hex"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) $(NUTTXNAME).hex
+       echo $(NUTTXNAME).hex >> $(NUTTXNAME).manifest
 endif
 ifeq ($(CONFIG_MOTOROLA_SREC),y)
        @echo "CP: $(NUTTXNAME).srec"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) $(NUTTXNAME).srec
+       echo $(NUTTXNAME).srec >> $(NUTTXNAME).manifest
 endif
 ifeq ($(CONFIG_RAW_BINARY),y)
        @echo "CP: $(NUTTXNAME).bin"
        $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(NUTTXNAME).bin
+       echo $(NUTTXNAME).bin >> $(NUTTXNAME).manifest
 endif
        $(call POSTBUILD, $(TOPDIR))
 
diff --git a/tools/cxd56/Config.mk b/tools/cxd56/Config.mk
index a6456a8..570a4fe 100644
--- a/tools/cxd56/Config.mk
+++ b/tools/cxd56/Config.mk
@@ -32,7 +32,7 @@ define POSTBUILD
 
        +$(Q) $(MAKE) -C $(TOPDIR)$(DELIM)tools$(DELIM)cxd56 -f Makefile.host
        tools$(DELIM)cxd56$(DELIM)mkspk$(HOSTEXEEXT) -c2 nuttx nuttx nuttx.spk;
-       $(Q)([ $$? -eq 0 ] && echo "Done.")
+       $(Q)([ $$? -eq 0 ] && echo nuttx.spk >> $(NUTTXNAME).manifest && echo 
"Done.")
 endef
 
 endif
diff --git a/tools/testbuild.sh b/tools/testbuild.sh
index b974e98..9876111 100755
--- a/tools/testbuild.sh
+++ b/tools/testbuild.sh
@@ -38,6 +38,9 @@ nuttx=$WD/../nuttx
 progname=$0
 fail=0
 APPSDIR=$WD/../apps
+if [ -z $ARTIFACTDIR ]; then
+  ARTIFACTDIR=$WD/../buildartifacts
+fi
 MAKE_FLAGS=-k
 EXTRA_FLAGS="EXTRAFLAGS="
 MAKE=make
@@ -46,6 +49,7 @@ unset HOPTION
 unset JOPTION
 PRINTLISTONLY=0
 GITCLEAN=0
+SAVEARTIFACTS=0
 
 case $(uname -s) in
   Darwin*)
@@ -77,8 +81,9 @@ function showusage {
   echo "  -x exit on build failures"
   echo "  -j <ncpus> passed on to make.  Default:  No -j make option."
   echo "  -a <appsdir> provides the relative path to the apps/ directory.  
Default ../apps"
-  echo "  -t <topdir> provides the absolute path to top nuttx/ directory.  
Default $PWD/../nuttx"
+  echo "  -t <topdir> provides the absolute path to top nuttx/ directory.  
Default ../nuttx"
   echo "  -p only print the list of configs without running any builds"
+  echo "  -A store the build executable artifact in ARTIFACTDIR (defaults to 
../buildartifacts"
   echo "  -G Use \"git clean -xfdq\" instead of \"make distclean\" to clean 
the tree."
   echo "     This option may speed up the builds. However, note that:"
   echo "       * This assumes that your trees are git based."
@@ -130,6 +135,9 @@ while [ ! -z "$1" ]; do
   -G )
     GITCLEAN=1
     ;;
+  -A )
+    SAVEARTIFACTS=1
+    ;;
   -h )
     showusage
     ;;
@@ -247,6 +255,11 @@ function configure {
 function build {
   echo "  Building NuttX..."
   makefunc
+  if [ ${SAVEARTIFACTS} -eq 1 ]; then
+    artifactconfigdir=$ARTIFACTDIR/$(echo $config | sed "s/:/\//")/
+    mkdir -p $artifactconfigdir
+    xargs -a $nuttx/nuttx.manifest cp -t $artifactconfigdir
+  fi
 
   # Ensure defconfig in the canonical form
 

Reply via email to