Welcome to mirror list, hosted at ThFree Co, Russian Federation.

.travis.yml - github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 880c861fc76be0b5eb7250121b94ce127d9ee929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# 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+="-DLFS_READ_SIZE=1      -DLFS_CACHE_SIZE=4"
  - make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512    -DLFS_CACHE_SIZE=512 -DLFS_BLOCK_CYCLES=16"
  - make test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD_SIZE=256"

  - make clean test QUIET=1 CFLAGS+="-DLFS_INLINE_MAX=0"
  - make clean test QUIET=1 CFLAGS+="-DLFS_EMUBD_ERASE_VALUE=0xff"
  - make clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"

  # additional configurations that don't support all tests (this should be
  # fixed but at the moment it is what it is)
  - make test_files QUIET=1
        CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_BLOCK_SIZE=4096"
  - make test_files QUIET=1
        CFLAGS+="-DLFS_READ_SIZE=\(2*1024\) -DLFS_BLOCK_SIZE=\(64*1024\)"
  - make test_files QUIET=1
        CFLAGS+="-DLFS_READ_SIZE=\(8*1024\) -DLFS_BLOCK_SIZE=\(64*1024\)"
  - make test_files QUIET=1
        CFLAGS+="-DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704"

  # compile and find the code size with the smallest configuration
  - make clean size
        OBJ="$(ls lfs*.o | tr '\n' ' ')"
        CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_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
              libc6-dev-armel-cross
              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
              libc6-dev-powerpc-cross
              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 apt-get install
              gcc-mips-linux-gnu
              libc6-dev-mips-cross
              qemu-user
        - mips-linux-gnu-gcc --version
        - qemu-mips -version

    # self-host with littlefs-fuse for fuzz test
    - stage: test
      env:
        - STAGE=test
        - NAME=littlefs-fuse
      if: branch !~ -prefix$
      install:
        - sudo apt-get install libfuse-dev
        - git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2
        - fusermount -V
        - gcc --version
      before_script:
        # setup disk for littlefs-fuse
        - rm -rf littlefs-fuse/littlefs/*
        - cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs

        - mkdir mount
        - sudo chmod a+rw /dev/loop0
        - dd if=/dev/zero bs=512 count=4096 of=disk
        - losetup /dev/loop0 disk
      script:
        # self-host test
        - make -C littlefs-fuse

        - littlefs-fuse/lfs --format /dev/loop0
        - littlefs-fuse/lfs /dev/loop0 mount

        - ls mount
        - mkdir mount/littlefs
        - cp -r $(git ls-tree --name-only HEAD) mount/littlefs
        - cd mount/littlefs
        - stat .
        - ls -flh
        - make -B test_dirs test_files QUIET=1

    # self-host with littlefs-fuse for fuzz test
    - stage: test
      env:
        - STAGE=test
        - NAME=littlefs-migration
      if: branch !~ -prefix$
      install:
        - 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 v1 v1
        - fusermount -V
        - gcc --version
      before_script:
        # setup disk for littlefs-fuse
        - rm -rf v2/littlefs/*
        - cp -r $(git ls-tree --name-only HEAD) v2/littlefs

        - mkdir mount
        - sudo chmod a+rw /dev/loop0
        - dd if=/dev/zero bs=512 count=4096 of=disk
        - losetup /dev/loop0 disk
      script:
        # compile v1 and v2
        - make -C v1
        - make -C v2

        # run self-host test with v1
        - v1/lfs --format /dev/loop0
        - v1/lfs /dev/loop0 mount

        - ls mount
        - mkdir mount/littlefs
        - cp -r $(git ls-tree --name-only HEAD) mount/littlefs
        - cd mount/littlefs
        - stat .
        - ls -flh
        - make -B test_dirs test_files QUIET=1

        # attempt to migrate
        - cd ../..
        - fusermount -u mount

        - v2/lfs --migrate /dev/loop0
        - v2/lfs /dev/loop0 mount

        # run self-host test with v2 right where we left off
        - ls mount
        - cd mount/littlefs
        - stat .
        - ls -flh
        - make -B test_dirs test_files QUIET=1

    # Automatically create releases
    - stage: deploy
      env:
        - STAGE=deploy
        - NAME=deploy
      script:
        - |
          bash << 'SCRIPT'
          set -ev
          # Find version defined in lfs.h
          LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
          LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
          LFS_VERSION_MINOR=$((0xffff & ($LFS_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$LFS_VERSION_MAJOR.$LFS_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)
          LFS_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
          LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH"
          echo "VERSION $LFS_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')
          [ "$TRAVIS_COMMIT" == "$CURRENT_COMMIT" ] || exit 0
          # Create major branch
          git branch v$LFS_VERSION_MAJOR HEAD
          # Create major prefix branch
          git config user.name "geky bot"
          git config user.email "bot@geky.net"
          git fetch https://github.com/$TRAVIS_REPO_SLUG.git \
              --depth=50 v$LFS_VERSION_MAJOR-prefix || true
          ./scripts/prefix.py lfs$LFS_VERSION_MAJOR
          git branch v$LFS_VERSION_MAJOR-prefix $( \
              git commit-tree $(git write-tree) \
                  $(git rev-parse --verify -q FETCH_HEAD | sed -e 's/^/-p /') \
                  -p HEAD \
                  -m "Generated v$LFS_VERSION_MAJOR prefixes")
          git reset --hard
          # Update major version branches (vN and vN-prefix)
          git push --atomic https://$GEKY_BOT_RELEASES@github.com/$TRAVIS_REPO_SLUG.git \
              v$LFS_VERSION_MAJOR \
              v$LFS_VERSION_MAJOR-prefix
          # Build release notes
          PREV=$(git tag --sort=-v:refname -l "v*" | head -1)
          if [ ! -z "$PREV" ]
          then
              echo "PREV $PREV"
              CHANGES=$(git log --oneline $PREV.. --grep='^Merge' --invert-grep)
              printf "CHANGES\n%s\n\n" "$CHANGES"
          fi
          case ${GEKY_BOT_DRAFT:-minor} in
              true)  DRAFT=true ;;
              minor) DRAFT=$(jq -R 'endswith(".0")' <<< "$LFS_VERSION") ;;
              false) DRAFT=false ;;
          esac
          # Create the release and patch version tag (vN.N.N)
          curl -f -u "$GEKY_BOT_RELEASES" -X POST \
              https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
              -d "{
                  \"tag_name\": \"$LFS_VERSION\",
                  \"name\": \"${LFS_VERSION%.0}\",
                  \"target_commitish\": \"$TRAVIS_COMMIT\",
                  \"draft\": $DRAFT,
                  \"body\": $(jq -sR '.' <<< "$CHANGES")
              }" #"
          SCRIPT

# 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