Skip to content

Commit 35111b9

Browse files
authored
Merge pull request #48 from DannyBen/add/schema-test
Add runfile task and workflow test for JSON schema
2 parents 74e29c6 + 7753528 commit 35111b9

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,35 @@ jobs:
3030

3131
- name: Run tests
3232
run: bundle exec rspec
33+
34+
json_schema:
35+
name: Validate JSON schema
36+
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v3
42+
43+
# Rush needed for easy installation of check-jsonschema
44+
- name: Install rush
45+
run: curl -Ls http://get.dannyb.co/rush/setup | bash
46+
47+
- name: Connect rush repo
48+
run: rush clone dannyben --shallow --default
49+
50+
- name: Install check-jsonschema
51+
run: rush get check-jsonschema
52+
53+
# libyaml needed for Ruby's YAML library
54+
- name: Install OS dependencies
55+
run: sudo apt-get -y install libyaml-dev
56+
57+
- name: Setup Ruby
58+
uses: ruby/setup-ruby@v1
59+
with:
60+
ruby-version: '3.1'
61+
bundler-cache: true
62+
63+
- name: Test schema
64+
run: bundle exec run schema

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/Gemfile.lock
99
/gems
1010
/spec/tmp
11+
/debug.runfile
1112
/tmp
12-
/toc.txt
13-
debug.rb
1413
out.sh

Runfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ require 'completely/version'
33

44
title "Completely Developer Toolbelt"
55
summary "Runfile tasks for building the Completely gem"
6-
version Completely::VERSION
76

87
import_gem 'runfile-tasks/gem'
98
import_gem 'runfile-tasks/docker', image: 'dannyben/completely', version: Completely::VERSION
9+
10+
help 'Test the completely JSON schema'
11+
action :schema do
12+
file = 'lib/completely/templates/sample.yaml'
13+
command = "check-jsonschema --schemafile schemas/completely.json #{file}"
14+
say "\n$ check-jsonschema bb`#{file}`"
15+
success = system command
16+
exit 1 unless success
17+
end
18+

0 commit comments

Comments
 (0)