|
1 | | -version: 2 # use CircleCI 2.0 |
2 | | -jobs: # a collection of steps |
3 | | - build: # runs not using Workflows must have a `build` job as entry point |
4 | | - working_directory: ~/git/bucklescript # directory where steps will run |
5 | | - docker: # run the steps with Docker |
6 | | - - image: circleci/node:dubnium # ...with this image as the primary container; this is where all `steps` will run |
7 | | - steps: # a collection of executable commands |
| 1 | +version: '2.1' |
| 2 | + |
| 3 | +executors: |
| 4 | + # TODO: we currently have python as a build dependency; it is accidentally included in circleci/node |
| 5 | + linux-node-v10: |
| 6 | + docker: |
| 7 | + - image: circleci/node:10 |
| 8 | + linux-node-v12: |
| 9 | + docker: |
| 10 | + - image: circleci/node:12 |
| 11 | + linux-node-v14: |
| 12 | + docker: |
| 13 | + - image: circleci/node:14 |
| 14 | + linux-node-v16: |
| 15 | + docker: |
| 16 | + - image: circleci/node:16 |
| 17 | + macos: |
| 18 | + macos: |
| 19 | + xcode: 12.5.0 |
| 20 | + |
| 21 | +orbs: |
| 22 | + node: circleci/node@4.5.0 |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-test: |
| 26 | + parameters: |
| 27 | + executor: |
| 28 | + type: executor |
| 29 | + install-node: |
| 30 | + type: boolean |
| 31 | + default: false |
| 32 | + # defaults are the same as circleci/node orb: |
| 33 | + install-node-lts: |
| 34 | + type: boolean |
| 35 | + default: false |
| 36 | + install-node-version: |
| 37 | + type: string |
| 38 | + default: "node" |
| 39 | + install-npm-version: |
| 40 | + type: string |
| 41 | + default: "latest" |
| 42 | + executor: << parameters.executor >> |
| 43 | + environment: |
| 44 | + BS_TRAVIS_CI: 1 |
| 45 | + NINJA_FORCE_REBUILD: 1 |
| 46 | + OCAMLRUNPARAM: "b" |
| 47 | + steps: |
8 | 48 | - restore_cache: # try to restore .git folder from cache to speed up checkout |
9 | 49 | keys: |
10 | | - - source-v1-{{ .Branch }}-{{ .Revision }} |
11 | | - - source-v1-{{ .Branch }}- |
12 | | - - source-v1- |
13 | | - - checkout # special step to check out source code to working directory |
14 | | - - run: |
15 | | - name: "Pull git submodules" |
16 | | - command: | |
17 | | - git submodule sync |
18 | | - git submodule update --init |
| 50 | + - source-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }} |
| 51 | + - source-v4-{{ arch }}-{{ .Branch }}- |
| 52 | + - source-v4-{{ arch }} |
| 53 | + - checkout |
| 54 | + - run: git submodule sync |
| 55 | + - run: git submodule update --init |
19 | 56 | - save_cache: # write .git folder to cache |
20 | | - key: source-v1-{{ .Branch }}-{{ .Revision }} |
| 57 | + key: source-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }} |
21 | 58 | paths: |
22 | 59 | - ".git" |
23 | | - |
24 | | - - run: |
25 | | - name: "Set environment variables" |
26 | | - command: | |
27 | | - echo 'export BS_TRAVIS_CI=1' >> $BASH_ENV |
28 | | - echo 'export NINJA_FORCE_REBUILD=1' >> $BASH_ENV |
29 | | - echo 'export OCAMLRUNPARAM="b"' >> $BASH_ENV |
30 | | - - run: |
31 | | - name: "Check environment variables" |
32 | | - command: | |
33 | | - echo BS_TRAVIS_CI ${BS_TRAVIS_CI} |
34 | 60 |
|
35 | | - - run: npm ci # `npm ci` is not available on node v8 |
| 61 | + # install node and npm for executors where they are not preinstalled |
| 62 | + - when: |
| 63 | + condition: << parameters.install-node >> |
| 64 | + steps: |
| 65 | + - node/install: |
| 66 | + lts: << parameters.install-node-lts >> |
| 67 | + node-version: << parameters.install-node-version >> |
| 68 | + npm-version: << parameters.install-npm-version >> |
| 69 | + |
| 70 | + - node/install-packages # npm ci |
36 | 71 | - run: npm test |
| 72 | + |
| 73 | +workflows: |
| 74 | + version: 2 |
| 75 | + build-test-all: # workflow name |
| 76 | + jobs: |
| 77 | + - build-test: |
| 78 | + name: linux-node-v10 |
| 79 | + executor: linux-node-v10 |
| 80 | + - build-test: |
| 81 | + name: linux-node-v12 |
| 82 | + executor: linux-node-v12 |
| 83 | + - build-test: |
| 84 | + name: linux-node-v14 |
| 85 | + executor: linux-node-v14 |
| 86 | + - build-test: |
| 87 | + name: linux-node-v16 |
| 88 | + executor: linux-node-v16 |
| 89 | + - build-test: |
| 90 | + name: macos-node-lts |
| 91 | + executor: macos |
| 92 | + install-node: true |
| 93 | + install-node-lts: true |
0 commit comments