diff options
author | John McCrae <john.mccrae@progress.com> | 2022-06-29 07:18:28 -0700 |
---|---|---|
committer | Thomas Powell <powell@progress.com> | 2022-08-23 11:08:51 -0400 |
commit | 2f5dbd1ee69c970fc06870477dbbca6c5c3555c4 (patch) | |
tree | de0dcdb7b443306b000d71f70d54bb08ff2d2e6f /.github | |
parent | 964236952f9fad2398a6a3a2501774e430b17b6d (diff) | |
download | chef-2f5dbd1ee69c970fc06870477dbbca6c5c3555c4.tar.gz |
Integrate ruby 3.1 into builds
This is a combination of 64 commits, the originals were mostly
repeating one-line messages so that history has not been kept here.
Signed-off-by: Thomas Powell <thomas.powell@progress.com>
Signed-off-by: Marc Paradise <marc@chef.io>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/func_spec.yml | 19 | ||||
-rw-r--r-- | .github/workflows/kitchen.yml | 156 | ||||
-rw-r--r-- | .github/workflows/lint.yml | 8 | ||||
-rw-r--r-- | .github/workflows/unit_specs.yml | 18 |
4 files changed, 140 insertions, 61 deletions
diff --git a/.github/workflows/func_spec.yml b/.github/workflows/func_spec.yml index 2247b414fd..3900bd1d00 100644 --- a/.github/workflows/func_spec.yml +++ b/.github/workflows/func_spec.yml @@ -14,27 +14,30 @@ jobs: matrix: os: [windows-2019, windows-2022] # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' - ruby: [2.7, '3.0'] + ruby: ['3.1'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - run: bundle exec rspec spec/functional/resource/chocolatey_package_spec.rb + bundler-cache: false + - run: | + bundle install + bundle exec rspec spec/functional/resource/chocolatey_package_spec.rb userdefaults: strategy: fail-fast: false matrix: - os: [macos-10.15, macos-11] + os: [macos-11, macos-12] # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' - ruby: [2.7, '3.0'] + ruby: ['3.1'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true + bundler-cache: false + - run: bundle install - run: bundle exec rspec spec/functional/resource/macos_userdefaults_spec.rb diff --git a/.github/workflows/kitchen.yml b/.github/workflows/kitchen.yml index 126c7a5e57..16c62eb285 100644 --- a/.github/workflows/kitchen.yml +++ b/.github/workflows/kitchen.yml @@ -13,45 +13,91 @@ jobs: fail-fast: false matrix: os: [windows-2022, windows-2019] + ruby: ['3.1'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 + - name: 'Upgrade Ruby Devkit on Windows' + id: upgrade_ruby + run: | + $pkg_version="3.1.2" + $pkg_revision="1" + $pkg_source="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-${pkg_version}-${pkg_revision}/rubyinstaller-devkit-${pkg_version}-${pkg_revision}-x64.exe" + + $old_version = Ruby --version + if(-not($old_version -match "3.1")){ + $ErrorActionPreference = 'Stop'; + Write-Output 'Downloading Ruby + DevKit'; + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; + $package_destination = "$env:temp\rubyinstaller-devkit-$pkg_version-$pkg_revision-x64.exe" + (New-Object System.Net.WebClient).DownloadFile($pkg_source, $package_destination); + Write-Output "Did the file download?" + $output = Get-ChildItem -Path $env:temp + Write-Output $output + Write-Output 'Installing Ruby + DevKit'; + Start-Process $package_destination -ArgumentList '/verysilent /dir=C:\ruby31' -Wait ; + Write-Output 'Cleaning up installation'; + Remove-Item $package_destination -Force; + Write-Output "Installing URU to manage Ruby Versions" + choco install 7zip -y + Write-Output "Downloading Uru Installer..." + New-Item -Path c:\uru_temp -Type Directory + # Use TLS 1.2 for Windows 2016 Server and older + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + Invoke-WebRequest -OutFile "c:\uru_temp\uru-0.8.5-windows-x86.7z" -Uri "https://bitbucket.org/jonforums/uru/downloads/uru-0.8.5-windows-x86.7z" + Write-Output "Installing Uru Ruby Switcher" + 7z x "c:\uru_temp\uru-0.8.5-windows-x86.7z" -o"C:\Program Files (x86)\Uru" + If ($lastexitcode -ne 0) { Exit $lastexitcode } + Start-Process "C:\Program Files (x86)\Uru\uru_rt.exe" -WorkingDirectory "C:\Program Files (x86)\Uru\" -ArgumentList 'admin install' -Wait + + Write-Output 'Updating PATH' + $env:PATH = "C:\Program Files (x86)\Uru;" + $env:PATH + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + + Write-Output "Register Installed Ruby Version 3.1 With Uru" + Start-Process "uru_rt.exe" -ArgumentList 'admin add C:\ruby31\bin' -Wait + uru 312 + if (-not $?) { throw "Can't Activate Ruby. Did Uru Registration Succeed?" } + ruby -v + if (-not $?) { throw "Can't run Ruby. Is it installed?" } + } + - 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 + $env:PATH = "C:\ruby31\bin;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 } ) + # - 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 } ) - # The chef-client installer does not put the file 'ansidecl.h' down in the correct location - # This leads to failures during testing. Moving that file to its correct position here. - # Another example of 'bad' that needs to be corrected - $output = gci -path C:\opscode\ -file ansidecl.h -Recurse - $target_path = $($output.Directory.Parent.FullName + "\x86_64-w64-mingw32\include") - Move-Item -Path $output.FullName -Destination $target_path + # # The chef-client installer does not put the file 'ansidecl.h' down in the correct location + # # This leads to failures during testing. Moving that file to its correct position here. + # # Another example of 'bad' that needs to be corrected + # $output = gci -path C:\opscode\ -file ansidecl.h -Recurse + # $target_path = $($output.Directory.Parent.FullName + "\x86_64-w64-mingw32\include") + # Move-Item -Path $output.FullName -Destination $target_path - gem install appbundler appbundle-updater --no-doc - If ($lastexitcode -ne 0) { Exit $lastexitcode } - appbundle-updater chef chef $env:GITHUB_SHA --tarball --github $env:GITHUB_REPOSITORY - If ($lastexitcode -ne 0) { Exit $lastexitcode } - Write-Output "Installed Chef / Ohai release:" - chef-client -v - If ($lastexitcode -ne 0) { Exit $lastexitcode } - ohai -v - If ($lastexitcode -ne 0) { Exit $lastexitcode } + # gem install appbundler appbundle-updater --no-doc + # If ($lastexitcode -ne 0) { Exit $lastexitcode } + # appbundle-updater chef chef $env:GITHUB_SHA --tarball --github $env:GITHUB_REPOSITORY + # If ($lastexitcode -ne 0) { Exit $lastexitcode } + # Write-Output "Installed Chef / Ohai release:" + # chef-client -v + # If ($lastexitcode -ne 0) { Exit $lastexitcode } + # ohai -v + # If ($lastexitcode -ne 0) { Exit $lastexitcode } - 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 + $env:PATH = "C:\ruby31\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH # htmldiff and ldiff on windows cause a conflict with gems being loaded below. # we remove thenm here. if (Test-Path C:\opscode\chef\embedded\bin\htmldiff) @@ -78,10 +124,18 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-10.15] # macos-11.0 is not public for now + os: [macos-latest] + ruby: ["3.1"] # macos-11.0 is not public for now runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 + with: + clean: true + - name: 'Upgrade Ruby Devkit on Macos' + id: upgrade_ruby + run: | + echo "This is the installed version of Ruby:" + brew info ruby - name: 'Install Chef/Ohai from Omnitruck' id: install_chef run: | @@ -90,26 +144,37 @@ jobs: /opt/chef/bin/chef-client -v /opt/chef/bin/ohai -v /opt/chef/embedded/bin/rake --version + echo "Updating Bundler" + gem install bundler:2.3.18 + echo "finished updating Bundler, now getting the 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 $GITHUB_REPOSITORY - echo "Installed Chef / Ohai release:" - /opt/chef/bin/chef-client -v - /opt/chef/bin/ohai -v + echo "finished getting the bundler version" - name: 'Run end_to_end::default recipe' id: run run: | + brew install rbenv ruby-build + touch ~/.zshrc + export PATH="$HOME/.rbenv/bin:$PATH" + export HOMEBREW_NO_ENV_HINTS="true" + echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc + source ~/.zshrc + rbenv install 3.1.2 + rbenv global 3.1.2 + gem install bundler:2.3.18 + echo "which bundler are we using?" + which bundle + echo "what version is that?" + bundle --version + sudo mv /Users/runner/work/chef/chef /Users/runner/work/chef/chef17 + git clone https://github.com/chef/chef.git /Users/runner/work/chef/chef + cd /Users/runner/work/chef/chef + git checkout jfm/ruby_revert_to_ruby31 + sudo bundle install cd kitchen-tests - sudo /opt/chef/embedded/bin/bundle config set --local without 'omnibus_package' - sudo /opt/chef/embedded/bin/bundle config set --local path 'vendor/bundle' - sudo /opt/chef/embedded/bin/bundle install --jobs=3 --retry=3 - sudo rm -f /opt/chef/embedded/bin/{htmldiff,ldiff} - sudo /opt/chef/embedded/bin/gem install berkshelf --no-doc - sudo /opt/chef/embedded/bin/berks vendor cookbooks + sudo bundle install --jobs=3 --retry=3 + sudo gem install kitchen + sudo gem install berkshelf --no-doc + sudo berks vendor cookbooks sudo /opt/chef/bin/chef-client -z -o end_to_end --chef-license accept-no-persist linux: @@ -129,6 +194,7 @@ jobs: - 'ubuntu-1804' - 'ubuntu-2004' - 'ubuntu-2204' + ruby: ['3.1'] runs-on: ubuntu-latest env: FORCE_FFI_YAJL: ext @@ -139,10 +205,20 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.0" - bundler-cache: true + ruby-version: "3.1" + bundler-cache: false working-directory: kitchen-tests - name: Run Test Kitchen working-directory: kitchen-tests run: | + ruby -v + echo "Which ruby are we using?" + which ruby + sudo mv /home/runner/work/chef/chef /home/runner/work/chef/chef17 + git clone https://github.com/chef/chef.git /home/runner/work/chef/chef + cd /home/runner/work/chef/chef + bundle install + gem install kitchen + cd /home/runner/work/chef/chef/kitchen-tests + bundle install bundle exec kitchen test end-to-end-${{ matrix.os }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b9daa6aba..6c71ae89c7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,10 +16,12 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 - bundler-cache: true + ruby-version: 3.1 + bundler-cache: false - uses: r7kamura/rubocop-problem-matchers-action@v1 # this shows the failures in the PR - - run: bundle exec chefstyle -c .rubocop.yml + - run: | + gem install chefstyle + chefstyle -c .rubocop.yml spellcheck: runs-on: ubuntu-latest diff --git a/.github/workflows/unit_specs.yml b/.github/workflows/unit_specs.yml index 38b884b5df..7efb9e31ee 100644 --- a/.github/workflows/unit_specs.yml +++ b/.github/workflows/unit_specs.yml @@ -9,18 +9,16 @@ name: unit_specs 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 }} + runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + with: + clean: true - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + ruby-version: "3.1" + bundler-cache: false + - run: bundle update --bundler + - run: bundle install - run: bundle exec rake spec:unit - run: bundle exec rake component_specs |