Skip to content

Commit acd4594

Browse files
author
Konstantin Gredeskoul
committed
Shell file cleanup/consolidation
* Run bin/ci on travis * Run rubocop via bazel also * Use individual gem dependencies
1 parent 48032c6 commit acd4594

File tree

19 files changed

+594
-295
lines changed

19 files changed

+594
-295
lines changed

.circleci/.bazelrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
build --verbose_failures --spawn_strategy=standalone --strategy=Genrule=standalone
1+
build --verbose_failures --spawn_strategy=standalone --strategy=Genrule=standalone --show_timestamps --show_progress --show_progress_rate_limit 0.5
22
test --spawn_strategy=standalone
33
common --color=yes
4-
test --verbose_failures --test_output=errors --test_verbose_timeout_warnings
4+
startup --max_idle_secs=1
5+
test --verbose_failures --test_output=errors --test_verbose_timeout_warnings --show_progress --show_progress_rate_limit 0.5
6+
run --verbose_failures --show_progress --show_progress_rate_limit 0.5

.circleci/config-cache-pre-gen.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
version: 2.1
2+
3+
jobs:
4+
generate_cache: &bazel_defaults
5+
working_directory: /home/circleci/repo
6+
resource_class: medium
7+
docker:
8+
- image: bazelruby/ruby-2.6.5
9+
environment:
10+
PATH: "/usr/local/bin:/usr/bin:/sbin:/opt/bin:/home/circleci/repo/bin:/bin:/sbin:/usr/sbin"
11+
BUNDLE_PATH: /home/circleci/.bundle_cache
12+
BAZEL_OPTS: "--host_jvm_args=-Xmx400m --host_jvm_args=-Xms400m"
13+
BAZEL_BUILD_OPTS: "--curses=no --verbose_failures --jobs 10"
14+
BAZEL_TEST_OPTS: "--verbose_failures --test_output=streamed --test_verbose_timeout_warnings "
15+
16+
steps:
17+
- checkout
18+
19+
- run:
20+
name: "Install ~/.bazelrc"
21+
command: |
22+
cp .circleci/.bazelrc ${HOME}
23+
24+
- run:
25+
name: "Setup"
26+
command: |
27+
/usr/bin/env bash bin/setup
28+
29+
- run:
30+
name: "Bazel Build All"
31+
command: bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} -- //...
32+
33+
- run:
34+
name: "Generate Cache SHA"
35+
command: |
36+
source bin/deps && bazel-sha > bazel.sha
37+
38+
- save_cache:
39+
paths:
40+
- /home/circleci/repo/bazel.sha
41+
- /home/circleci/.bazelrc
42+
key: v2-bazel-sha-{{ .Revision }}
43+
44+
- save_cache:
45+
paths:
46+
- /home/circleci/.cache/bazel/_bazel_circleci
47+
key: v2-bazel-deps-{{ checksum "bazel.sha" }}
48+
49+
rubocop:
50+
<<: *bazel_defaults
51+
52+
steps:
53+
- checkout
54+
55+
- restore_cache:
56+
keys:
57+
- v2-bazel-sha-{{ .Revision }}
58+
59+
- restore_cache:
60+
keys:
61+
- v2-bundle-deps-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
62+
63+
- run:
64+
name: Install Bundler
65+
command: |
66+
gem install bundler:2.0.2 --no-doc
67+
bundle install --jobs=4 --retry=3 --path ${BUNDLE_PATH}
68+
69+
- save_cache:
70+
paths:
71+
- /home/circleci/.bundle_cache
72+
key: v2-bundle-deps-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
73+
74+
- run:
75+
name: "Rubocop Style Check"
76+
command: bundle exec rubocop -E -P
77+
78+
bazel_build_workspace:
79+
<<: *bazel_defaults
80+
81+
steps:
82+
- checkout
83+
84+
- restore_cache:
85+
keys:
86+
- v2-bazel-sha-{{ .Revision }}
87+
88+
- restore_cache:
89+
keys:
90+
- v2-bazel-deps-{{ checksum "bazel.sha" }}
91+
92+
- run:
93+
name: "Setup"
94+
command: |
95+
/usr/bin/env bash bin/setup
96+
97+
- run:
98+
name: "Show Bazel Info"
99+
command: |
100+
/usr/bin/env bash bin/ci bazel-info
101+
102+
- run:
103+
name: "Bazel Build & Test Workspace"
104+
command: |
105+
/usr/bin/env bash bin/ci workspace
106+
107+
bazel_build_examples:
108+
<<: *bazel_defaults
109+
110+
steps:
111+
- checkout
112+
113+
- restore_cache:
114+
keys:
115+
- v2-bazel-sha-{{ .Revision }}
116+
- v2-bazel-deps-{{ checksum "bazel.sha" }}
117+
118+
- run:
119+
name: "Setup"
120+
command: |
121+
/usr/bin/env bash bin/setup
122+
123+
- run:
124+
name: "Bazel Examples Build"
125+
command: |
126+
(cd examples/simple_script && bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} -- //...)
127+
128+
- run:
129+
name: "Bazel Examples Test"
130+
command: |
131+
(cd examples/simple_script && bazel ${BAZEL_OPTS} test ${BAZEL_BUILD_OPTS} ${BAZEL_TEST_OPTS} -- //...)
132+
133+
- run:
134+
name: "Bazel Rubocop Test"
135+
command: |
136+
(cd examples/simple_script && bazel ${BAZEL_OPTS} run ${BAZEL_BUILD_OPTS} -- :rubocop)
137+
138+
buildifier:
139+
<<: *bazel_defaults
140+
141+
steps:
142+
- checkout
143+
144+
- restore_cache:
145+
keys:
146+
- v2-bazel-sha-{{ .Revision }}
147+
- v2-bazel-deps-{{ checksum "bazel.sha" }}
148+
149+
- run:
150+
name: "Setup"
151+
command: |
152+
/usr/bin/env bash bin/setup
153+
154+
- run:
155+
name: "Bazel Buildifier Build"
156+
command: |
157+
bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} :buildifier-check
158+
159+
- run:
160+
name: "Bazel Buildifier Run"
161+
command: |
162+
bazel ${BAZEL_OPTS} run ${BAZEL_BUILD_OPTS} :buildifier-check
163+
164+
workflows:
165+
rules_ruby:
166+
jobs:
167+
- generate_cache
168+
- bazel_build_workspace:
169+
requires:
170+
- generate_cache
171+
- bazel_build_examples:
172+
requires:
173+
- generate_cache
174+
- buildifier:
175+
requires:
176+
- generate_cache

.circleci/config.yml

Lines changed: 35 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
jobs:
4-
ruby_style: &bazel_defaults
4+
rubocop: &bazel_defaults
55
working_directory: /home/circleci/repo
66
resource_class: medium
77
docker:
@@ -15,145 +15,98 @@ jobs:
1515

1616
steps:
1717
- checkout
18-
- restore_cache:
19-
keys:
20-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
18+
2119
- run:
22-
name: Install Bundler
20+
name: "Install ~/.bazelrc and run setup"
2321
command: |
24-
gem install bundler:2.0.2 --no-doc
25-
bundle install --jobs=4 --retry=3 --path ${BUNDLE_PATH}
26-
27-
- save_cache:
28-
paths:
29-
- ${BUNDLE_PATH}
30-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
22+
cp .circleci/.bazelrc ${HOME}
23+
/usr/bin/env bash bin/setup
3124
3225
- run:
33-
name: Which everything?
26+
name: Install Bundler
3427
command: |
35-
set +e
36-
bundle -v
37-
ruby --version
38-
gcc --version | head -1
39-
cc --version | head -1
40-
openssl version
28+
gem install bundler:2.0.2 --no-doc
29+
bundle install --jobs=4 --retry=3 --path ${BUNDLE_PATH}
4130
4231
- run:
4332
name: "Rubocop Style Check"
4433
command: bundle exec rubocop -E -P
4534

46-
bazel_rules:
35+
bazel_build_workspace:
4736
<<: *bazel_defaults
4837

4938
steps:
5039
- checkout
51-
- restore_cache:
52-
keys:
53-
- v1-bazel-{{ checksum ".bazelversion" }}
54-
- run:
55-
name: "Custom Setup Script"
56-
command: |
57-
/usr/bin/env bash bin/setup-linux
58-
59-
- save_cache:
60-
paths:
61-
- ${BUNDLE_PATH}
62-
key: v1-bazel-{{ checksum ".bazelversion" }}
6340

6441
- run:
65-
name: "Install ~/.bazelrc"
42+
name: "Install ~/.bazelrc and run setup"
6643
command: |
6744
cp .circleci/.bazelrc ${HOME}
45+
/usr/bin/env bash bin/setup
6846
6947
- run:
7048
name: "Show Bazel Info"
7149
command: |
72-
bazel $BAZEL_OPTS version
73-
bazel $BAZEL_OPTS info
74-
bazel $BAZEL_OPTS fetch --curses=no -- "//ruby/..."
75-
(cd examples && bazel $BAZEL_OPTS fetch --curses=no -- "//...")
76-
77-
- run:
78-
name: "Bazel Rules Build"
79-
command: |
80-
bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} -- //...
50+
51+
/usr/bin/env bash bin/ci bazel-info
8152
8253
- run:
83-
name: "Bazel Rules Test"
54+
name: "Bazel Build & Test Workspace"
8455
command: |
85-
bazel ${BAZEL_OPTS} test ${BAZEL_BUILD_OPTS} ${BAZEL_TEST_OPTS} -- //...
56+
/usr/bin/env bash bin/ci workspace
8657
87-
bazel_examples:
58+
bazel_build_examples:
8859
<<: *bazel_defaults
8960

9061
steps:
9162
- checkout
9263

93-
- restore_cache:
94-
keys:
95-
- v1-bazel-{{ checksum ".bazelversion" }}
96-
9764
- run:
98-
name: "Custom Setup Script"
99-
command: |
100-
/usr/bin/env bash bin/setup-linux
101-
102-
- save_cache:
103-
paths:
104-
- ${BUNDLE_PATH}
105-
key: v1-bazel-{{ checksum ".bazelversion" }}
106-
107-
- run:
108-
name: "Install ~/.bazelrc"
65+
name: "Install ~/.bazelrc and run setup"
10966
command: |
11067
cp .circleci/.bazelrc ${HOME}
68+
/usr/bin/env bash bin/setup
11169
11270
- run:
113-
name: "Bazel Examples Build"
71+
name: "Bazel Simple Script Example Build"
11472
command: |
11573
(cd examples/simple_script && bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} -- //...)
11674
11775
- run:
118-
name: "Bazel Examples Test"
76+
name: "Bazel Simple Script Example Test"
11977
command: |
12078
(cd examples/simple_script && bazel ${BAZEL_OPTS} test ${BAZEL_BUILD_OPTS} ${BAZEL_TEST_OPTS} -- //...)
12179
122-
bazel_buildifier:
80+
- run:
81+
name: "Bazel Simple Script Example Rubocop Check"
82+
command: |
83+
(cd examples/simple_script && bazel ${BAZEL_OPTS} run ${BAZEL_BUILD_OPTS} -- :rubocop)
84+
85+
buildifier:
12386
<<: *bazel_defaults
12487

12588
steps:
12689
- checkout
12790

128-
- restore_cache:
129-
keys:
130-
- v1-bazel-{{ checksum ".bazelversion" }}
131-
13291
- run:
133-
name: "Custom Setup Script"
92+
name: "Install ~/.bazelrc and run setup"
13493
command: |
135-
/usr/bin/env bash bin/setup-linux
136-
137-
- save_cache:
138-
paths:
139-
- ${BAZEL_INSTALLER_DIR}
140-
key: v1-bazel-{{ checksum ".bazelversion" }}
94+
cp .circleci/.bazelrc ${HOME}
95+
/usr/bin/env bash bin/setup
14196
14297
- run:
143-
name: "Install ~/.bazelrc"
98+
name: "Bazel Buildifier Build"
14499
command: |
145-
cp .circleci/.bazelrc ${HOME}
100+
bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} :buildifier-check
146101
147102
- run:
148-
name: "Bazel Buildifier Check"
103+
name: "Bazel Buildifier Run"
149104
command: |
150-
bazel ${BAZEL_OPTS} build ${BAZEL_BUILD_OPTS} :buildifier-check
151105
bazel ${BAZEL_OPTS} run ${BAZEL_BUILD_OPTS} :buildifier-check
152106
153107
workflows:
154108
rules_ruby:
155109
jobs:
156-
- ruby_style
157-
- bazel_rules
158-
- bazel_examples
159-
- bazel_buildifier
110+
- bazel_build_workspace
111+
- bazel_build_examples
112+
- buildifier

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export BAZEL_INSTALLER_DIR="${BAZEL_INSTALLER_DIR:-"${HOME}/.bazel-installer-v$(cat .bazelversion)"}"
1+
# Sets environment for external programs
2+
export BUNDLE_PATH="${HOME}/.bundle/gems"

.envrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22

33
PATH_add bin
44

5-
source bin/deps
6-

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
**/bazel-*
22
**/.idea
3-
**/vendor/bundle
43
**/.bundle
5-
.DS_Store
4+
**/vendor/bundle/**
5+
**/.DS_Store
66
**/.vscode
7-

0 commit comments

Comments
 (0)