Skip to content

Commit 8e6d2bc

Browse files
authored
Merge pull request #76 from clojure-tw/migration-to-circleci2.0
Migration to circleci2.0
2 parents 440d6a5 + e85f026 commit 8e6d2bc

File tree

3 files changed

+142
-33
lines changed

3 files changed

+142
-33
lines changed

.circleci/config.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# This configuration was automatically generated from a CircleCI 1.0 config.
2+
# It should include any build commands you had along with commands that CircleCI
3+
# inferred from your project structure. We strongly recommend you read all the
4+
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
5+
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
6+
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
7+
# configuration as a reference rather than using it in production, though in most
8+
# cases it should duplicate the execution of your original 1.0 config.
9+
version: 2
10+
jobs:
11+
build:
12+
working_directory: ~/clojure-tw/weekly
13+
parallelism: 1
14+
shell: /bin/bash --login
15+
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
16+
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
17+
environment:
18+
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
19+
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
20+
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
21+
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
22+
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
23+
# We have selected a pre-built image that mirrors the build environment we use on
24+
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
25+
# of each job. For more information on choosing an image (or alternatively using a
26+
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
27+
# To see the list of pre-built images that CircleCI provides for most common languages see
28+
# https://circleci.com/docs/2.0/circleci-images/
29+
docker:
30+
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
31+
32+
steps:
33+
# Machine Setup
34+
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
35+
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
36+
- checkout
37+
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
38+
# In many cases you can simplify this from what is generated here.
39+
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
40+
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
41+
# This is based on your 1.0 configuration file or project settings
42+
- run:
43+
working_directory: ~/clojure-tw/weekly
44+
command: 'echo ''Asia/Taipei'' | sudo tee -a /etc/timezone; sudo dpkg-reconfigure -f noninteractive tzdata; '
45+
- run:
46+
working_directory: ~/clojure-tw/weekly
47+
command: sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0" >> $BASH_ENV
48+
# Dependencies
49+
# This would typically go in either a build or a build-and-test job when using workflows
50+
# Restore the dependency cache
51+
- restore_cache:
52+
keys:
53+
# This branch if available
54+
- v1-dep-{{ .Branch }}-
55+
# Default branch if not
56+
- v1-dep-master-
57+
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
58+
- v1-dep-
59+
# This is based on your 1.0 configuration file or project settings
60+
- run: wget -O lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
61+
- run: chmod 755 lein
62+
- run: ./lein -v
63+
- run: ./lein deps
64+
- run: npm install
65+
# The following line was run implicitly in your 1.0 builds based on what CircleCI inferred about the structure of your project. In 2.0 you need to be explicit about which commands should be run. In some cases you can discard inferred commands if they are not relevant to your project.
66+
- run: if [ -z "${NODE_ENV:-}" ]; then export NODE_ENV=test; fi
67+
- run: export PATH="~/clojure-tw/weekly/node_modules/.bin:$PATH"
68+
- run: npm install
69+
- run: lein deps
70+
# Save dependency cache
71+
- save_cache:
72+
key: v1-dep-{{ .Branch }}-{{ epoch }}
73+
paths:
74+
# This is a broad list of cache paths to include many possible development environments
75+
# You can probably delete some of these entries
76+
- vendor/bundle
77+
- ~/virtualenvs
78+
- ~/.m2
79+
- ~/.ivy2
80+
- ~/.bundle
81+
- ~/.go_workspace
82+
- ~/.gradle
83+
- ~/.cache/bower
84+
# These cache paths were specified in the 1.0 config
85+
- ~/.m2
86+
- ~/.lein
87+
- ./node_modules
88+
# Test
89+
# This would typically be a build job when using workflows, possibly combined with build
90+
# This is based on your 1.0 configuration file or project settings
91+
- run: ./lein run
92+
# Deployment
93+
# Your existing circle.yml file contains deployment steps.
94+
# The config translation tool does not support translating deployment steps
95+
# since deployment in CircleCI 2.0 are better handled through workflows.
96+
# See the documentation for more information https://circleci.com/docs/2.0/workflows/
97+
# Teardown
98+
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
99+
# Save test results
100+
- store_test_results:
101+
path: /tmp/circleci-test-results
102+
# Save artifacts
103+
- store_artifacts:
104+
path: /tmp/circleci-artifacts
105+
- store_artifacts:
106+
path: /tmp/circleci-test-results
107+
108+
deploy:
109+
working_directory: ~/clojure-tw/weekly
110+
docker:
111+
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
112+
steps:
113+
- checkout
114+
- restore_cache:
115+
keys:
116+
- v1-dependencies-{{ checksum "project.clj" }}
117+
# fallback to using the latest cache if no exact match is found
118+
- v1-dependencies-
119+
- run:
120+
command: sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0" >> $BASH_ENV
121+
# This is based on your 1.0 configuration file or project settings
122+
- run: sudo apt-get install curl && curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - && sudo apt-get install -y nodejs
123+
- run: wget -O lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
124+
- run: chmod 755 lein
125+
- run: ./lein -v
126+
- run: ./lein deps
127+
- run: npm install
128+
- run: ./lein run
129+
- run: sed -i 's%https://${GH_TOKEN}@${GH_REF}%[email protected]:clojure-tw/weekly.git%g' deploy.sh
130+
- run: ./deploy.sh
131+
132+
workflows:
133+
version: 2
134+
ci:
135+
jobs:
136+
- build
137+
- deploy:
138+
filters:
139+
branches:
140+
only: master
141+
requires:
142+
- build

circle.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

deploy.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ mkdir $OUT
2121
cp -R ./build/dist/* $OUT
2222
cp ./resources/public/weekly/*.xml $OUT
2323
cp ./resources/assets/google9d6ebc58aae14a99.html $OUT
24-
cp -f circle.yml $OUT
2524
if hash html-minifier; then
2625
html-minifier --input-dir $OUT --output-dir $OUT --collapse-whitespace --file-ext html
2726
fi

0 commit comments

Comments
 (0)