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


The following commit(s) were added to refs/heads/master by this push:
     new 162da11  CI: Store artifacts durring build
162da11 is described below

commit 162da1169ec6c44b5382a036a11cd5a330d653b3
Author: Brennan Ashton <bash...@brennanashton.com>
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 <bash...@brennanashton.com>
---
 .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 1968eb7..56f2d41 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 d7b94db..e558803 100644
--- a/tools/Makefile.unix
+++ b/tools/Makefile.unix
@@ -424,17 +424,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"
@@ -443,6 +448,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 6b95f2a..86e2b26 100644
--- a/tools/Makefile.win
+++ b/tools/Makefile.win
@@ -392,17 +392,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