summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-07-01 13:12:54 -0700
committerTim Smith <tsmith@chef.io>2021-07-01 13:12:54 -0700
commitcf65546a6f3f30794e75144ee9b4044d2ae9d16a (patch)
tree3967aab3f3e6237e4a94108494c76a988fd3d275 /.github
parente42c8ad83026972d2cff044013f2f8c59ba9d8c7 (diff)
downloadchef-cf65546a6f3f30794e75144ee9b4044d2ae9d16a.tar.gz
Move some testing to GitHub actions
This matches what we're doing in master. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/func_spec.yml25
-rw-r--r--.github/workflows/kitchen.yml126
-rw-r--r--.github/workflows/lint.yml36
-rw-r--r--.github/workflows/unit_specs.yml26
4 files changed, 213 insertions, 0 deletions
diff --git a/.github/workflows/func_spec.yml b/.github/workflows/func_spec.yml
new file mode 100644
index 0000000000..b01314345a
--- /dev/null
+++ b/.github/workflows/func_spec.yml
@@ -0,0 +1,25 @@
+---
+name: func_spec
+
+"on":
+ pull_request:
+ push:
+ branches:
+ - chef-16
+
+jobs:
+ choco:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-2019, windows-2016]
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
+ ruby: [2.7, '3.0']
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.ruby }}
+ bundler-cache: true
+ - run: bundle exec rspec spec/functional/resource/chocolatey_package_spec.rb
diff --git a/.github/workflows/kitchen.yml b/.github/workflows/kitchen.yml
new file mode 100644
index 0000000000..60666183fa
--- /dev/null
+++ b/.github/workflows/kitchen.yml
@@ -0,0 +1,126 @@
+---
+name: kitchen
+
+"on":
+ pull_request:
+ push:
+ branches:
+ - chef-16
+
+jobs:
+ windows:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-2019, windows-2016]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - name: 'Install Chef/Ohai from Omnitruck'
+ id: install_chef
+ run: |
+ . { Invoke-WebRequest -useb https://omnitruck.chef.io/install.ps1 } | Invoke-Expression; Install-Project -project chef -channel current
+ $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
+ chef-client -v
+ ohai -v
+ rake --version
+ bundle -v
+ - name: 'Upgrade Chef/Ohai via Appbundler'
+ id: upgrade
+ run: |
+ $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
+ $env:OHAI_VERSION = ( Select-String -Path .\Gemfile.lock -Pattern '(?<=ohai \()\d.*(?=\))' | ForEach-Object { $_.Matches[0].Value } )
+ gem install appbundler appbundle-updater --no-doc
+ appbundle-updater chef chef $env:GITHUB_SHA --tarball --github chef/chef
+ Write-Output "Installed Chef / Ohai release:"
+ chef-client -v
+ ohai -v
+ - name: 'Run end_to_end::default recipe'
+ id: run
+ run: |
+ cd kitchen-tests
+ $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
+ bundle config set without 'omnibus_package'
+ bundle install --jobs=3 --retry=3 --path=vendor/bundle
+ gem install berkshelf --no-doc
+ # berks emits a ruby warning when it loads net/http due to a previously
+ # defined constant. Even though it is just a warning, powershell immediately
+ # exits 1. I'm not sure why but this just suppresses the warnings.
+ $env:RUBYOPT="-W0"
+ berks vendor cookbooks
+ # restore the default warning level
+ $env:RUBYOPT="-W1"
+ chef-client -z -o end_to_end --chef-license accept-no-persist
+
+ macos:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-10.15] # macos-11.0 is not public for now
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - name: 'Install Chef/Ohai from Omnitruck'
+ id: install_chef
+ run: |
+ brew install coreutils
+ curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current
+ /opt/chef/bin/chef-client -v
+ /opt/chef/bin/ohai -v
+ /opt/chef/embedded/bin/rake --version
+ /opt/chef/embedded/bin/bundle -v
+ - name: 'Upgrade Chef/Ohai via Appbundler'
+ id: upgrade
+ run: |
+ OHAI_VERSION=$(sed -n '/ohai .[0-9]/{s/.*(//;s/)//;p;}' Gemfile.lock)
+ sudo /opt/chef/embedded/bin/gem install appbundler appbundle-updater --no-doc
+ sudo /opt/chef/embedded/bin/appbundle-updater chef chef $GITHUB_SHA --tarball --github chef/chef
+ echo "Installed Chef / Ohai release:"
+ /opt/chef/bin/chef-client -v
+ /opt/chef/bin/ohai -v
+ - name: 'Run end_to_end::default recipe'
+ id: run
+ run: |
+ cd kitchen-tests
+ sudo /opt/chef/embedded/bin/bundle config set without 'omnibus_package'
+ sudo /opt/chef/embedded/bin/bundle install --jobs=3 --retry=3 --path=vendor/bundle
+ sudo /opt/chef/embedded/bin/gem install berkshelf --no-doc
+ sudo /opt/chef/embedded/bin/berks vendor cookbooks
+ sudo /opt/chef/bin/chef-client -z -o end_to_end --chef-license accept-no-persist
+
+ linux:
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - 'amazonlinux-2'
+ - 'centos-6'
+ - 'centos-7'
+ - 'centos-8'
+ - 'debian-9'
+ - 'debian-10'
+ - 'debian-11'
+ - 'fedora-latest'
+ - 'opensuse-leap-15'
+ - 'oraclelinux-7'
+ - 'oraclelinux-8'
+ - 'ubuntu-1804'
+ - 'ubuntu-2004'
+ - 'ubuntu-2104'
+ runs-on: ubuntu-latest
+ env:
+ FORCE_FFI_YAJL: ext
+ CHEF_LICENSE: accept-no-persist
+ steps:
+ - name: Check out code
+ uses: actions/checkout@master
+ - name: Setup Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: "3.0"
+ bundler-cache: true
+ working-directory: kitchen-tests
+ - name: Run Test Kitchen
+ working-directory: kitchen-tests
+ run: |
+ bundle exec kitchen test end-to-end-${{ matrix.os }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000000..e5377e001a
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,36 @@
+---
+name: lint
+
+"on":
+ pull_request:
+ push:
+ branches:
+ - chef-16
+
+jobs:
+ chefstyle:
+ runs-on: ubuntu-latest
+ env:
+ BUNDLE_WITHOUT: ruby_shadow:omnibus_package
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 2.7
+ bundler-cache: true
+ - uses: r7kamura/rubocop-problem-matchers-action@v1 # this shows the failures in the PR
+ - run: bundle exec chefstyle -c .rubocop.yml
+
+ spellcheck:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: carlosperate/download-file-action@v1.0.3
+ id: download-custom-dictionary
+ with:
+ file-url: 'https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt'
+ file-name: 'chef_dictionary.txt'
+ - uses: zwaldowski/cspell-action@v1
+ with:
+ config: cspell.json
+ paths: "**/*"
diff --git a/.github/workflows/unit_specs.yml b/.github/workflows/unit_specs.yml
new file mode 100644
index 0000000000..42ef6be4f9
--- /dev/null
+++ b/.github/workflows/unit_specs.yml
@@ -0,0 +1,26 @@
+---
+name: unit_specs
+
+"on":
+ pull_request:
+ push:
+ branches:
+ - chef-16
+
+jobs:
+ unit:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-10.15] # macos-11.0 is not public for now
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
+ ruby: ['3.0']
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.ruby }}
+ bundler-cache: true
+ - run: bundle exec rake spec:unit
+ - run: bundle exec rake component_specs