forked from italia/developers.italia.it
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
169 lines (148 loc) · 4.71 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Javascript Node CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/reference-2-1/#section=configuration for more details
version: 2.1
references:
working_directory: /tmp/developers
load_image: &load_image
docker:
- image: cimg/ruby:2.6.5-node
env_vars_test: &env_vars_test
environment:
- JEKYLL_ENV: "production"
- NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"
- ELASTICSEARCH_URL: "" # Disable searchyll for test.
env_vars_prod: &env_vars_prod
environment:
- JEKYLL_ENV: "production"
- NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"
install_dependencies: &install_dependencies
run:
name: install-dependencies
command: |
make include-npm-deps
make bundle-install-deployment
sudo apt-get update && sudo apt install gawk
# Browser dependencies for pa11y
sudo apt-get install -y \
wget gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 \
libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
save_cache_node_modules: &save_cache_node_modules
save_cache:
key: v1-node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules
save_cache_bundle: &save_cache_bundle
save_cache:
key: v2-bundle-{{ checksum "Gemfile.lock" }}
paths:
- /home/circleci/project/vendor/ruby
restore_cache_node_modules: &restore_cache_node_modules
restore_cache:
keys:
- v1-node-modules-{{ checksum "package-lock.json" }}
- v1-node-modules-
restore_cache_bundle: &restore_cache_bundle
restore_cache:
keys:
- v2-bundle-{{ checksum "Gemfile.lock" }}
- v2-bundle-
download_data: &download_data
run:
name: download-data
command: |
make download-data
build_bundle_jekyll: &build_bundle_jekyll
run:
name: build-bundle-jekyll
command: |
make jekyll-build
make test
setup_ssh_gh_pages: &setup_ssh_gh_pages
add_ssh_keys:
fingerprints:
# gh-pages deployment key from circle-ci config
- 2b:10:c1:0f:c8:d7:d3:8b:2a:22:ea:09:a1:95:ce:d0
publish_changes_gh_pages: &publish_changes_gh_pages
run:
name: publish_changes_gh_pages
command: |
cp -r .well-known _site/
# Make GitHub skip its Jekyll support and serve all the files
# we built with our own Jekyll. This includes dotfiles.
touch _site/.nojekyll
npm run deploy -- --dotfiles -m "Automated deployment: ${CIRCLE_SHA1} [ci skip]"
# In order to use this, the integration needs to be
# setup first under CircleCI app directory and a
# SLACK_WEBOOK environment variable needs to be set
# in the project settings
notify_on_failure: ¬ify_on_failure
slack/status:
fail_only: true
only_for_branches: master
jobs:
test:
<<: *load_image
<<: *env_vars_test
steps:
- checkout
- << : *restore_cache_node_modules
- << : *restore_cache_bundle
- << : *install_dependencies
- << : *save_cache_node_modules
- << : *save_cache_bundle
- << : *download_data
- << : *build_bundle_jekyll
build_and_deploy_gh_pages:
<<: *load_image
<<: *env_vars_prod
steps:
- checkout
- << : *restore_cache_node_modules
- << : *restore_cache_bundle
- << : *install_dependencies
- << : *save_cache_node_modules
- << : *save_cache_bundle
- << : *download_data
- << : *build_bundle_jekyll
- << : *setup_ssh_gh_pages
- << : *publish_changes_gh_pages
- << : *notify_on_failure
orbs:
slack: circleci/[email protected]
workflows:
# Every night, deploy to VMs and to gh-pages
# to make sure latest data are shown
daily-build-and-deploy:
triggers:
- schedule:
cron: "0 6 * * *"
filters:
branches:
only:
- master
jobs:
- build_and_deploy_gh_pages
# For any branch other than master,
# run CI tests at each commit
on-commit-test:
jobs:
- test:
filters:
branches:
ignore:
- master
- gh-pages
# For each commit on the master branch
# deploy to VMs and to gh-pages
on-commit-build-and-deploy:
jobs:
- build_and_deploy_gh_pages:
filters:
branches:
only:
- master