|
1 | | -version: 2.1 |
2 | | - |
3 | | -workflows: |
4 | | - version: 2 |
5 | | - |
6 | | - # The build workflow will build a preview for the site, intended for PRs |
7 | | - # don't need to build gh-pages only other branches |
8 | | - build: |
9 | | - jobs: |
10 | | - - build-site: |
11 | | - filters: |
12 | | - branches: |
13 | | - ignore: gh-pages |
14 | | - |
15 | | -install: &install |
16 | | - name: install dependencies for build |
17 | | - command: | |
18 | | - $HOME/conda/bin/pip install -r ~/repo/.circleci/requirements.txt |
19 | | -
|
20 | | -install_python_3: &install_python_3 |
21 | | - name: install Python 3.5 dependencies |
22 | | - command: | |
23 | | - ls $HOME |
24 | | - if [ ! -d "/home/circleci/conda" ]; then |
25 | | - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh |
26 | | - /bin/bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/conda |
27 | | - export PATH=$HOME/conda/bin:$PATH |
28 | | - else |
29 | | - echo "Miniconda 3 is already installed, continuing to build." |
30 | | - fi |
31 | | -build_jekyll: &build_jekyll |
32 | | - name: Jekyll Build |
33 | | - command: | |
34 | | - if [ -z "$CIRCLECI_TRIGGER" ]; then |
35 | | - echo "Building EASI Site for Preview" |
36 | | - cp ~/repo/.circleci/circle_urls.sh ~/repo/circle_urls.sh |
37 | | - cd ~/repo |
38 | | - chmod u+x circle_urls.sh |
39 | | - bash circle_urls.sh |
40 | | - cat _config.yml |
41 | | - bundle install |
42 | | - bundle exec jekyll build |
43 | | - else |
44 | | - echo "Triggered by something else." |
45 | | - fi |
46 | | -jobs: |
47 | | - build-site: |
48 | | - docker: |
49 | | - - image: cimg/ruby:3.1 |
50 | | - working_directory: ~/repo |
51 | | - environment: |
52 | | - - JEKYLL_ENV: production |
53 | | - - NOKOGIRI_USE_SYSTEM_LIBRARIES: true |
54 | | - - BUNDLE_PATH: ~/repo/vendor/bundle |
55 | | - steps: |
56 | | - - run: |
57 | | - name: Checkout code (HTTPS Fallback) |
58 | | - command: | |
59 | | - git init |
60 | | - git remote add origin https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git |
61 | | - git fetch --depth=1 origin ${CIRCLE_SHA1} |
62 | | - git checkout -b ${CIRCLE_BRANCH:-main} FETCH_HEAD |
63 | | - - restore_cache: |
64 | | - keys: |
65 | | - - v1-dependencies |
66 | | - - rubygems-v1 |
67 | | - - run: *install_python_3 |
68 | | - - run: *install |
69 | | - - save_cache: |
70 | | - paths: |
71 | | - - /home/circleci/conda |
72 | | - key: v1-dependencies |
73 | | - - run: |
74 | | - name: Bundle Install |
75 | | - command: | |
76 | | - cd ~/repo |
77 | | - bundle install |
78 | | - bundle check || bundle install |
79 | | - - save_cache: |
80 | | - key: rubygems-v1 |
81 | | - paths: |
82 | | - - vendor/bundle |
83 | | - #Removing test job |
84 | | - - run: *build_jekyll |
85 | | - - store_artifacts: |
86 | | - path: ~/repo/_site |
87 | | - destination: adaptiveexperiments.github.io |
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +workflows: |
| 4 | + version: 2 |
| 5 | + build: |
| 6 | + jobs: |
| 7 | + - build-site: |
| 8 | + filters: |
| 9 | + branches: |
| 10 | + ignore: gh-pages # Only build previews for non-production branches |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-site: |
| 14 | + docker: |
| 15 | + - image: cimg/ruby:3.2 |
| 16 | + working_directory: ~/repo |
| 17 | + environment: |
| 18 | + - JEKYLL_ENV: production |
| 19 | + - NOKOGIRI_USE_SYSTEM_LIBRARIES: true |
| 20 | + - BUNDLE_PATH: ~/repo/vendor/bundle |
| 21 | + steps: |
| 22 | + - run: |
| 23 | + name: Install system dependencies |
| 24 | + command: | |
| 25 | + apt-get update && apt-get install -y jq # For circle_urls.sh |
| 26 | + - run: |
| 27 | + name: Checkout code |
| 28 | + command: | |
| 29 | + git init |
| 30 | + git remote add origin https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git |
| 31 | + git fetch --depth=1 origin ${CIRCLE_SHA1} |
| 32 | + git checkout -b ${CIRCLE_BRANCH:-main} FETCH_HEAD |
| 33 | + - restore_cache: |
| 34 | + keys: |
| 35 | + - rubygems-v1-{{ checksum "Gemfile.lock" }} |
| 36 | + - run: |
| 37 | + name: Bundle Install |
| 38 | + command: | |
| 39 | + cd ~/repo |
| 40 | + bundle install |
| 41 | + bundle check || bundle install |
| 42 | + - save_cache: |
| 43 | + key: rubygems-v1-{{ checksum "Gemfile.lock" }} |
| 44 | + paths: |
| 45 | + - vendor/bundle |
| 46 | + - run: |
| 47 | + name: Install Python dependencies (if needed) |
| 48 | + command: | |
| 49 | + pip install -r .circleci/requirements.txt # Simplified; remove if pyaml isn't used |
| 50 | + - run: |
| 51 | + name: Prepare URLs for preview |
| 52 | + command: | |
| 53 | + if [ -z "$CIRCLECI_TRIGGER" ]; then |
| 54 | + cp .circleci/circle_urls.sh circle_urls.sh |
| 55 | + chmod +x circle_urls.sh |
| 56 | + bash circle_urls.sh |
| 57 | + fi |
| 58 | + - run: |
| 59 | + name: Jekyll Build |
| 60 | + command: | |
| 61 | + bundle exec jekyll build --trace # Added --trace for better error logging |
| 62 | + - store_artifacts: |
| 63 | + path: ~/repo/_site |
| 64 | + destination: adaptiveexperiments.github.io |
0 commit comments