forked from dependabot/dependabot-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
126 lines (110 loc) · 4.42 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
version: 2
jobs:
reorg_build:
docker:
# Any image that includes the docker client will do
- image: circleci/ruby
steps:
- checkout
- setup_remote_docker
- run:
name: Log in to the Docker registry
command: docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
- run:
name: Generate branch tag (cache key for Docker images)
command: |
BRANCH_TAG="$(echo $CIRCLE_BRANCH | sed -E 's/[^A-Za-z0-9]+/-/g')"
echo "export BRANCH_TAG='$BRANCH_TAG'" >> $BASH_ENV
- run:
name: Pull Docker base images & warm Docker cache
command: |
docker pull ubuntu:18.04
docker pull "dependabot/dependabot-core-ci:core--$BRANCH_TAG" ||
docker pull dependabot/dependabot-core:latest
docker pull "dependabot/dependabot-core-ci:ci--$BRANCH_TAG" ||
docker pull dependabot/dependabot-core-ci:ci--latest || true
- run:
name: Build dependabot-core image
command: |
docker build \
-t dependabot/dependabot-core:latest \
-t "dependabot/dependabot-core-ci:core--$BRANCH_TAG" \
--cache-from ubuntu:18.04 \
--cache-from "dependabot/dependabot-core-ci:core--$BRANCH_TAG" \
--cache-from dependabot/dependabot-core:latest \
.
- run:
name: Push dependabot-core image to CI cache repo
command: docker push "dependabot/dependabot-core-ci:core--$BRANCH_TAG"
- run:
name: Build dependabot-core-ci image
command: |
rm .dockerignore # we usually don't want tests etc, but here we do
docker build \
-t "dependabot/dependabot-core-ci:latest" \
-t "dependabot/dependabot-core-ci:ci--$BRANCH_TAG" \
-f Dockerfile.ci \
--cache-from ubuntu:18.04 \
--cache-from dependabot/dependabot-core:latest \
--cache-from "dependabot/dependabot-core-ci:ci--$BRANCH_TAG" \
--cache-from dependabot/dependabot-core-ci:latest \
.
- run:
name: Rubocop
command: |
docker run -ti dependabot/dependabot-core-ci \
bash -c "cd terraform && rubocop"
- run:
name: RSpec
command: |
docker run -ti dependabot/dependabot-core-ci \
bash -c "cd terraform && rspec spec --format documentation"
- run:
name: Push dependabot-core-ci image to CI cache repo
command: |
docker push "dependabot/dependabot-core-ci:ci--$BRANCH_TAG"
docker push "dependabot/dependabot-core-ci:latest"
build:
docker:
- image: dependabot/dependabot-core:0.1.47
working_directory: ~/dependabot-core
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ .Branch }}
- v1-dependencies-master
# Install dependencies
- run: bundle install --path ~/dependabot-core/vendor/bundle
- run: cd helpers/yarn && yarn install
- run: cd helpers/npm && yarn install
- run: cd helpers/php && composer install
- run: cd helpers/python && pyenv exec pip install -r requirements.txt && pyenv local 2.7.15 && pyenv exec pip install -r requirements.txt && pyenv local --unset
- run: cd helpers/elixir && mix deps.get
- run: cd helpers/go && make
- save_cache:
key: v1-dependencies-{{ .Branch }}-{{ epoch }}
paths:
- ~/dependabot-core/vendor/bundle
- ~/dependabot-core/helpers/yarn/node_modules
- ~/dependabot-core/helpers/npm/node_modules
- ~/dependabot-core/helpers/php/vendor
# Run code formatting linters
- run: bundle exec rubocop
- run: cd helpers/yarn && node_modules/.bin/eslint lib test bin
- run: cd helpers/npm && node_modules/.bin/eslint lib test bin
- run: cd helpers/php && vendor/bin/php-cs-fixer fix --dry-run
# Run tests
- run: cd helpers/yarn && node_modules/.bin/jest
- run: cd helpers/npm && node_modules/.bin/jest
- run: bundle exec rspec spec --format documentation --format RspecJunitFormatter -o ~/rspec/rspec.xml --tag "~skip_ci"
- store_test_results:
path: ~/rspec
- store_artifacts:
path: ~/rspec
workflows:
version: 2
test:
jobs:
- reorg_build
- build