-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathconfig.yml
124 lines (120 loc) · 3.56 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
---
version: 2.1
commands:
run_with_languages:
description: "Run the given command in an environment that includes relevant langauges in the PATH"
parameters:
command:
type: string
description: "What command to execute"
label:
type: string
description: "What to label the run"
default: <<parameters.command>>
steps:
- run:
name: <<parameters.label>>
command: |
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PATH="${HOME}/.rbenv/bin:${HOME}/.rbenv/shims:${PATH}"
export PATH="${HOME}/project/node_modules/.bin:${PATH}"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
eval "$(rbenv init -)"
export BUNDLE_PATH=vendor/bundle
<<parameters.command>>
environment:
# https://app.circleci.com/pipelines/github/apiology/cookiecutter-pypackage/4/workflows/29074dc8-944c-4600-8aaa-5116575fed90/jobs/4
"LC_ALL": "C.UTF-8"
"LANG": "C.UTF-8"
set_up_environment:
description: "Install source environment"
steps:
- checkout
- run: |
sed -E -e 's/quality \([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\)/quality (0.1.0)/g' \
Gemfile.lock > Gemfile.lock.deversioned
- restore_cache:
key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }}
- restore_cache:
key: wheels-v2-{{ checksum "requirements_dev.txt" }}
- run:
name: Initialize packages
command: |
export BUNDLE_PATH=vendor/bundle
'./fix.sh'
- run:
name: Verify Gemfile.lock
command: |
if ! git diff --exit-code Gemfile.lock
then
>&2 echo "Please resolve changes to Gemfile.lock after bundle install to avoid caching difficulties"
exit 1
fi
- save_cache:
key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }}
paths:
- "vendor/bundle"
- save_cache:
key: wheels-v2-{{ checksum "requirements_dev.txt" }}
paths:
- "/home/circleci/.cache/pip/wheels"
- run:
name: Download new circleci tool
command: |
curl -fLSs \
https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash
quality:
description: "Run quality"
steps:
- set_up_environment
- run_with_languages:
label: Run quality
command: |
bundle exec rake quality
jobs:
quality:
working_directory: ~/quality
docker:
- image: apiology/circleci-ruby:latest
steps:
- when:
condition:
equal: [<< pipeline.git.branch >>, "main"]
steps:
- quality
- unless:
condition:
equal: [<< pipeline.git.branch >>, "main"]
steps:
- run: echo "quality only runs on main branch"
build:
working_directory: ~/quality
docker:
- image: apiology/circleci-ruby:latest
steps:
- set_up_environment
- run_with_languages:
label: test
command: make citest cicoverage
# This seemed to shave 5ish% of the build time off when added
resource_class: large
workflows:
version: 2
weekly:
triggers:
- schedule:
cron: "0 0 * * 6"
filters:
branches:
only:
- main
jobs:
- build
- quality
quality:
jobs:
- quality
build:
jobs:
- build