Update workflows to use artifact actions v4 and replace the archived workflow … #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Verify the Baseline using Docker | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
release: | |
types: | |
- published | |
jobs: | |
my-job: | |
defaults: | |
run: | |
shell: bash -l {0} | |
name: Validate my profile | |
runs-on: ubuntu-latest | |
env: | |
CHEF_LICENSE: accept-silent | |
KITCHEN_YAML: kitchen.docker.yml | |
strategy: | |
matrix: | |
suite: ["vanilla", "hardened"] | |
fail-fast: false | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.7" | |
- name: Setup caching | |
uses: actions/cache@v4 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Bundle install | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
bundle install | |
- name: Regenerate current `profile.json` | |
run: | | |
bundle exec inspec json . | jq . > profile.json | |
- name: Lint the Inspec profile | |
run: bundle exec inspec check . | |
- name: Test-Kitchen | |
run: | | |
mkdir results | |
bundle exec kitchen test --destroy=always ${{ matrix.suite }}-ubuntu-1804 || true | |
- name: Display our ${{ matrix.suite }} results summary | |
uses: mitre/saf_action@v1 | |
with: | |
command_string: "view:summary -i spec/results/${{ matrix.suite }}-test-result.json" | |
- name: Ensure the scan meets our ${{ matrix.suite }} results threshold | |
uses: mitre/saf_action@v1 | |
with: | |
command_string: "validate:threshold -i spec/results/${{ matrix.suite }}-test-result.json -F ${{ matrix.suite }}.threshold.yml" | |
- name: Save Test Result JSON | |
uses: actions/upload-artifact@v4 | |
with: | |
path: spec/results |