Code consistency #93
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: Lint & Check the Profile | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
validate: | |
name: Lint | |
runs-on: ubuntu-latest | |
env: | |
CHEF_LICENSE: accept-silent | |
CHEF_LICENSE_KEY: ${{ secrets.SAF_CHEF_LICENSE_KEY }} | |
KITCHEN_LOCAL_YAML: kitchen.ec2.yml | |
LC_ALL: "en_US.UTF-8" | |
steps: | |
- name: add needed packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Clone full repository so we can push | |
run: git fetch --prune --unshallow | |
- name: Set short git commit SHA | |
id: vars | |
run: | | |
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | |
- name: Confirm git commit SHA output | |
run: echo ${{ env.COMMIT_SHORT_SHA }} | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1" | |
- name: Disable ri and rdoc | |
run: 'echo "gem: --no-ri --no-rdoc" >> ~/.gemrc' | |
- name: Run Bundle Install | |
run: bundle install | |
- name: Installed Inspec | |
run: bundle exec inspec version | |
- name: Vendor the Profile | |
run: bundle exec inspec vendor . --overwrite | |
- name: Check the Inspec profile | |
run: bundle exec rake inspec:check | |
- name: Lint the Profile | |
run: bundle exec rake lint |