aeedc15d4b12617656217cfd3fb034d8be971c28
[ghc.git] / .circleci / config.yml
1 version: 2
2
3 aliases:
4   - &defaults
5     working_directory: ~/ghc
6
7   # Make sure we have proper openssh before checkout: CircleCI git
8   # does not check the repository out properly without it and also
9   # takes 20 times longer than it should be.
10   - &precheckout
11     run:
12       name: Install OpenSSH client
13       command: |
14         apt-get update -qq
15         apt-get install -qy openssh-client
16   - &prepare
17     run:
18       name: prepare-system
19       command: .circleci/prepare-system.sh
20   - &submodules
21     run:
22       name: submodules
23       command: .circleci/fetch-submodules.sh
24   - &buildenv
25     THREADS: 3
26     SKIP_PERF_TESTS: YES
27     VERBOSE: 2
28   - &boot
29     run:
30       name: Boot
31       command: ./boot
32   - &configure_unix
33     run:
34       name: Configure
35       command: ./configure
36   - &configure_bsd
37     run:
38       name: Configure
39       command: ./configure --target=x86_64-unknown-freebsd10
40   - &configure_unreg
41     run:
42       name: Configure
43       command: ./configure --enable-unregisterised
44   - &make
45     run:
46       name: Build
47       command: "make -j$THREADS"
48   - &test
49     run:
50       name: Test
51       command: make test
52   - &bindist
53     run:
54       name: Create bindist
55       command: make binary-dist
56       # Building bindist takes ~15 minutes without output, account for
57       # that.
58       no_output_timeout: "30m"
59   - &collectartifacts
60     run:
61       name: Collect artifacts
62       # We need this because CircleCI expects a path without
63       # wildcards but bindist archive name is not static
64       command: |
65         mkdir -p /tmp/artifacts
66         pwd
67         find .
68         cp ghc*.tar.xz /tmp/artifacts
69   - &storeartifacts
70     store-artifacts:
71       path: /tmp/artifacts
72
73 jobs:
74   "validate-x86_64-linux":
75     resource_class: xlarge
76     docker:
77       - image: haskell:8.2
78     environment:
79       <<: *buildenv
80     steps:
81       - *precheckout
82       - checkout
83       - *prepare
84       - *submodules
85       - *boot
86       - *configure_unix
87       - *make
88       - *test
89       - *bindist
90       - *collectartifacts
91       - *storeartifacts
92
93   "validate-x86_64-freebsd":
94     resource_class: xlarge
95     docker:
96       - image: tweag/toolchain-x86_64-freebsd
97     environment:
98       TARGET: FreeBSD
99       <<: *buildenv
100     steps:
101       - *precheckout
102       - checkout
103       - *prepare
104       - *submodules
105       - *boot
106       - *configure_bsd
107       - *make
108       - *test
109       - *bindist
110       - *collectartifacts
111       - *storeartifacts
112
113   "validate-x86_64-darwin":
114     macos:
115       xcode: "9.0"
116     environment:
117       <<: *buildenv
118     steps:
119       - checkout
120       - *prepare
121       - *submodules
122       - *boot
123       - *configure_unix
124       - *make
125       - *test
126       - *bindist
127       # Disabled due to CircleCI brokenness
128       #- *collectartifacts
129       #- *storeartifacts
130
131   "validate-x86_64-linux-unreg":
132     resource_class: xlarge
133     docker:
134       - image: haskell:8.2
135     environment:
136       <<: *buildenv
137     steps:
138       - *precheckout
139       - checkout
140       - *prepare
141       - *submodules
142       - *boot
143       - *configure_unreg
144       - *make
145       - *test
146
147 workflows:
148   version: 2
149   validate:
150     jobs:
151     - validate-x86_64-linux
152     # FreeBSD disabled: https://github.com/haskell/unix/issues/102
153     # - validate-x86_64-freebsd
154     - validate-x86_64-darwin
155
156   nightly:
157     triggers:
158       - schedule:
159           cron: "0 0 * * *"
160           filters:
161             branches:
162               only:
163                 - master
164     jobs:
165     - validate-x86_64-linux-unreg
166
167 notify:
168   webhooks:
169     - url: https://phabricator.haskell.org/harbormaster/hook/circleci/