.travis.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. env:
  2. - CFLAGS=-Werror
  3. script:
  4. # make sure example can at least compile
  5. - sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
  6. make all size CFLAGS+="
  7. -Duser_provided_block_device_read=NULL
  8. -Duser_provided_block_device_prog=NULL
  9. -Duser_provided_block_device_erase=NULL
  10. -Duser_provided_block_device_sync=NULL
  11. -include stdio.h"
  12. # run tests
  13. - make test QUIET=1
  14. # run tests with a few different configurations
  15. - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
  16. - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
  17. - make test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
  18. # self-host with littlefs-fuse for fuzz test
  19. - make -C littlefs-fuse
  20. - littlefs-fuse/lfs --format /dev/loop0
  21. - littlefs-fuse/lfs /dev/loop0 mount
  22. - ls mount
  23. - mkdir mount/littlefs
  24. - cp -r $(git ls-tree --name-only HEAD) mount/littlefs
  25. - cd mount/littlefs
  26. - ls
  27. - make -B test_dirs test_files QUIET=1
  28. before_install:
  29. - fusermount -V
  30. - gcc --version
  31. install:
  32. - sudo apt-get install libfuse-dev
  33. - git clone --depth 1 https://github.com/geky/littlefs-fuse
  34. before_script:
  35. - rm -rf littlefs-fuse/littlefs/*
  36. - cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs
  37. - mkdir mount
  38. - sudo chmod a+rw /dev/loop0
  39. - dd if=/dev/zero bs=512 count=2048 of=disk
  40. - losetup /dev/loop0 disk
  41. deploy:
  42. # Let before_deploy take over
  43. provider: script
  44. script: 'true'
  45. on:
  46. branch: master
  47. before_deploy:
  48. - cd $TRAVIS_BUILD_DIR
  49. # Update tag for version defined in lfs.h
  50. - LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
  51. - LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
  52. - LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
  53. - LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
  54. - echo "littlefs version $LFS_VERSION"
  55. - |
  56. curl -u $GEKY_BOT -X POST \
  57. https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
  58. -d "{
  59. \"ref\": \"refs/tags/$LFS_VERSION\",
  60. \"sha\": \"$TRAVIS_COMMIT\"
  61. }"
  62. - |
  63. curl -f -u $GEKY_BOT -X PATCH \
  64. https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
  65. -d "{
  66. \"sha\": \"$TRAVIS_COMMIT\"
  67. }"
  68. # Create release notes from commits
  69. - LFS_PREV_VERSION="v$LFS_VERSION_MAJOR.$(($LFS_VERSION_MINOR-1))"
  70. - |
  71. if [ $(git tag -l "$LFS_PREV_VERSION") ]
  72. then
  73. curl -u $GEKY_BOT -X POST \
  74. https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
  75. -d "{
  76. \"tag_name\": \"$LFS_VERSION\",
  77. \"name\": \"$LFS_VERSION\"
  78. }"
  79. RELEASE=$(
  80. curl -f https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
  81. )
  82. CHANGES=$(
  83. git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
  84. )
  85. curl -f -u $GEKY_BOT -X PATCH \
  86. https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/$(
  87. jq -r '.id' <<< "$RELEASE"
  88. ) \
  89. -d "$(
  90. jq -s '{
  91. "body": ((.[0] // "" | sub("(?<=\n)#+ Changes.*"; ""; "mi"))
  92. + "### Changes\n\n" + .[1])
  93. }' <(jq '.body' <<< "$RELEASE") <(jq -sR '.' <<< "$CHANGES")
  94. )"
  95. fi