Skip to content

Commit c33d740

Browse files
authored
CST framework Change (#12)
* framework change * vresion bump
1 parent 2b46e0f commit c33d740

File tree

3 files changed

+12
-185
lines changed

3 files changed

+12
-185
lines changed

.circleci/config.yml

Lines changed: 10 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -1,202 +1,29 @@
11
version: 2.1
22

3-
# Declare the orbs that we'll use in our config.
4-
# read more about orbs: https://circleci.com/docs/2.0/using-orbs/
53
orbs:
64
ruby: circleci/[email protected]
5+
node: circleci/node@2
6+
cst: cst/framework@1
77

8-
common_envs: &common_envs
9-
environment:
10-
APP_BUNDLER_VERSION: "2.3.8"
11-
REDIS_URL: "redis://127.0.0.1"
12-
13-
executors:
14-
gem:
15-
parameters:
16-
ruby-version:
17-
default: "3.0.0"
18-
type: string
19-
docker:
20-
- image: cimg/ruby:<< parameters.ruby-version >>
21-
- image: circleci/redis:6.0
22-
23-
<<: *common_envs
24-
25-
commands:
26-
bundler-preamble:
27-
description: "Install ruby and the Gemfile dependencies"
28-
parameters:
29-
ruby-version:
30-
type: string
31-
default: "3"
32-
description: "Ruby Gem version"
33-
key-name:
34-
type: string
35-
default: ""
36-
description: Custom name to add to the cache key
37-
cache-breaker:
38-
type: string
39-
default: "0"
40-
description: "Cache breaker to force new cache instantiation"
41-
keep-lock-file:
42-
type: boolean
43-
default: false
44-
description: "Retain lock file when bit is set to true. Otherwise generate a new one specific for this build"
45-
steps:
46-
- checkout
47-
- attach_workspace:
48-
at: workspace
49-
- unless:
50-
condition:
51-
equal: [ true, << parameters.keep-lock-file >> ]
52-
steps:
53-
- run:
54-
name: Remove Gemfile.lock
55-
command: rm Gemfile.lock
56-
- restore_cache:
57-
key: bundle-<< parameters.ruby-version >>-<< parameters.key-name >>-{{ checksum "Gemfile" }}-<< parameters.cache-breaker >>
58-
- ruby/install-deps:
59-
path: vendor/bundle
60-
with-cache: false
61-
- run:
62-
name: "Update dependencies"
63-
command: bundle update
64-
- save_cache:
65-
key: bundle-<< parameters.ruby-version >>-<< parameters.key-name >>-{{ checksum "Gemfile" }}-<< parameters.cache-breaker >>
66-
paths:
67-
- vendor/bundle
68-
69-
jobs:
70-
publish-rubygems:
71-
executor: gem
72-
steps:
73-
- bundler-preamble:
74-
keep-lock-file: true
75-
- run:
76-
name: Publish to Ruby Gems
77-
command: |
78-
if [ -z "$GEM_HOST_API_KEY" ]; then
79-
echo 'Environment variable GEM_HOST_API_KEY is not present'
80-
exit 1
81-
fi
82-
gem_output=$(gem build json_schematize.gemspec)
83-
VERSION=$(printf "$gem_output" | awk '/Version: / {print $2}')
84-
FILE=$(printf "$gem_output" | awk '/File: / {print $2}')
85-
86-
gem push ${FILE}
87-
88-
publish-github:
89-
executor: gem
90-
steps:
91-
- bundler-preamble:
92-
keep-lock-file: true
93-
- run:
94-
name: 'Get Go'
95-
command: |
96-
sudo apt-get update -qq
97-
sudo apt-get -y --no-install-recommends install golang-go
98-
- run:
99-
name: 'Set Git stats'
100-
command: |
101-
git config user.name $GITHUB_USER
102-
git config user.email $GITHUB_EMAIL
103-
- run:
104-
name: Publish Git Release
105-
command: |
106-
curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xz -f - -C . ghr_v0.13.0_linux_amd64/ghr
107-
mv ghr_v0.13.0_linux_amd64/ghr .
108-
rm -rf ghr_v0.13.0_linux_amd64
109-
chmod 0755 ghr
110-
111-
if [ -z "$GITHUB_TOKEN" ]; then
112-
echo 'Environment variable GITHUB_TOKEN is not present'
113-
exit 1
114-
fi
115-
116-
if [ -z "$GITHUB_USER" ]; then
117-
echo 'Environment variable GITHUB_USER is not present'
118-
exit 1
119-
fi
120-
121-
if [ $(git tag -l "$VERSION") ]; then
122-
echo "Pre existing version $VERSION, not tagging."
123-
exit 0
124-
fi
125-
126-
gem_output=$(gem build json_schematize.gemspec)
127-
VERSION=$(printf "$gem_output" | awk '/Version: / {print $2}')
128-
FILE=$GEM_PATH$(printf "$gem_output" | awk '/File: / {print $2}')
129-
130-
git tag -a $VERSION -m "$VERSION"
131-
132-
SHA=$(git rev-parse HEAD)
133-
./ghr -soft -t ${GITHUB_TOKEN} -u ${GITHUB_USER} -r json_schematize -c ${SHA} ${VERSION} ${FILE}
134-
135-
test:
136-
parameters:
137-
ruby-version:
138-
default: "3.0.0"
139-
type: string
140-
description: "Ruby version to test against"
141-
executor:
142-
name: gem
143-
ruby-version: << parameters.ruby-version >>
144-
steps:
145-
- bundler-preamble:
146-
ruby-version: "<< parameters.ruby-version >>"
147-
- run:
148-
name: Setup Climate Control test-reporter
149-
command: |
150-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
151-
chmod +x ./cc-test-reporter
152-
- run:
153-
name: Waiting for Redis to be ready
154-
command: |
155-
for i in `seq 1 10`;
156-
do
157-
nc -z localhost 6379 && echo Success && exit 0
158-
echo -n .
159-
sleep 1
160-
done
161-
echo Failed waiting for Redis to be available && exit 1
162-
- run:
163-
name: Run and Report tests
164-
command: |
165-
./cc-test-reporter before-build
166-
SIMPLE_COV_RUN=true bundle exec rspec --format RspecJunitFormatter --out test-results/rspec/rspec.xml --format progress --color
167-
- when:
168-
condition:
169-
equal:
170-
[
171-
required-test-ruby2.7.5,
172-
required-test-ruby<< parameters.ruby-version >>,
173-
]
174-
steps:
175-
- run:
176-
name: Report CodeClimate Coverage
177-
command: ./cc-test-reporter after-build --coverage-input-type simplecov
1788
workflows:
1799
version: 2
18010
yeet-le-jobs:
18111
jobs:
182-
- test:
12+
- cst/enforce-gem-version-bump
13+
- cst/rspec-ruby:
14+
rspec-system-args: "SIMPLE_COV_RUN=true"
15+
cc-report-collect-ruby: "2.7.5"
18316
matrix:
18417
parameters:
18518
ruby-version: ["2.7.5" , "3.0.0", "3.0.3"]
18619
alias: required-matrix-tests
187-
name: required-test-ruby<< matrix.ruby-version >>
188-
- publish-github:
189-
requires:
190-
- required-matrix-tests
191-
filters:
192-
branches:
193-
only:
194-
- main
195-
- publish-rubygems:
20+
name: test-ruby<< matrix.ruby-version >>
21+
- cst/publish-gem:
22+
publish-git: true
23+
publish-default-gem: true
19624
requires:
19725
- required-matrix-tests
19826
filters:
19927
branches:
20028
only:
20129
- main
202-

lib/json_schematize/cache/class_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def cached_items(key_includes: nil)
6565

6666
serialized_string = redis_client.get(key)
6767
Marshal.load(serialized_string)
68-
end
68+
end.compact
6969
end
7070

7171
def clear_cache!

lib/json_schematize/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module JsonSchematize
4-
VERSION = "0.6.1"
4+
VERSION = "0.6.2"
55
end

0 commit comments

Comments
 (0)