|
| 1 | +version: 2 |
| 2 | + |
| 3 | +defaults: &defaults |
| 4 | + working_directory: /tmp/project |
| 5 | + docker: |
| 6 | + - image: arcanemagus/atom-docker-ci:stable |
| 7 | + steps: |
| 8 | + # Restore project state |
| 9 | + - attach_workspace: |
| 10 | + at: /tmp |
| 11 | + # Restore Cabal cache |
| 12 | + - restore_cache: |
| 13 | + keys: |
| 14 | + # Get latest cache for the current specs |
| 15 | + - v1-cabal-{{ arch }}-{{ checksum "spec/linter-shellcheck-spec.js" }} |
| 16 | + # Fallback to the last available cache |
| 17 | + - v1-cabal-{{ arch }} |
| 18 | + - run: |
| 19 | + name: Install software-properties-common |
| 20 | + command: | |
| 21 | + sudo apt-get update && |
| 22 | + sudo apt-get install --assume-yes --quiet --no-install-suggests \ |
| 23 | + --no-install-recommends software-properties-common |
| 24 | + - run: |
| 25 | + name: Add Haskell PPA |
| 26 | + command: sudo add-apt-repository --yes ppa:hvr/ghc |
| 27 | + - run: |
| 28 | + name: Install Haskell and GHC |
| 29 | + command: | |
| 30 | + sudo apt-get install --assume-yes --quiet --no-install-suggests \ |
| 31 | + --no-install-recommends cabal-install ghc |
| 32 | + - run: |
| 33 | + name: Add Cabal to PATH |
| 34 | + command: echo 'export PATH="$HOME/.cabal/bin:$PATH"' >> $BASH_ENV |
| 35 | + - run: |
| 36 | + name: Update Cabal |
| 37 | + command: cabal update |
| 38 | + - run: |
| 39 | + name: Install ShellCheck |
| 40 | + command: cabal install shellcheck |
| 41 | + - run: |
| 42 | + name: Create VFB for Atom to run in |
| 43 | + command: /usr/local/bin/xvfb_start |
| 44 | + - run: |
| 45 | + name: Atom version |
| 46 | + command: ${ATOM_SCRIPT_PATH} --version |
| 47 | + - run: |
| 48 | + name: APM version |
| 49 | + command: ${APM_SCRIPT_PATH} --version |
| 50 | + - run: |
| 51 | + name: ShellCheck version |
| 52 | + command: shellcheck --version |
| 53 | + - run: |
| 54 | + name: Cleaning package |
| 55 | + command: ${APM_SCRIPT_PATH} clean |
| 56 | + - run: |
| 57 | + name: Package APM package dependencies |
| 58 | + command: | |
| 59 | + if [ -n "${APM_TEST_PACKAGES}" ]; then |
| 60 | + for pack in ${APM_TEST_PACKAGES}; do |
| 61 | + ${APM_SCRIPT_PATH} install "${pack}" |
| 62 | + done |
| 63 | + fi; |
| 64 | + - run: |
| 65 | + name: Package dependencies |
| 66 | + command: ${APM_SCRIPT_PATH} install |
| 67 | + - run: |
| 68 | + name: Package specs |
| 69 | + command: ${ATOM_SCRIPT_PATH} --test spec |
| 70 | + # Cache node_modules |
| 71 | + - save_cache: |
| 72 | + paths: |
| 73 | + - node_modules |
| 74 | + key: v1-dependencies-{{ checksum "package.json" }} |
| 75 | + # Cache Cabal, keyed on the specs |
| 76 | + - save_cache: |
| 77 | + paths: |
| 78 | + - "~/.cabal" |
| 79 | + - "~/.ghc" |
| 80 | + key: v1-cabal-{{ arch }}-{{ checksum "spec/linter-shellcheck-spec.js" }} |
| 81 | + |
| 82 | +jobs: |
| 83 | + checkout_code: |
| 84 | + <<: *defaults |
| 85 | + docker: |
| 86 | + - image: circleci/node:latest |
| 87 | + steps: |
| 88 | + - checkout |
| 89 | + # Restore node_modules from the last build |
| 90 | + - restore_cache: |
| 91 | + keys: |
| 92 | + # Get latest cache for this package.json |
| 93 | + - v1-dependencies-{{ checksum "package.json" }} |
| 94 | + # Fallback to the last available cache |
| 95 | + - v1-dependencies |
| 96 | + # Save project state for next steps |
| 97 | + - persist_to_workspace: |
| 98 | + root: /tmp |
| 99 | + paths: |
| 100 | + - project |
| 101 | + lint: |
| 102 | + <<: *defaults |
| 103 | + docker: |
| 104 | + - image: circleci/node:latest |
| 105 | + steps: |
| 106 | + # Restore project state |
| 107 | + - attach_workspace: |
| 108 | + at: /tmp |
| 109 | + - run: |
| 110 | + name: Node.js Version |
| 111 | + command: node --version |
| 112 | + - run: |
| 113 | + name: NPM Version |
| 114 | + command: npm --version |
| 115 | + - run: |
| 116 | + name: Install any remaining dependencies |
| 117 | + command: npm install |
| 118 | + - run: |
| 119 | + name: Lint code |
| 120 | + command: npm run lint |
| 121 | + stable: |
| 122 | + <<: *defaults |
| 123 | + beta: |
| 124 | + <<: *defaults |
| 125 | + docker: |
| 126 | + - image: arcanemagus/atom-docker-ci:beta |
| 127 | + |
| 128 | +workflows: |
| 129 | + version: 2 |
| 130 | + test_package: |
| 131 | + jobs: |
| 132 | + - checkout_code |
| 133 | + - lint: |
| 134 | + requires: |
| 135 | + - checkout_code |
| 136 | + - stable: |
| 137 | + requires: |
| 138 | + - lint |
| 139 | + - beta: |
| 140 | + requires: |
| 141 | + - lint |
0 commit comments