From feb9c6f23173aabec52ac720a5f18b77f0ef031d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 23 Feb 2021 15:10:04 +0100 Subject: [PATCH] Update Github Actions workflow This applies the lessons learned while applying this to Voxpupuli and The Foreman orgs. --- .github/workflows/acceptance.yml | 69 ------------------ .github/workflows/ci.yml | 79 ++++++++++++++++++++ .github/workflows/cron.yml | 119 ------------------------------- .github/workflows/unit.yml | 44 ------------ .sync.yml | 5 -- Gemfile | 1 + 6 files changed, 80 insertions(+), 237 deletions(-) delete mode 100644 .github/workflows/acceptance.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/cron.yml delete mode 100644 .github/workflows/unit.yml delete mode 100644 .sync.yml diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml deleted file mode 100644 index de71a214..00000000 --- a/.github/workflows/acceptance.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Acceptance tests - -on: pull_request - -jobs: - build_cache: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: "2.7" - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-2.7-gems-acceptance-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-2.7-gems-acceptance- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development test' - bundle install --jobs 4 --retry 3 - - acceptance: - needs: build_cache - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - setfile: - - centos7-64{hostname=centos7-64.example.com} - - centos8-64{hostname=centos8-64.example.com} - puppet: - - "6" - - "5" - pulpcore_version: - - '3.9' - name: Puppet ${{ matrix.puppet }} - Pulp ${{ matrix.pulpcore_version }} - ${{ matrix.setfile }} - steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: "2.7" - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-2.7-gems-acceptance-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-2.7-gems-acceptance- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development test' - bundle install --jobs 4 --retry 3 - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: puppet${{ matrix.puppet }} - BEAKER_setfile: ${{ matrix.setfile }} - BEAKER_FACTER_PULPCORE_VERSION: ${{ matrix.pulpcore_version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..030abbbc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: CI + +on: + pull_request: + schedule: + - cron: '4 4 * * *' + +jobs: + setup_matrix: + if: github.event_name != 'schedule' || github.repository_owner == 'theforeman' + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + outputs: + beaker_setfiles: ${{ steps.get_outputs.outputs.beaker_setfiles }} + puppet_major_versions: ${{ steps.get_outputs.outputs.puppet_major_versions }} + puppet_unit_test_matrix: ${{ steps.get_outputs.outputs.puppet_unit_test_matrix }} + env: + BUNDLE_WITHOUT: development:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run rake check + run: bundle exec rake check + - name: Run rake validate + run: bundle exec rake validate + - name: Run rake lint + run: bundle exec rake lint + - name: Setup Test Matrix + id: get_outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "${{ matrix.puppet }}.0" + name: Unit / Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake parallel_spec + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} + puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + name: Acceptance / ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 67e1cfc4..00000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Nightly tests - -on: - schedule: - - cron: '4 4 * * *' - -jobs: - unit: - if: github.repository == 'theforeman/puppet-pulpcore' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ruby: - - "2.5" - - "2.4" - puppet: - - "6" - - "5" - exclude: - - ruby: "2.5" - puppet: "5" - - ruby: "2.4" - puppet: "6" - env: - PUPPET_VERSION: "${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-unit-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-unit- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development system_tests' - bundle install --jobs 4 --retry 3 - - name: Run tests - run: bundle exec rake - - build_cache: - if: github.repository == 'theforeman/puppet-pulpcore' - runs-on: ubuntu-latest - steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: "2.7" - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-2.7-gems-acceptance-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-2.7-gems-acceptance- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development test' - bundle install --jobs 4 --retry 3 - - acceptance: - if: github.repository == 'theforeman/puppet-pulpcore' - needs: build_cache - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - setfile: - - centos7-64{hostname=centos7-64.example.com} - - centos8-64{hostname=centos8-64.example.com} - puppet: - - "6" - - "5" - pulpcore_version: - - '3.6' - - '3.7' - name: Puppet ${{ matrix.puppet }} - Pulp ${{ matrix.pulpcore_version }} - ${{ matrix.setfile }} - steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: "2.7" - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-2.7-gems-acceptance-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-2.7-gems-acceptance- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development test' - bundle install --jobs 4 --retry 3 - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: puppet${{ matrix.puppet }} - BEAKER_setfile: ${{ matrix.setfile }} - BEAKER_FACTER_PULPCORE_VERSION: ${{ matrix.pulpcore_version }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml deleted file mode 100644 index 432fb745..00000000 --- a/.github/workflows/unit.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Unit tests - -on: pull_request - -jobs: - unit: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ruby: - - "2.5" - - "2.4" - puppet: - - "6" - - "5" - exclude: - - ruby: "2.5" - puppet: "5" - - ruby: "2.4" - puppet: "6" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - env: - PUPPET_VERSION: "${{ matrix.puppet }}.0" - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-unit-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.puppet }}-${{ matrix.ruby }}-gems-unit- - - name: Install dependencies - run: | - gem install bundler - bundle config path vendor/bundle - bundle config without 'development system_tests' - bundle install --jobs 4 --retry 3 - - name: Run tests - run: bundle exec rake diff --git a/.sync.yml b/.sync.yml deleted file mode 100644 index 3d9d53b9..00000000 --- a/.sync.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -.travis.yml: - beaker_sets: - - centos7-64 - - centos8-64 diff --git a/Gemfile b/Gemfile index 18972489..0d3481b7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]} gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]} gem 'voxpupuli-test', '~> 1.4' gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]} +gem 'puppet_metadata', '~> 0.3' gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]} gem 'voxpupuli-acceptance', '~> 0.3', {"groups"=>["system_tests"]}