• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1version: 2
2
3jobs:
4  # the first half of the jobs are in this test
5  short-tests-0:
6    # TODO: Create a small custom docker image with all the dependencies we need
7    #       preinstalled to reduce installation time.
8    docker:
9      - image: fbopensource/zstd-circleci-primary:0.0.1
10    steps:
11      - checkout
12      - run:
13          name: Test
14          command: |
15            ./tests/test-license.py
16            cc -v; CFLAGS="-O0 -Werror -pedantic" make all && make clean
17            make c99build         ; make clean
18            make c11build         ; make clean
19            make aarch64build     ; make clean
20            make -j regressiontest; make clean
21            make shortest         ; make clean
22            make cxxtest          ; make clean
23  # the second half of the jobs are in this test
24  short-tests-1:
25    docker:
26      - image: fbopensource/zstd-circleci-primary:0.0.1
27    steps:
28      - checkout
29      - run:
30          name: Test
31          command: |
32            make gnu90build; make clean
33            make gnu99build; make clean
34            make ppc64build; make clean
35            make ppcbuild  ; make clean
36            make armbuild  ; make clean
37            make -C tests test-legacy test-longmatch; make clean
38            make -C lib libzstd-nomt; make clean
39  # This step is only run on release tags.
40  # It publishes the source tarball as artifacts and if the GITHUB_TOKEN
41  # environment variable is set it will publish the source tarball to the
42  # tagged release.
43  publish-github-release:
44    docker:
45      - image: fbopensource/zstd-circleci-primary:0.0.1
46    environment:
47      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
48    steps:
49      - checkout
50      - run:
51          name: Publish
52          command: |
53            export VERSION=$(echo $CIRCLE_TAG | tail -c +2)
54            export ZSTD_VERSION=zstd-$VERSION
55            git archive $CIRCLE_TAG --prefix $ZSTD_VERSION/ --format tar \
56                        -o $ZSTD_VERSION.tar
57            sha256sum $ZSTD_VERSION.tar > $ZSTD_VERSION.tar.sha256
58            zstd -19 $ZSTD_VERSION.tar
59            sha256sum $ZSTD_VERSION.tar.zst > $ZSTD_VERSION.tar.zst.sha256
60            gzip -k -9 $ZSTD_VERSION.tar
61            sha256sum $ZSTD_VERSION.tar.gz > $ZSTD_VERSION.tar.gz.sha256
62            mkdir -p $CIRCLE_ARTIFACTS
63            cp $ZSTD_VERSION.tar* $CIRCLE_ARTIFACTS
64      - store_artifacts:
65          path: /tmp/circleci-artifacts
66  # This step should only be run in a cron job
67  regression-test:
68    docker:
69      - image: fbopensource/zstd-circleci-primary:0.0.1
70    environment:
71      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
72    steps:
73      - checkout
74      # Restore the cached resources.
75      - restore_cache:
76          # We try our best to bust the cache when the data changes by hashing
77          # data.c. If that doesn't work, simply update the version number here
78          # and below. If we fail to bust the cache, the regression testing will
79          # still work, since it has its own stamp, but will need to redownload
80          # everything.
81          keys:
82            - regression-cache-{{ checksum "tests/regression/data.c" }}-v0
83      - run:
84          name: Regression Test
85          command: |
86            make -C programs zstd
87            make -C tests/regression test
88            mkdir -p $CIRCLE_ARTIFACTS
89            ./tests/regression/test                     \
90                --cache  tests/regression/cache         \
91                --output $CIRCLE_ARTIFACTS/results.csv  \
92                --zstd   programs/zstd
93            echo "NOTE: The new results.csv is uploaded as an artifact to this job"
94            echo "      If this fails, go to the Artifacts pane in CircleCI, "
95            echo "      download /tmp/circleci-artifacts/results.csv, and if they "
96            echo "      are still good, copy it into the repo and commit it."
97            echo "> diff tests/regression/results.csv $CIRCLE_ARTIFACTS/results.csv"
98            diff tests/regression/results.csv $CIRCLE_ARTIFACTS/results.csv
99      # Only save the cache on success (default), since if the failure happened
100      # before we stamp the data cache, we will have a bad cache for this key.
101      - save_cache:
102          key: regression-cache-{{ checksum "tests/regression/data.c" }}-v0
103          paths:
104            - tests/regression/cache
105      - store_artifacts:
106          path: /tmp/circleci-artifacts
107
108
109workflows:
110  version: 2
111  commit:
112    jobs:
113      # Run the tests in parallel
114      - short-tests-0:
115          filters:
116            tags:
117              only: /.*/
118      - short-tests-1:
119          filters:
120            tags:
121              only: /.*/
122      # Create a branch called regression and set it to dev to force a
123      # regression test run
124      - regression-test:
125          filters:
126            branches:
127              only:
128                - regression
129      # Only run on release tags.
130      - publish-github-release:
131          requires:
132            - short-tests-0
133            - short-tests-1
134          filters:
135            branches:
136              ignore: /.*/
137            tags:
138              only: /^v\d+\.\d+\.\d+$/
139  nightly:
140    triggers:
141      - schedule:
142          cron: "0 0 * * *"
143          filters:
144            branches:
145              only:
146                - master
147                - dev
148    jobs:
149      # Run daily long regression tests
150      - regression-test
151
152
153
154  # Longer tests
155    #- make -C tests test-zstd-nolegacy && make clean
156    #- pyenv global 3.4.4; make -C tests versionsTest && make clean
157    #- make zlibwrapper         && make clean
158    #- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean
159    #- make uasan               && make clean
160    #- make asan32              && make clean
161    #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu"
162  # Valgrind tests
163    #- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean
164    #- make -C tests valgrindTest && make clean
165  # ARM, AArch64, PowerPC, PowerPC64 tests
166    #- make ppctest             && make clean
167    #- make ppc64test           && make clean
168    #- make armtest             && make clean
169    #- make aarch64test         && make clean
170