mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	This is needed to allow compilation of multiple versions in the same binary. Also note that the FUSE testing was removed because of related name issues. ./scripts/prefix.py lfs1
		
			
				
	
	
		
			197 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			197 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # Environment variables
 | |
| env:
 | |
|   global:
 | |
|     - CFLAGS=-Werror
 | |
| 
 | |
| # Common test script
 | |
| script:
 | |
|   # make sure example can at least compile
 | |
|   - sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
 | |
|     make all CFLAGS+="
 | |
|         -Duser_provided_block_device_read=NULL
 | |
|         -Duser_provided_block_device_prog=NULL
 | |
|         -Duser_provided_block_device_erase=NULL
 | |
|         -Duser_provided_block_device_sync=NULL
 | |
|         -include stdio.h"
 | |
| 
 | |
|   # run tests
 | |
|   - make test QUIET=1
 | |
| 
 | |
|   # run tests with a few different configurations
 | |
|   - make test QUIET=1 CFLAGS+="-DLFS1_READ_SIZE=1      -DLFS1_PROG_SIZE=1"
 | |
|   - make test QUIET=1 CFLAGS+="-DLFS1_READ_SIZE=512    -DLFS1_PROG_SIZE=512"
 | |
|   - make test QUIET=1 CFLAGS+="-DLFS1_BLOCK_COUNT=1023 -DLFS1_LOOKAHEAD=2048"
 | |
| 
 | |
|   - make clean test QUIET=1 CFLAGS+="-DLFS1_NO_INTRINSICS"
 | |
| 
 | |
|   # compile and find the code size with the smallest configuration
 | |
|   - make clean size
 | |
|         OBJ="$(ls lfs1*.o | tr '\n' ' ')"
 | |
|         CFLAGS+="-DLFS1_NO_ASSERT -DLFS1_NO_DEBUG -DLFS1_NO_WARN -DLFS1_NO_ERROR"
 | |
|         | tee sizes
 | |
| 
 | |
|   # update status if we succeeded, compare with master if possible
 | |
|   - |
 | |
|     if [ "$TRAVIS_TEST_RESULT" -eq 0 ]
 | |
|     then
 | |
|         CURR=$(tail -n1 sizes | awk '{print $1}')
 | |
|         PREV=$(curl -u $GEKY_BOT_STATUSES https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
 | |
|             | jq -re "select(.sha != \"$TRAVIS_COMMIT\")
 | |
|                 | .statuses[] | select(.context == \"$STAGE/$NAME\").description
 | |
|                 | capture(\"code size is (?<size>[0-9]+)\").size" \
 | |
|             || echo 0)
 | |
| 
 | |
|         STATUS="Passed, code size is ${CURR}B"
 | |
|         if [ "$PREV" -ne 0 ]
 | |
|         then
 | |
|             STATUS="$STATUS ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
 | |
|         fi
 | |
|     fi
 | |
| 
 | |
| # CI matrix
 | |
| jobs:
 | |
|   include:
 | |
|     # native testing
 | |
|     - stage: test
 | |
|       env:
 | |
|         - STAGE=test
 | |
|         - NAME=littlefs-x86
 | |
| 
 | |
|     # cross-compile with ARM (thumb mode)
 | |
|     - stage: test
 | |
|       env:
 | |
|         - STAGE=test
 | |
|         - NAME=littlefs-arm
 | |
|         - CC="arm-linux-gnueabi-gcc --static -mthumb"
 | |
|         - EXEC="qemu-arm"
 | |
|       install:
 | |
|         - sudo apt-get install gcc-arm-linux-gnueabi qemu-user
 | |
|         - arm-linux-gnueabi-gcc --version
 | |
|         - qemu-arm -version
 | |
| 
 | |
|     # cross-compile with PowerPC
 | |
|     - stage: test
 | |
|       env:
 | |
|         - STAGE=test
 | |
|         - NAME=littlefs-powerpc
 | |
|         - CC="powerpc-linux-gnu-gcc --static"
 | |
|         - EXEC="qemu-ppc"
 | |
|       install:
 | |
|         - sudo apt-get install gcc-powerpc-linux-gnu qemu-user
 | |
|         - powerpc-linux-gnu-gcc --version
 | |
|         - qemu-ppc -version
 | |
| 
 | |
|     # cross-compile with MIPS
 | |
|     - stage: test
 | |
|       env:
 | |
|         - STAGE=test
 | |
|         - NAME=littlefs-mips
 | |
|         - CC="mips-linux-gnu-gcc --static"
 | |
|         - EXEC="qemu-mips"
 | |
|       install:
 | |
|         - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
 | |
|         - sudo apt-get -qq update
 | |
|         - sudo apt-get install gcc-mips-linux-gnu qemu-user
 | |
|         - mips-linux-gnu-gcc --version
 | |
|         - qemu-mips -version
 | |
| 
 | |
|       # Automatically update releases
 | |
|     - stage: deploy
 | |
|       env:
 | |
|         - STAGE=deploy
 | |
|         - NAME=deploy
 | |
|       script:
 | |
|         # Find version defined in lfs1.h
 | |
|         - LFS1_VERSION=$(grep -ox '#define LFS1_VERSION .*' lfs1.h | cut -d ' ' -f3)
 | |
|         - LFS1_VERSION_MAJOR=$((0xffff & ($LFS1_VERSION >> 16)))
 | |
|         - LFS1_VERSION_MINOR=$((0xffff & ($LFS1_VERSION >>  0)))
 | |
|         # Grab latests patch from repo tags, default to 0, needs finagling to get past github's pagination api
 | |
|         - PREV_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/v$LFS1_VERSION_MAJOR.$LFS1_VERSION_MINOR.
 | |
|         - PREV_URL=$(curl -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I
 | |
|                 | sed -n '/^Link/{s/.*<\(.*\)>; rel="last"/\1/;p;q0};$q1'
 | |
|                 || echo $PREV_URL)
 | |
|         - LFS1_VERSION_PATCH=$(curl -u "$GEKY_BOT_RELEASES" "$PREV_URL"
 | |
|                 | jq 'map(.ref | match("\\bv.*\\..*\\.(.*)$";"g")
 | |
|                     .captures[].string | tonumber) | max + 1'
 | |
|                 || echo 0)
 | |
|         # We have our new version
 | |
|         - LFS1_VERSION="v$LFS1_VERSION_MAJOR.$LFS1_VERSION_MINOR.$LFS1_VERSION_PATCH"
 | |
|         - echo "VERSION $LFS1_VERSION"
 | |
|         - |
 | |
|           # Check that we're the most recent commit
 | |
|           CURRENT_COMMIT=$(curl -f -u "$GEKY_BOT_RELEASES" \
 | |
|                 https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/master \
 | |
|                 | jq -re '.sha')
 | |
|           if [ "$TRAVIS_COMMIT" == "$CURRENT_COMMIT" ]
 | |
|           then
 | |
|             # Create a simple tag
 | |
|             curl -f -u "$GEKY_BOT_RELEASES" -X POST \
 | |
|                 https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
 | |
|                 -d "{
 | |
|                     \"ref\": \"refs/tags/$LFS1_VERSION\",
 | |
|                     \"sha\": \"$TRAVIS_COMMIT\"
 | |
|                 }"
 | |
|             # Minor release?
 | |
|             if [[ "$LFS1_VERSION" == *.0 ]]
 | |
|             then
 | |
|               # Build release notes
 | |
|               PREV=$(git tag --sort=-v:refname -l "v*.0" | head -1)
 | |
|               if [ ! -z "$PREV" ]
 | |
|               then
 | |
|                   echo "PREV $PREV"
 | |
|                   CHANGES=$'### Changes\n\n'$( \
 | |
|                       git log --oneline $PREV.. --grep='^Merge' --invert-grep)
 | |
|                   printf "CHANGES\n%s\n\n" "$CHANGES"
 | |
|               fi
 | |
|               # Create the release
 | |
|               curl -f -u "$GEKY_BOT_RELEASES" -X POST \
 | |
|                   https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
 | |
|                   -d "{
 | |
|                       \"tag_name\": \"$LFS1_VERSION\",
 | |
|                       \"name\": \"${LFS1_VERSION%.0}\",
 | |
|                       \"draft\": true,
 | |
|                       \"body\": $(jq -sR '.' <<< "$CHANGES")
 | |
|                   }"
 | |
|             fi
 | |
|           fi
 | |
| 
 | |
| # Manage statuses
 | |
| before_install:
 | |
|   - |
 | |
|     curl -u $GEKY_BOT_STATUSES -X POST \
 | |
|         https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
 | |
|         -d "{
 | |
|             \"context\": \"$STAGE/$NAME\",
 | |
|             \"state\": \"pending\",
 | |
|             \"description\": \"${STATUS:-In progress}\",
 | |
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
 | |
|         }"
 | |
| 
 | |
| after_failure:
 | |
|   - |
 | |
|     curl -u $GEKY_BOT_STATUSES -X POST \
 | |
|         https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
 | |
|         -d "{
 | |
|             \"context\": \"$STAGE/$NAME\",
 | |
|             \"state\": \"failure\",
 | |
|             \"description\": \"${STATUS:-Failed}\",
 | |
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
 | |
|         }"
 | |
| 
 | |
| after_success:
 | |
|   - |
 | |
|     curl -u $GEKY_BOT_STATUSES -X POST \
 | |
|         https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
 | |
|         -d "{
 | |
|             \"context\": \"$STAGE/$NAME\",
 | |
|             \"state\": \"success\",
 | |
|             \"description\": \"${STATUS:-Passed}\",
 | |
|             \"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
 | |
|         }"
 | |
| 
 | |
| # Job control
 | |
| stages:
 | |
|     - name: test
 | |
|     - name: deploy
 | |
|       if: branch = master AND type = push
 |