File size: 7,269 Bytes
1e92f2d | 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 | aliases:
- &install_yarn_version
name: Install specific Yarn version
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.16.0
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
- &restore_yarn_cache
name: Restore Yarn cache
keys:
- yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
- &save_yarn_cache
name: Save Yarn cache
key: yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- &run_yarn_install
name: Install dependencies
command: yarn install
defaults: &defaults
working_directory: ~/react-instantsearch
docker:
- image: cimg/node:12.22.7
version: 2
jobs:
test_build:
<<: *defaults
docker:
- image: cimg/node:14.18.2
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Build & Test packages size
command: yarn test:build
- store_artifacts:
path: packages/react-instantsearch/dist
- store_artifacts:
path: packages/react-instantsearch-core/dist
- store_artifacts:
path: packages/react-instantsearch-dom/dist
- store_artifacts:
path: packages/react-instantsearch-dom-maps/dist
- store_artifacts:
path: packages/react-instantsearch-hooks/dist
- store_artifacts:
path: packages/react-instantsearch-hooks-server/dist
- store_artifacts:
path: packages/react-instantsearch-native/dist
test_unit:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Lint & Code styles
command: yarn lint
- run:
name: Build
command: yarn build
- run:
name: Type checking
command: yarn type-check
- run:
name: Unit Tests
command: |
retry() {
MAX_RETRY=2
n=0
until [ $n -ge $MAX_RETRY ]
do
"$@" && break
n=$[$n+1]
done
if [ $n -ge $MAX_RETRY ]; then
exit 1
fi
}
# https://github.com/facebook/jest/issues/8987 - Jest fails to run tests on CI sporadically
# retry introduced in https://github.com/algolia/react-instantsearch/pull/3475
retry yarn test --maxWorkers=4
- store_test_results:
path: junit/jest/
test_unit_react_v17:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Install React v17 dependencies
command: |
yarn add --force -DW \
react@17.0.2 \
@types/react@17.0.47 \
react-dom@17.0.2 \
@types/react-dom@17.0.17 \
react-test-renderer@17.0.2 \
@types/react-test-renderer@17.0.2 \
@testing-library/react@12.1.4
- run:
name: Unit Tests
command: |
retry() {
MAX_RETRY=2
n=0
until [ $n -ge $MAX_RETRY ]
do
"$@" && break
n=$[$n+1]
done
if [ $n -ge $MAX_RETRY ]; then
exit 1
fi
}
# https://github.com/facebook/jest/issues/8987 - Jest fails to run tests on CI sporadically
# retry introduced in https://github.com/algolia/react-instantsearch/pull/3475
retry yarn test --maxWorkers=4
- store_test_results:
path: junit/jest/
test_unit_algoliasearch_v3:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Install algoliasearch v3
command: |
rm -rf examples
yarn add -W -D @types/algoliasearch@3.34.8 algoliasearch@3.35.1
- run:
name: Type checking
command: yarn type-check
- run:
name: Unit Tests
command: |
retry() {
MAX_RETRY=2
n=0
until [ $n -ge $MAX_RETRY ]
do
"$@" && break
n=$[$n+1]
done
if [ $n -ge $MAX_RETRY ]; then
exit 1
fi
}
# https://github.com/facebook/jest/issues/8987 - Jest fails to run tests on CI sporadically
# retry introduced in https://github.com/algolia/react-instantsearch/pull/3475
retry yarn test --maxWorkers=4
- store_test_results:
path: junit/jest/
test_e2e:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: End-2-End tests
command: |
yarn run website:build
yarn run test:e2e:saucelabs
- store_test_results:
path: junit/wdio/
test_examples:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Build libraries
command: yarn build
- run:
name: Build & Test examples
command: yarn test:examples
release_if_needed:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Trigger a release if the latest commit is a release commit
command: yarn shipjs trigger
prepare_release:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Prepare a pull request for next release
command: |
git config --global user.email "instantsearch-bot@algolia.com"
git config --global user.name "InstantSearch"
yarn run release --yes --no-browse
workflows:
version: 2
ci:
jobs:
- test_build
- test_unit
- test_unit_react_v17
- test_unit_algoliasearch_v3
- test_e2e
- test_examples
- release_if_needed:
filters:
branches:
only:
- master
- next
scheduled_release:
triggers:
- schedule:
cron: '0 9 * * 2'
filters:
branches:
only:
- master
jobs:
- prepare_release
|