|
| 1 | +version: 2 |
| 2 | + |
| 3 | +defaults: &defaults |
| 4 | + working_directory: /tmp/project |
| 5 | + docker: |
| 6 | + - image: circleci/node:latest |
| 7 | + environment: |
| 8 | + CIRCLE_BUILD_IMAGE: ubuntu |
| 9 | + ATOM_CHANNEL: stable |
| 10 | + DISPLAY: :99 |
| 11 | + |
| 12 | +jobs: |
| 13 | + checkout_code: |
| 14 | + <<: *defaults |
| 15 | + steps: |
| 16 | + - checkout |
| 17 | + - run: |
| 18 | + name: Download Atom test script |
| 19 | + command: curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh |
| 20 | + - run: |
| 21 | + name: Make Atom script executable |
| 22 | + command: chmod u+x build-package.sh |
| 23 | + - run: |
| 24 | + name: Download Hadolint |
| 25 | + command: git clone https://github.com/lukasmartinelli/hadolint |
| 26 | + # Restore node_modules from the last build |
| 27 | + - restore_cache: |
| 28 | + keys: |
| 29 | + # Get latest cache for this package.json |
| 30 | + - v2-dependencies-{{ checksum "package.json" }} |
| 31 | + # Fallback to the last available cache |
| 32 | + - v2-dependencies |
| 33 | + # Save project state for next steps |
| 34 | + - persist_to_workspace: |
| 35 | + root: /tmp |
| 36 | + paths: |
| 37 | + - project |
| 38 | + |
| 39 | + stable: |
| 40 | + <<: *defaults |
| 41 | + steps: |
| 42 | + # Restore project state |
| 43 | + - attach_workspace: |
| 44 | + at: /tmp |
| 45 | + - run: |
| 46 | + name: Update APT |
| 47 | + command: sudo apt-get update |
| 48 | + # Install some pre-requisite packages and missing dependencies from the atom package |
| 49 | + - run: |
| 50 | + name: Atom Prerequisites |
| 51 | + command: sudo apt-get --assume-yes --quiet --no-install-suggests --no-install-recommends install sudo xvfb libxss1 libasound2 |
| 52 | + # Fire up a VFB to run Atom in |
| 53 | + - run: |
| 54 | + name: Create VFB for Atom to run in |
| 55 | + command: /usr/bin/Xvfb $DISPLAY -ac -screen 0 1280x1024x16 |
| 56 | + background: true |
| 57 | + - run: |
| 58 | + name: Install Haskell |
| 59 | + command: sudo apt-get --assume-yes --quiet --no-install-suggests install haskell-platform |
| 60 | + - run: |
| 61 | + name: Install Stack |
| 62 | + command: curl -sSL https://get.haskellstack.org/ | sh |
| 63 | + - run: |
| 64 | + name: Add directory to PATH |
| 65 | + command: echo 'export PATH=~/.local/bin:$PATH' >> $BASH_ENV |
| 66 | + - run: |
| 67 | + name: Print PATH |
| 68 | + command: echo $PATH |
| 69 | + - run: |
| 70 | + name: Install Dependency Hadolint |
| 71 | + command: cd hadolint && /usr/local/bin/stack install --install-ghc hadolint |
| 72 | + - run: |
| 73 | + name: Haskell version |
| 74 | + command: ghc --version |
| 75 | + - run: |
| 76 | + name: Hadolint version |
| 77 | + command: hadolint --version |
| 78 | + - run: |
| 79 | + name: Atom test |
| 80 | + command: ./build-package.sh |
| 81 | + # Cache node_modules |
| 82 | + - save_cache: |
| 83 | + paths: |
| 84 | + - node_modules |
| 85 | + key: v2-dependencies-{{ checksum "package.json" }} |
| 86 | + |
| 87 | + beta: |
| 88 | + <<: *defaults |
| 89 | + environment: |
| 90 | + ATOM_CHANNEL: beta |
| 91 | + steps: |
| 92 | + # Restore project state |
| 93 | + - attach_workspace: |
| 94 | + at: /tmp |
| 95 | + - run: |
| 96 | + name: Update APT |
| 97 | + command: sudo apt-get update |
| 98 | + # Install some pre-requisite packages and missing dependencies from the atom package |
| 99 | + - run: |
| 100 | + name: Atom Prerequisites |
| 101 | + command: sudo apt-get --assume-yes --quiet --no-install-suggests --no-install-recommends install sudo xvfb libxss1 libasound2 |
| 102 | + # Fire up a VFB to run Atom in |
| 103 | + - run: |
| 104 | + name: Create VFB for Atom to run in |
| 105 | + command: /usr/bin/Xvfb $DISPLAY -ac -screen 0 1280x1024x16 |
| 106 | + background: true |
| 107 | + - run: |
| 108 | + name: Install Haskell |
| 109 | + command: sudo apt-get --assume-yes --quiet --no-install-suggests install haskell-platform |
| 110 | + - run: |
| 111 | + name: Install Stack |
| 112 | + command: curl -sSL https://get.haskellstack.org/ | sh |
| 113 | + - run: |
| 114 | + name: Add directory to PATH |
| 115 | + command: echo 'export PATH=~/.local/bin:$PATH' >> $BASH_ENV |
| 116 | + - run: |
| 117 | + name: Print PATH |
| 118 | + command: echo $PATH |
| 119 | + - run: |
| 120 | + name: Install Dependency Hadolint |
| 121 | + command: cd hadolint && /usr/local/bin/stack install --install-ghc hadolint |
| 122 | + - run: |
| 123 | + name: Haskell version |
| 124 | + command: ghc --version |
| 125 | + - run: |
| 126 | + name: Hadolint version |
| 127 | + command: hadolint --version |
| 128 | + - run: |
| 129 | + name: Atom test |
| 130 | + command: ./build-package.sh |
| 131 | + |
| 132 | +workflows: |
| 133 | + version: 2 |
| 134 | + test_package: |
| 135 | + jobs: |
| 136 | + - checkout_code |
| 137 | + - stable: |
| 138 | + requires: |
| 139 | + - checkout_code |
| 140 | + - beta: |
| 141 | + requires: |
| 142 | + - checkout_code |
0 commit comments