mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Restructured .travis.yml to span more jobs
The core of littlefs's CI testing is the full test suite, `make test`, run
under a number of configurations:
- Processor architecture:
  - x86 (native)
  - Arm Thumb
  - MIPS
  - PowerPC
- Storage geometry:
  - rs=16   ps=16   cs=64   bs=512   (default)
  - rs=1    ps=1    cs=64   bs=4KiB  (NOR flash)
  - rs=512  ps=512  cs=512  bs=512   (eMMC)
  - rs=4KiB ps=4KiB cs=4KiB bs=32KiB (NAND flash)
- Other corner cases:
  - no intrinsics
  - no inline
  - byte-level read/writes
  - single block-cycles
  - odd block counts
  - odd block sizes
The number of different configurations we need to test quickly exceeds the
50 minute time limit Travis has on jobs. Fortunately, we can split these
tests out into multiple jobs. This seems to be the intended course of
action for large CI "builds" in Travis, as this gives Travis a finer
grain of control over limiting builds.
Unfortunately, this created a couple issues:
1. The Travis configuration isn't actually that flexible. It allows a
   single "matrix expansion" which can be generated from top-level lists
   of different configurations. But it doesn't let you generate a matrix
   from two seperate environment variable lists (for arch + geometry).
   Without multiple matrix expansions, we're stuck writing out each test
   permutation by hand.
   On the bright-side, this was a good chance to really learn how YAML
   anchors work. I'm torn because on one hand anchors add what feels
   like unnecessary complexity to a config language, on the other hand,
   they did help quite a bit in working around Travis's limitations.
2. Now that we have 47 jobs instead of 7, reporting a separate status
   for each job stops making sense.
   What I've opted for here is to use a special NAME variable to
   deduplicate jobs, and used a few state-less rules to hopefully have
   the reported status make sense most of the time.
   - Overwrite "pending" statuses so that the last job to start owns the
     most recent "pending" status
   - Don't overwrite "failure" statuses unless the job number matches
     our own (in the case of CI restarts)
   - Don't write "success" statuses unless the job number matches our
     own, this should delay a green check-mark until the last-to-start
     job finishes
   - Always overwrite non-failures with "failure" statuses
   This does mean a temporary "success" may appear if the last job
   terminates before earlier jobs. But this is the simpliest solution
   I can think of without storing some complex state somewhere.
   Note we can only report the size this way because it's cheap to
   calculate in every job.
			
			
This commit is contained in:
		
							
								
								
									
										256
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										256
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,51 +1,64 @@ | |||||||
| # Environment variables | # environment variables | ||||||
| env: | env: | ||||||
|   global: |   global: | ||||||
|     - CFLAGS=-Werror |     - CFLAGS=-Werror | ||||||
|     - MAKEFLAGS=-j |     - MAKEFLAGS=-j | ||||||
|  |  | ||||||
| # Common test script | # common installation | ||||||
| script: | _: &install-common | ||||||
|  |   # need toml, also pip3 isn't installed by default? | ||||||
|  |   - sudo apt-get install python3-pip | ||||||
|  |   - sudo pip3 install toml | ||||||
|  |   # setup a ram-backed disk to speed up reentrant tests | ||||||
|  |   - mkdir disks | ||||||
|  |   - sudo mount -t tmpfs -o size=100m tmpfs disks | ||||||
|  |   - export TFLAGS="$TFLAGS --disk=disks/disk" | ||||||
|  |  | ||||||
|  | # test cases | ||||||
|  | _: &test-example | ||||||
|   # make sure example can at least compile |   # make sure example can at least compile | ||||||
|   - sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c && |   - sed -n '/``` c/,/```/{/```/d; p}' README.md > test.c && | ||||||
|     make all CFLAGS+=" |     make all CFLAGS+=" | ||||||
|         -Duser_provided_block_device_read=NULL |         -Duser_provided_block_device_read=NULL | ||||||
|         -Duser_provided_block_device_prog=NULL |         -Duser_provided_block_device_prog=NULL | ||||||
|         -Duser_provided_block_device_erase=NULL |         -Duser_provided_block_device_erase=NULL | ||||||
|         -Duser_provided_block_device_sync=NULL |         -Duser_provided_block_device_sync=NULL | ||||||
|         -include stdio.h" |         -include stdio.h" | ||||||
|  | # default tests | ||||||
|   # setup a ram-backed disk to speed up reentrant tests | _: &test-default | ||||||
|   - | |   # normal+reentrant tests | ||||||
|     mkdir disks |   - make test TFLAGS+="-nrk" | ||||||
|     sudo mount -t tmpfs -o size=100m tmpfs disks | # common real-life geometries | ||||||
|     export TFLAGS="$TFLAGS --disk=disks/disk" | _: &test-nor | ||||||
|  |  | ||||||
|   # run tests |  | ||||||
|   - make clean test TFLAGS+="-nrk" |  | ||||||
|  |  | ||||||
|   # common real-life geometries |  | ||||||
|   # NOR flash: read/prog = 1 block = 4KiB |   # NOR flash: read/prog = 1 block = 4KiB | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_READ_SIZE=1 -DLFS_BLOCK_SIZE=4096" |   - make test TFLAGS+="-nrk -DLFS_READ_SIZE=1 -DLFS_BLOCK_SIZE=4096" | ||||||
|   # SD card: read/prog = 512 block = 512 | _: &test-emmc | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_READ_SIZE=512 -DLFS_BLOCK_SIZE=512" |   # eMMC: read/prog = 512 block = 512 | ||||||
|  |   - make test TFLAGS+="-nrk -DLFS_READ_SIZE=512 -DLFS_BLOCK_SIZE=512" | ||||||
|  | _: &test-nand | ||||||
|   # NAND flash: read/prog = 4KiB block = 32KiB |   # NAND flash: read/prog = 4KiB block = 32KiB | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_READ_SIZE=4096 -DLFS_BLOCK_SIZE=\(32*1024\)" |   - make test TFLAGS+="-nrk -DLFS_READ_SIZE=4096 -DLFS_BLOCK_SIZE=\(32*1024\)" | ||||||
|  | # other extreme geometries that are useful for testing various corner cases | ||||||
|   # other extreme geometries for corner cases | _: &test-no-intrinsics | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_NO_INTRINSICS" |   - make test TFLAGS+="-nrk -DLFS_NO_INTRINSICS" | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_INLINE_MAX=0" | _: &test-no-inline | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_READ_SIZE=1 -DLFS_CACHE_SIZE=1" |   - make test TFLAGS+="-nrk -DLFS_INLINE_MAX=0" | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_BLOCK_CYCLES=1" | _: &test-byte-writes | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD_SIZE=256" |   - make test TFLAGS+="-nrk -DLFS_READ_SIZE=1 -DLFS_CACHE_SIZE=1" | ||||||
|   - make clean test TFLAGS+="-nrk -DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704" | _: &test-block-cycles | ||||||
|  |   - make test TFLAGS+="-nrk -DLFS_BLOCK_CYCLES=1" | ||||||
|  | _: &test-odd-block-count | ||||||
|  |   - make test TFLAGS+="-nrk -DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD_SIZE=256" | ||||||
|  | _: &test-odd-block-size | ||||||
|  |   - make test TFLAGS+="-nrk -DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704" | ||||||
|  |  | ||||||
|  | # report size  | ||||||
|  | _: &report-size | ||||||
|   # compile and find the code size with the smallest configuration |   # compile and find the code size with the smallest configuration | ||||||
|   - make clean size |   - make -j1 clean size | ||||||
|         OBJ="$(ls lfs*.c | sed 's/\.c/\.o/' | tr '\n' ' ')" |         OBJ="$(ls lfs*.c | sed 's/\.c/\.o/' | tr '\n' ' ')" | ||||||
|         CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR" |         CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR" | ||||||
|         | tee sizes |         | tee sizes | ||||||
|  |  | ||||||
|   # update status if we succeeded, compare with master if possible |   # update status if we succeeded, compare with master if possible | ||||||
|   - | |   - | | ||||||
|     if [ "$TRAVIS_TEST_RESULT" -eq 0 ] |     if [ "$TRAVIS_TEST_RESULT" -eq 0 ] | ||||||
| @@ -53,7 +66,7 @@ script: | |||||||
|         CURR=$(tail -n1 sizes | awk '{print $1}') |         CURR=$(tail -n1 sizes | awk '{print $1}') | ||||||
|         PREV=$(curl -u "$GEKY_BOT_STATUSES" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \ |         PREV=$(curl -u "$GEKY_BOT_STATUSES" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \ | ||||||
|             | jq -re "select(.sha != \"$TRAVIS_COMMIT\") |             | jq -re "select(.sha != \"$TRAVIS_COMMIT\") | ||||||
|                 | .statuses[] | select(.context == \"$STAGE/$NAME\").description |                 | .statuses[] | select(.context == \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\").description | ||||||
|                 | capture(\"code size is (?<size>[0-9]+)\").size" \ |                 | capture(\"code size is (?<size>[0-9]+)\").size" \ | ||||||
|             || echo 0) |             || echo 0) | ||||||
|    |    | ||||||
| @@ -64,82 +77,147 @@ script: | |||||||
|         fi |         fi | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
| # CI matrix | # stage control | ||||||
|  | stages: | ||||||
|  |   - name: test | ||||||
|  |   - name: deploy | ||||||
|  |     if: branch = master AND type = push | ||||||
|  |  | ||||||
|  | # job control | ||||||
| jobs: | jobs: | ||||||
|   include: |  | ||||||
|   # native testing |   # native testing | ||||||
|     - stage: test |   - &x86 | ||||||
|  |     stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-x86 |       - NAME=littlefs-x86 | ||||||
|  |     install: *install-common | ||||||
|  |     script: [*test-example, *report-size] | ||||||
|  |   - {<<: *x86, script: [*test-default,          *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-nor,              *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-emmc,             *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-nand,             *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-no-intrinsics,    *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-no-inline,        *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-byte-writes,      *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-block-cycles,     *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-odd-block-count,  *report-size]} | ||||||
|  |   - {<<: *x86, script: [*test-odd-block-size,   *report-size]} | ||||||
|  |  | ||||||
|   # cross-compile with ARM (thumb mode) |   # cross-compile with ARM (thumb mode) | ||||||
|     - stage: test |   - &arm | ||||||
|  |     stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-arm |       - NAME=littlefs-arm | ||||||
|       - CC="arm-linux-gnueabi-gcc --static -mthumb" |       - CC="arm-linux-gnueabi-gcc --static -mthumb" | ||||||
|         - TFLAGS="-e qemu-arm" |       - TFLAGS="$TFLAGS -e qemu-arm" | ||||||
|     install: |     install: | ||||||
|  |       - *install-common | ||||||
|       - sudo apt-get install |       - sudo apt-get install | ||||||
|             gcc-arm-linux-gnueabi |             gcc-arm-linux-gnueabi | ||||||
|             libc6-dev-armel-cross |             libc6-dev-armel-cross | ||||||
|             qemu-user |             qemu-user | ||||||
|       - arm-linux-gnueabi-gcc --version |       - arm-linux-gnueabi-gcc --version | ||||||
|       - qemu-arm -version |       - qemu-arm -version | ||||||
|  |     script: [*test-example, *report-size] | ||||||
|     # cross-compile with PowerPC |   - {<<: *arm, script: [*test-default,          *report-size]} | ||||||
|     - stage: test |   - {<<: *arm, script: [*test-nor,              *report-size]} | ||||||
|       env: |   - {<<: *arm, script: [*test-emmc,             *report-size]} | ||||||
|         - STAGE=test |   - {<<: *arm, script: [*test-nand,             *report-size]} | ||||||
|         - NAME=littlefs-powerpc |   - {<<: *arm, script: [*test-no-intrinsics,    *report-size]} | ||||||
|         - CC="powerpc-linux-gnu-gcc --static" |   - {<<: *arm, script: [*test-no-inline,        *report-size]} | ||||||
|         - TFLAGS="-e qemu-ppc" |   - {<<: *arm, script: [*test-byte-writes,      *report-size]} | ||||||
|       install: |   - {<<: *arm, script: [*test-block-cycles,     *report-size]} | ||||||
|         - sudo apt-get install |   - {<<: *arm, script: [*test-odd-block-count,  *report-size]} | ||||||
|               gcc-powerpc-linux-gnu |   - {<<: *arm, script: [*test-odd-block-size,   *report-size]} | ||||||
|               libc6-dev-powerpc-cross |  | ||||||
|               qemu-user |  | ||||||
|         - powerpc-linux-gnu-gcc --version |  | ||||||
|         - qemu-ppc -version |  | ||||||
|  |  | ||||||
|   # cross-compile with MIPS |   # cross-compile with MIPS | ||||||
|     - stage: test |   - &mips | ||||||
|  |     stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-mips |       - NAME=littlefs-mips | ||||||
|       - CC="mips-linux-gnu-gcc --static" |       - CC="mips-linux-gnu-gcc --static" | ||||||
|         - TFLAGS="-e qemu-mips" |       - TFLAGS="$TFLAGS -e qemu-mips" | ||||||
|     install: |     install: | ||||||
|  |       - *install-common | ||||||
|       - sudo apt-get install |       - sudo apt-get install | ||||||
|             gcc-mips-linux-gnu |             gcc-mips-linux-gnu | ||||||
|             libc6-dev-mips-cross |             libc6-dev-mips-cross | ||||||
|             qemu-user |             qemu-user | ||||||
|       - mips-linux-gnu-gcc --version |       - mips-linux-gnu-gcc --version | ||||||
|       - qemu-mips -version |       - qemu-mips -version | ||||||
|  |     script: [*test-example, *report-size] | ||||||
|  |   - {<<: *mips, script: [*test-default,          *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-nor,              *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-emmc,             *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-nand,             *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-no-intrinsics,    *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-no-inline,        *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-byte-writes,      *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-block-cycles,     *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-odd-block-count,  *report-size]} | ||||||
|  |   - {<<: *mips, script: [*test-odd-block-size,   *report-size]} | ||||||
|  |  | ||||||
|  |   # cross-compile with PowerPC | ||||||
|  |   - &powerpc | ||||||
|  |     stage: test | ||||||
|  |     env: | ||||||
|  |       - NAME=littlefs-powerpc | ||||||
|  |       - CC="powerpc-linux-gnu-gcc --static" | ||||||
|  |       - TFLAGS="$TFLAGS -e qemu-ppc" | ||||||
|  |     install: | ||||||
|  |       - *install-common | ||||||
|  |       - sudo apt-get install | ||||||
|  |             gcc-powerpc-linux-gnu | ||||||
|  |             libc6-dev-powerpc-cross | ||||||
|  |             qemu-user | ||||||
|  |       - powerpc-linux-gnu-gcc --version | ||||||
|  |       - qemu-ppc -version | ||||||
|  |     script: [*test-example, *report-size] | ||||||
|  |   - {<<: *powerpc, script: [*test-default,          *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-nor,              *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-emmc,             *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-nand,             *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-no-intrinsics,    *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-no-inline,        *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-byte-writes,      *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-block-cycles,     *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-odd-block-count,  *report-size]} | ||||||
|  |   - {<<: *powerpc, script: [*test-odd-block-size,   *report-size]} | ||||||
|  |  | ||||||
|   # test under valgrind, checking for memory errors |   # test under valgrind, checking for memory errors | ||||||
|     - stage: test |   - &valgrind | ||||||
|  |     stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-valgrind |       - NAME=littlefs-valgrind | ||||||
|         - TFLAGS="--valgrind" |       - TFLAGS="$TFLAGS --valgrind" | ||||||
|     install: |     install: | ||||||
|  |       - *install-common | ||||||
|       - sudo apt-get install valgrind |       - sudo apt-get install valgrind | ||||||
|       - valgrind --version |       - valgrind --version | ||||||
|  |     script: *test-example | ||||||
|  |   - {<<: *valgrind, script: *test-default} | ||||||
|  |   - {<<: *valgrind, script: *test-nor} | ||||||
|  |   - {<<: *valgrind, script: *test-emmc} | ||||||
|  |   - {<<: *valgrind, script: *test-nand} | ||||||
|  |   - {<<: *valgrind, script: *test-no-intrinsics} | ||||||
|  |   - {<<: *valgrind, script: *test-no-inline} | ||||||
|  |   - {<<: *valgrind, script: *test-byte-writes} | ||||||
|  |   - {<<: *valgrind, script: *test-block-cycles} | ||||||
|  |   - {<<: *valgrind, script: *test-odd-block-count} | ||||||
|  |   - {<<: *valgrind, script: *test-odd-block-size} | ||||||
|  |  | ||||||
|   # self-host with littlefs-fuse for fuzz test |   # self-host with littlefs-fuse for fuzz test | ||||||
|   - stage: test |   - stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-fuse |       - NAME=littlefs-fuse | ||||||
|     if: branch !~ -prefix$ |     if: branch !~ -prefix$ | ||||||
|     install: |     install: | ||||||
|  |       - *install-common | ||||||
|       - sudo apt-get install libfuse-dev |       - sudo apt-get install libfuse-dev | ||||||
|       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2 |       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2 | ||||||
|       - fusermount -V |       - fusermount -V | ||||||
|       - gcc --version |       - gcc --version | ||||||
|       before_script: |  | ||||||
|       # setup disk for littlefs-fuse |       # setup disk for littlefs-fuse | ||||||
|       - rm -rf littlefs-fuse/littlefs/* |       - rm -rf littlefs-fuse/littlefs/* | ||||||
|       - cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs |       - cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs | ||||||
| @@ -163,19 +241,19 @@ jobs: | |||||||
|       - ls -flh |       - ls -flh | ||||||
|       - make -B test_dirs test_files QUIET=1 |       - make -B test_dirs test_files QUIET=1 | ||||||
|  |  | ||||||
|     # self-host with littlefs-fuse for fuzz test |   # test migration using littlefs-fuse | ||||||
|   - stage: test |   - stage: test | ||||||
|     env: |     env: | ||||||
|         - STAGE=test |  | ||||||
|       - NAME=littlefs-migration |       - NAME=littlefs-migration | ||||||
|     if: branch !~ -prefix$ |     if: branch !~ -prefix$ | ||||||
|     install: |     install: | ||||||
|  |       - *install-common | ||||||
|       - sudo apt-get install libfuse-dev |       - sudo apt-get install libfuse-dev | ||||||
|       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2 v2 |       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2 v2 | ||||||
|       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v1 v1 |       - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v1 v1 | ||||||
|       - fusermount -V |       - fusermount -V | ||||||
|       - gcc --version |       - gcc --version | ||||||
|       before_script: |  | ||||||
|       # setup disk for littlefs-fuse |       # setup disk for littlefs-fuse | ||||||
|       - rm -rf v2/littlefs/* |       - rm -rf v2/littlefs/* | ||||||
|       - cp -r $(git ls-tree --name-only HEAD) v2/littlefs |       - cp -r $(git ls-tree --name-only HEAD) v2/littlefs | ||||||
| @@ -215,10 +293,9 @@ jobs: | |||||||
|       - ls -flh |       - ls -flh | ||||||
|       - make -B test_dirs test_files QUIET=1 |       - make -B test_dirs test_files QUIET=1 | ||||||
|  |  | ||||||
|     # Automatically create releases |   # automatically create releases | ||||||
|   - stage: deploy |   - stage: deploy | ||||||
|     env: |     env: | ||||||
|         - STAGE=deploy |  | ||||||
|       - NAME=deploy |       - NAME=deploy | ||||||
|     script: |     script: | ||||||
|       - | |       - | | ||||||
| @@ -289,45 +366,62 @@ jobs: | |||||||
|             }" #" |             }" #" | ||||||
|         SCRIPT |         SCRIPT | ||||||
|  |  | ||||||
| # Manage statuses | # manage statuses | ||||||
| before_install: | before_install: | ||||||
|   - | |   - | | ||||||
|  |     # don't clobber other (not us) failures | ||||||
|  |     if ! curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|  |         | jq -e ".statuses[] | select( | ||||||
|  |             .context == \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\" and | ||||||
|  |             .state == \"failure\" and | ||||||
|  |             (.target_url | endswith(\"$TRAVIS_JOB_NUMBER\") | not))" | ||||||
|  |     then | ||||||
|         curl -u "$GEKY_BOT_STATUSES" -X POST \ |         curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||||||
|             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ |             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|             -d "{ |             -d "{ | ||||||
|             \"context\": \"$STAGE/$NAME\", |                 \"context\": \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\", | ||||||
|                 \"state\": \"pending\", |                 \"state\": \"pending\", | ||||||
|                 \"description\": \"${STATUS:-In progress}\", |                 \"description\": \"${STATUS:-In progress}\", | ||||||
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" |                 \"target_url\": \"$TRAVIS_JOB_WEB_URL#$TRAVIS_JOB_NUMBER\" | ||||||
|             }" |             }" | ||||||
|   - sudo apt-get install python3-pip |     fi | ||||||
|   - sudo pip3 install toml |  | ||||||
|    |  | ||||||
|  |  | ||||||
| after_failure: | after_failure: | ||||||
|   - | |   - | | ||||||
|  |     # don't clobber other (not us) failures | ||||||
|  |     if ! curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|  |         | jq -e ".statuses[] | select( | ||||||
|  |             .context == \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\" and | ||||||
|  |             .state == \"failure\" and | ||||||
|  |             (.target_url | endswith(\"$TRAVIS_JOB_NUMBER\") | not))" | ||||||
|  |     then | ||||||
|         curl -u "$GEKY_BOT_STATUSES" -X POST \ |         curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||||||
|             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ |             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|             -d "{ |             -d "{ | ||||||
|             \"context\": \"$STAGE/$NAME\", |                 \"context\": \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\", | ||||||
|                 \"state\": \"failure\", |                 \"state\": \"failure\", | ||||||
|                 \"description\": \"${STATUS:-Failed}\", |                 \"description\": \"${STATUS:-Failed}\", | ||||||
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" |                 \"target_url\": \"$TRAVIS_JOB_WEB_URL#$TRAVIS_JOB_NUMBER\" | ||||||
|             }" |             }" | ||||||
|  |     fi | ||||||
|  |  | ||||||
| after_success: | after_success: | ||||||
|   - | |   - | | ||||||
|  |     # don't clobber other (not us) failures | ||||||
|  |     # only update if we were last job to mark in progress, | ||||||
|  |     # this isn't perfect but is probably good enough | ||||||
|  |     if ! curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|  |         | jq -e ".statuses[] | select( | ||||||
|  |             .context == \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\" and | ||||||
|  |             (.state == \"failure\" or .state == \"pending\") and | ||||||
|  |             (.target_url | endswith(\"$TRAVIS_JOB_NUMBER\") | not))" | ||||||
|  |     then | ||||||
|         curl -u "$GEKY_BOT_STATUSES" -X POST \ |         curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||||||
|             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ |             https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||||||
|             -d "{ |             -d "{ | ||||||
|             \"context\": \"$STAGE/$NAME\", |                 \"context\": \"${TRAVIS_BUILD_STAGE_NAME,,}/$NAME\", | ||||||
|                 \"state\": \"success\", |                 \"state\": \"success\", | ||||||
|                 \"description\": \"${STATUS:-Passed}\", |                 \"description\": \"${STATUS:-Passed}\", | ||||||
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" |                 \"target_url\": \"$TRAVIS_JOB_WEB_URL#$TRAVIS_JOB_NUMBER\" | ||||||
|             }" |             }" | ||||||
|  |     fi | ||||||
| # Job control |  | ||||||
| stages: |  | ||||||
|     - name: test |  | ||||||
|     - name: deploy |  | ||||||
|       if: branch = master AND type = push |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user