-
Notifications
You must be signed in to change notification settings - Fork 30
143 lines (138 loc) · 5.62 KB
/
build.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
name: Build and test inspec_tools
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
fetch-depth: 0
- name: Fetch all tags for versioning
run: git fetch origin +refs/tags/*:refs/tags/*
- name: Setup Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install bundler and git-lite-version-bump
run: gem install bundler git-lite-version-bump
- name: Run bundle install
run: bundle install
- name: Generate mapping objects
run: bundle exec rake generate_mapping_objects
- name: Run rubocop
run: bundle exec rubocop
- name: Run bundle-audit
run: bundle-audit check --update
- name: Build inspec_tools gem
run: gem build inspec_tools.gemspec
- name: Upload inspec_tools gem
uses: actions/upload-artifact@v2
with:
name: inspec_tools_gem
path: inspec_tools-*.gem
test-gem:
needs: build
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
ruby: [ 2.7 ]
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Ruby ${{matrix.ruby}}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
- uses: actions/checkout@v2
with:
lfs: true
fetch-depth: 0
- name: Download inspec_tools gem
uses: actions/download-artifact@v2
with:
name: inspec_tools_gem
- name: Install inspec_tools gem
run: gem install inspec_tools-*.gem
- name: Run installed inspec_tools
run: |
inspec_tools --version
inspec_tools --help
inspec_tools xlsx2inspec -m examples/xlsx2inspec/mapping.cis.yml -x examples/cis.xlsx -p xlsx2inspec_test -o xlsx2inspec_test
inspec_tools summary -j examples/sample_json/rhel-simp.json
inspec_tools csv2inspec -c examples/csv2inspec/stig.csv -m examples/csv2inspec/mapping.yml -o csv2inspec_test
inspec_tools xccdf2inspec -x examples/xccdf2inspec/xccdf.xml -a lib/data/attributes.yml -o xccdf2inspec_test
inspec_tools xccdf2inspec -x examples/xccdf2inspec/data/U_JBOSS_EAP_6-3_STIG_V1R2_Manual-xccdf.xml -o xccdf2inspec_replace_test -r JBOSS_HOME
inspec_tools pdf2inspec -p examples/CIS_Ubuntu_Linux_16.04_LTS_Benchmark_v1.0.0.pdf -o pdf2inspec_test
inspec_tools inspec2csv -j examples/sample_json/rhel-simp.json -o inspec2csv_test.csv
inspec_tools inspec2ckl -j examples/sample_json/rhel-simp.json -o inspec2ckl_test_1.ckl
inspec_tools inspec2ckl -j test/data/inspec_1.json -o test/data/inspec2ckl_test_2.ckl
inspec_tools inspec2xccdf -j examples/sample_json/rhel-simp.json -a lib/data/attributes.yml -o inspec2xccdf_test.xml
inspec_tools inspec2xccdf -j examples/sample_json/rhel-simp.json -a examples/inspec2xccdf/xccdf_compliant_attribute.json -m examples/inspec2xccdf/metadata.json -o inspec2xccdf_11_1.xml
inspec_tools inspec2xccdf -j examples/sample_json/inspec-v4.28.0.json -a examples/inspec2xccdf/xccdf_compliant_attribute.json -o inspec2xccdf_11_2.xml
inspec_tools compliance -j examples/sample_json/single_control_results.json -f examples/sample_yaml/threshold.yaml
env:
CHEF_LICENSE: "accept"
- name: Validate Output Profiles with inspec check
run: |
gem install inspec-bin
inspec check xlsx2inspec_test
inspec check csv2inspec_test
inspec check xccdf2inspec_test
inspec check xccdf2inspec_replace_test
inspec check pdf2inspec_test
env:
CHEF_LICENSE: "accept"
- name: Validate Output CKL with xmllint
if: matrix.platform == 'ubuntu-latest'
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: inspec2ckl_test_1.ckl
xml-schema-file: test/schemas/U_Checklist_Schema_V2-3.xsd
- name: Validate Output CKL with xmllint
if: matrix.platform == 'ubuntu-latest'
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: test/data/inspec2ckl_test_2.ckl
xml-schema-file: test/schemas/U_Checklist_Schema_V2-3.xsd
- name: Validate XCCDF 1.1 with xmllint (Inspec Version < 4.28)
if: matrix.platform == 'ubuntu-latest'
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: inspec2xccdf_11_1.xml
xml-schema-file: test/schemas/xccdf_114/xccdf-1.1.4.xsd
- name: Validate XCCDF 1.1 with xmllint (Inspec Version > 4.28)
if: matrix.platform == 'ubuntu-latest'
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: inspec2xccdf_11_2.xml
xml-schema-file: test/schemas/xccdf_114/xccdf-1.1.4.xsd
test:
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
ruby: [ 2.7 ]
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Ruby ${{matrix.ruby}}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
- uses: actions/checkout@v2
with:
lfs: true
fetch-depth: 0
- name: Install bundler and git-lite-version-bump
run: gem install bundler git-lite-version-bump
- name: Run bundle install
run: bundle install
- name: Generate mapping objects
run: bundle exec rake generate_mapping_objects
- name: Run rake test
run: bundle exec rake test