Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MAINT) Stop running CI on draft PRs) #409

Closed
wants to merge 10 commits into from
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: "ci"

on:
pull_request:
branches:
- "main"
pull_request_review_comment:
types: [created]
workflow_dispatch:

jobs:
Spec:
if: ${{ github.repository_owner == 'puppetlabs' }}
if: |
github.repository_owner == 'puppetlabs' ||
contains(github.event.comment.body, 'ci run tests')
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
secrets: "inherit"

Acceptance:
if: ${{ github.repository_owner == 'puppetlabs' }}
needs: Spec
if: |
github.repository_owner == 'puppetlabs' ||
contains(github.event.comment.body, 'ci run tests')
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
with:
flags: "--provision-service"
Expand Down
31 changes: 6 additions & 25 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,14 @@ name: "Spec Tests"

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/**/*'
- 'spec/**/*'
- 'lib/**/*'
- 'tasks/**/*'
- 'functions/**/*'
- 'types/**/*'
- 'plans/**/*'
- 'hiera/**/*'
- 'manifests/**/*'
- 'templates/**/*'
- 'files/**/*'
- 'metadata.json'
- 'Rakefile'
- 'Gemfile'
- 'provision.yaml'
- '.rspec'
- '.rubocop.yml'
- '.puppet-lint.rc'
- '.fixtures.yml'
pull_request_review_comment:
types: [created]

jobs:
setup_matrix:
if: contains(github.event.comment.body, 'ci run tests')
name: "Setup Test Matrix"
runs-on: ubuntu-20.04
outputs:
Expand Down Expand Up @@ -70,7 +52,7 @@ jobs:
name: "Spec Tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
needs:
- setup_matrix
if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }}
if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }} && ${{ github.event.pull_request.draft == false }}

runs-on: ubuntu-20.04
strategy:
Expand All @@ -79,7 +61,7 @@ jobs:

env:
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main'
FACTER_GEM_VERSION: "https://github.com/puppetlabs/facter#main"

steps:
- run: |
Expand All @@ -100,7 +82,6 @@ jobs:
bundle env
echo ::endgroup::


- name: Run parallel_spec tests
run: |
bundle exec rake parallel_spec
34 changes: 12 additions & 22 deletions .github/workflows/test-fips-install-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,22 @@
name: "Install fips test matrix"

on:
pull_request:
paths:
- ".github/workflows/**/*"
- "spec/**/*"
- "lib/**/*"
- "tasks/**/*"
- "functions/**/*"
- "types/**/*"
- "plans/**/*"
- "hiera/**/*"
- "manifests/**/*"
- "templates/**/*"
- "files/**/*"
- "metadata.json"
- "Rakefile"
- "Gemfile"
- "provision.yaml"
- ".rspec"
- ".rubocop.yml"
- ".puppet-lint.rc"
- ".fixtures.yml"
branches: [main]
pull_request_review_comment:
types: [created]
workflow_dispatch: {}

jobs:
echo:
name: "Echo comment"
runs-on: ubuntu-20.04
steps:
- name: "Echo comment"
run: |
echo ::group::info:comment
echo "${{ github.event.comment.body }}"
echo ::endgroup::
test-install:
if: contains(github.event.comment.body, '/test-install')
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }} with fips ${{ matrix.fips }}"
runs-on: ubuntu-20.04
env:
Expand Down
25 changes: 3 additions & 22 deletions .github/workflows/test-install-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,13 @@
name: "Install test matrix"

on:
pull_request:
paths:
- ".github/workflows/**/*"
- "spec/**/*"
- "lib/**/*"
- "tasks/**/*"
- "functions/**/*"
- "types/**/*"
- "plans/**/*"
- "hiera/**/*"
- "manifests/**/*"
- "templates/**/*"
- "files/**/*"
- "metadata.json"
- "Rakefile"
- "Gemfile"
- "provision.yaml"
- ".rspec"
- ".rubocop.yml"
- ".puppet-lint.rc"
- ".fixtures.yml"
branches: [main]
pull_request_review_comment:
types: [created]
workflow_dispatch: {}

jobs:
test-install:
if: contains(github.event.comment.body, 'ci run tests')
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
runs-on: ubuntu-20.04
env:
Expand Down
52 changes: 16 additions & 36 deletions .github/workflows/test-upgrade-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,36 @@
name: "Upgrade test matrix"

on:
pull_request:
paths:
- '.github/workflows/**/*'
- 'spec/**/*'
- 'lib/**/*'
- 'tasks/**/*'
- 'functions/**/*'
- 'types/**/*'
- 'plans/**/*'
- 'hiera/**/*'
- 'manifests/**/*'
- 'templates/**/*'
- 'files/**/*'
- 'metadata.json'
- 'Rakefile'
- 'Gemfile'
- 'provision.yaml'
- '.rspec'
- '.rubocop.yml'
- '.puppet-lint.rc'
- '.fixtures.yml'

branches: [main]
pull_request_review_comment:
types: [created]
workflow_dispatch: {}

jobs:
test-upgrade:
if: contains(github.event.comment.body, 'ci run tests')
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
BOLT_DISABLE_ANALYTICS: true
LANG: 'en_US.UTF-8'
LANG: "en_US.UTF-8"
strategy:
fail-fast: false
matrix:
architecture:
- 'standard'
- 'extra-large-with-dr'
- "standard"
- "extra-large-with-dr"
version:
- '2019.8.12'
- "2019.8.12"
version_to_upgrade:
- '2021.7.4'
- "2021.7.4"
image:
- 'almalinux-cloud/almalinux-8'
- "almalinux-cloud/almalinux-8"
download_mode:
- 'direct'
- "direct"

steps:
- name: 'Start SSH session'
- name: "Start SSH session"
if: ${{ github.event.inputs.ssh-debugging == 'true' }}
uses: luchihoratiu/debug-via-ssh@main
with:
Expand All @@ -74,7 +54,7 @@ jobs:
bundle env
echo ::endgroup::

- name: 'Provision test cluster'
- name: "Provision test cluster"
timeout-minutes: 15
run: |
echo ::group::prepare
Expand All @@ -101,7 +81,7 @@ jobs:
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
echo ::endgroup::

- name: 'Install PE on test cluster'
- name: "Install PE on test cluster"
timeout-minutes: 120
run: |
bundle exec bolt plan run peadm_spec::install_test_cluster \
Expand All @@ -110,7 +90,7 @@ jobs:
architecture=${{ matrix.architecture }} \
version=${{ matrix.version }}

- name: 'Wait as long as the file ${HOME}/pause file is present'
- name: "Wait as long as the file ${HOME}/pause file is present"
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
run: |
while [ -f "${HOME}/pause" ] ; do
Expand All @@ -119,7 +99,7 @@ jobs:
done
echo "${HOME}/pause absent, continuing workflow."

- name: 'Upgrade PE on test cluster'
- name: "Upgrade PE on test cluster"
timeout-minutes: 120
run: |
bundle exec bolt plan run peadm_spec::upgrade_test_cluster \
Expand All @@ -129,7 +109,7 @@ jobs:
download_mode=${{ matrix.download_mode }} \
version=${{ matrix.version_to_upgrade }}

- name: 'Tear down test cluster'
- name: "Tear down test cluster"
if: ${{ always() }}
continue-on-error: true
run: |
Expand Down