Skip to content

Commit

Permalink
BAM: Updated gempush.yml to run tests and linting on PRs (#567)
Browse files Browse the repository at this point in the history
* BAM: Updated gempush.yml to run tests and linting on PRs

* BAM: Updated list of events to run workflow on

* BAM: Moving tests and linting to it's own workflow to run on master and PRs

* Trigger Build

* Adjust workflow name, add back tests to primary workflow

* Restrict permissions on linting workflow

* Trigger Build

* BAM: Attempting to call a workflow from a workflow

* BAM: Fix needs statement

* BAM: Adding  to tests-linting

* BAM: Removing requirement for secrets

Co-authored-by: Kevin Formsma <kevin.formsma@gmail.com>
  • Loading branch information
benniemosher and arothian authored Oct 29, 2021
1 parent 1893b15 commit f4b78de
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 41 deletions.
44 changes: 3 additions & 41 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,12 @@ env:
docker_org: stelligent

jobs:
commit:
name: Commit
runs-on: ubuntu-latest
strategy:
fail-fast: false # Allows both ruby versions to run before failing
matrix:
ruby: ['2.5', '3.0']

steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Rubocop lint
run: bundle exec rubocop -D
- name: Rspec tests
run: bundle exec rspec --require spec_helper spec
- name: Duplicate rule check
run: bundle exec ./bin/cfn_nag_rules

acceptance:
name: Acceptance
runs-on: ubuntu-latest
strategy:
fail-fast: false # Allows both ruby versions to run before failing
matrix:
ruby: ['2.5', '3.0']

steps:
# is this the same commit hash we saw in commit?
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: e2e
run: bash ./scripts/setup_and_run_end_to_end_tests.sh

tests-linting:
uses: stelligent/cfn_nag/.github/workflows/tests-linting.yml@master
release:
name: Release
runs-on: ubuntu-latest
needs: [commit, acceptance]
needs: [tests-linting]
steps:
# is this the same commit hash we saw in commit?
- uses: actions/checkout@v2
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/tests-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: test-lint

on:
workflow_call:
push:
branches: [ master ]
pull_request:
branches: [ master ]

permissions:
contents: read

env:
docker_org: stelligent

jobs:
tests-linting:
name: Tests & Linting
runs-on: ubuntu-latest
strategy:
fail-fast: false # Allows both ruby versions to run before failing
matrix:
ruby: ['2.5', '3.0']

steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Rubocop lint
run: bundle exec rubocop -D
- name: Rspec tests
run: bundle exec rspec --require spec_helper spec
- name: Duplicate rule check
run: bundle exec ./bin/cfn_nag_rules

acceptance:
name: Acceptance
runs-on: ubuntu-latest
strategy:
fail-fast: false # Allows both ruby versions to run before failing
matrix:
ruby: ['2.5', '3.0']

steps:
# is this the same commit hash we saw in commit?
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: e2e
run: bash ./scripts/setup_and_run_end_to_end_tests.sh

0 comments on commit f4b78de

Please sign in to comment.