From 6470675bca38e18bb15882edcec8c6a0c9939b0a Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 28 Nov 2023 14:25:18 +0000 Subject: [PATCH] feat: Update workflows (#90) Add Renovate, Gemfile, and Rakefile standard fixes Add publish and lint-unit workflows Signed-off-by: Dan Webb --- .github/dependabot.yml | 11 ++++---- .github/workflows/ci.yml | 22 --------------- .github/workflows/lint.yml | 9 +++++++ .github/workflows/publish.yaml | 35 ++++++++++++++++++++++++ .gitignore | 1 - .markdownlint.yaml | 9 +++++++ .rubocop.yml | 11 ++++++++ .travis.yml | 17 ------------ CHANGELOG.md | 19 ++++++++++++- Gemfile | 22 +++++++++++++-- README.md | 19 ++++++++----- Rakefile | 48 +++++++++++---------------------- kitchen-dsc.gemspec | 49 ++++++++++++---------------------- renovate.json | 8 ++++++ 14 files changed, 161 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/publish.yaml create mode 100644 .markdownlint.yaml create mode 100644 .rubocop.yml delete mode 100644 .travis.yml create mode 100644 renovate.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 452ebb3..7062856 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,8 @@ +--- version: 2 updates: -- package-ecosystem: bundler - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 + - package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index a5c7351..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: - - master - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - ruby: [ '2.5', '2.6', '2.7', '3.0'] - name: Lint & Test with Ruby ${{ matrix.ruby }} - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - run: bundle exec rake \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6cbf56a --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,9 @@ +--- +name: "Lint, Unit & Integration Tests" + +"on": + pull_request: + +jobs: + lint-unit: + uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..441879f --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,35 @@ +--- +name: release-please + +"on": + push: + branches: [main] + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: ruby + package-name: kitchen-dsc + version-file: lib/kitchen-dsc/version.rb + token: ${{ secrets.PORTER_GITHUB_TOKEN }} + + - name: Checkout + uses: actions/checkout@v4 + if: ${{ steps.release.outputs.release_created }} + + - name: Build and publish to GitHub Package + uses: actionshub/publish-gem-to-github@main + if: ${{ steps.release.outputs.release_created }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + owner: ${{ secrets.OWNER }} + + - name: Build and publish to RubyGems + uses: actionshub/publish-gem-to-rubygems@main + if: ${{ steps.release.outputs.release_created }} + with: + token: ${{ secrets.RUBYGEMS_API_KEY }} diff --git a/.gitignore b/.gitignore index ddace77..fc3e13a 100755 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ Gemfile.lock *.gem .bundle .config -.rubocop.yml coverage InstalledFiles lib/bundler/man diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..b5908fb --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,9 @@ +--- +default: true +MD013: false +MD024: false +MD026: false +MD036: false +MD012: false +MD029: false +MD004: false diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..8fd406e --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,11 @@ +--- +require: + - chefstyle + +AllCops: + TargetRubyVersion: 3.1 + Include: + - "**/*.rb" + Exclude: + - "vendor/**/*" + - "spec/**/*" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index db3799b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: ruby -cache: bundler -dist: xenial - -branches: - only: - - master - -matrix: - include: - - rvm: 2.4.9 - - rvm: 2.5.7 - - rvm: 2.6.5 - - rvm: 2.7.0 - - rvm: ruby-head - allow_failures: - - rvm: ruby-head diff --git a/CHANGELOG.md b/CHANGELOG.md index 927bd4d..a42b03d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log ## [v0.11.1](https://github.com/test-kitchen/kitchen-dsc/tree/v0.11.1) (2020-08-21) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.11.0...v0.11.1) **Merged pull requests:** @@ -15,6 +16,7 @@ - Optimize our requires [\#51](https://github.com/test-kitchen/kitchen-dsc/pull/51) ([tas50](https://github.com/tas50)) ## [v0.11.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.11.0) (2017-09-29) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.10.1...v0.11.0) **Merged pull requests:** @@ -22,6 +24,7 @@ - Ability to run multiple dsc configurations [\#33](https://github.com/test-kitchen/kitchen-dsc/pull/33) ([TraGicCode](https://github.com/TraGicCode)) ## [v0.10.1](https://github.com/test-kitchen/kitchen-dsc/tree/v0.10.1) (2017-07-05) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.10.0...v0.10.1) **Merged pull requests:** @@ -30,6 +33,7 @@ - Output mof generation errors [\#28](https://github.com/test-kitchen/kitchen-dsc/pull/28) ([elmundio87](https://github.com/elmundio87)) ## [v0.10.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.10.0) (2016-06-24) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.9.3...v0.10.0) **Merged pull requests:** @@ -37,6 +41,7 @@ - Extract DSC LCM Configuration To Separate Gem [\#25](https://github.com/test-kitchen/kitchen-dsc/pull/25) ([smurawski](https://github.com/smurawski)) ## [v0.9.3](https://github.com/test-kitchen/kitchen-dsc/tree/v0.9.3) (2016-06-23) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.9.2...v0.9.3) **Merged pull requests:** @@ -44,6 +49,7 @@ - Fix Duplicate Repository Params from metadata [\#24](https://github.com/test-kitchen/kitchen-dsc/pull/24) ([smurawski](https://github.com/smurawski)) ## [v0.9.2](https://github.com/test-kitchen/kitchen-dsc/tree/v0.9.2) (2016-06-20) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.9.0...v0.9.2) **Merged pull requests:** @@ -51,6 +57,7 @@ - Silence all progress [\#21](https://github.com/test-kitchen/kitchen-dsc/pull/21) ([smurawski](https://github.com/smurawski)) ## [v0.9.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.9.0) (2016-06-17) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.8.3...v0.9.0) **Merged pull requests:** @@ -58,6 +65,7 @@ - Support reboots [\#19](https://github.com/test-kitchen/kitchen-dsc/pull/19) ([smurawski](https://github.com/smurawski)) ## [v0.8.3](https://github.com/test-kitchen/kitchen-dsc/tree/v0.8.3) (2016-05-16) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.8.2...v0.8.3) **Merged pull requests:** @@ -65,12 +73,15 @@ - Remove duplicate -Repository parameter [\#16](https://github.com/test-kitchen/kitchen-dsc/pull/16) ([brantb](https://github.com/brantb)) ## [v0.8.2](https://github.com/test-kitchen/kitchen-dsc/tree/v0.8.2) (2016-04-01) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.8.1...v0.8.2) ## [v0.8.1](https://github.com/test-kitchen/kitchen-dsc/tree/v0.8.1) (2016-04-01) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.8.0...v0.8.1) ## [v0.8.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.8.0) (2016-03-31) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.7.0...v0.8.0) **Merged pull requests:** @@ -78,9 +89,11 @@ - Psgallery support [\#14](https://github.com/test-kitchen/kitchen-dsc/pull/14) ([smurawski](https://github.com/smurawski)) ## [v0.7.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.7.0) (2016-03-28) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.6.1...v0.7.0) ## [v0.6.1](https://github.com/test-kitchen/kitchen-dsc/tree/v0.6.1) (2015-12-28) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.6.0...v0.6.1) **Merged pull requests:** @@ -88,6 +101,7 @@ - Fix a few typos [\#11](https://github.com/test-kitchen/kitchen-dsc/pull/11) ([smurawski](https://github.com/smurawski)) ## [v0.6.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.6.0) (2015-12-18) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.5.0...v0.6.0) **Merged pull requests:** @@ -95,6 +109,7 @@ - Fail DSC run on error applying configuration. [\#10](https://github.com/test-kitchen/kitchen-dsc/pull/10) ([smurawski](https://github.com/smurawski)) ## [v0.5.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.5.0) (2015-12-17) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.4.1...v0.5.0) **Merged pull requests:** @@ -102,9 +117,11 @@ - Support ConfigurationData in .kitchen.yml [\#9](https://github.com/test-kitchen/kitchen-dsc/pull/9) ([smurawski](https://github.com/smurawski)) ## [v0.4.1](https://github.com/test-kitchen/kitchen-dsc/tree/v0.4.1) (2015-12-10) + [Full Changelog](https://github.com/test-kitchen/kitchen-dsc/compare/v0.4.0...v0.4.1) ## [v0.4.0](https://github.com/test-kitchen/kitchen-dsc/tree/v0.4.0) (2015-12-10) + **Merged pull requests:** - Smurawski/wmf5 prod preview [\#7](https://github.com/test-kitchen/kitchen-dsc/pull/7) ([smurawski](https://github.com/smurawski)) @@ -113,4 +130,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/Gemfile b/Gemfile index c197754..e075c6c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,24 @@ source "https://rubygems.org" -# Specify your gem's dependencies in kitchen-dsc.gemspec gemspec -gem "github_changelog_generator" +group :development do + gem "countloc", "~> 0.4" + gem "yard", "~> 0.8" + gem "pry" + gem "pry-stack_explorer" + gem "pry-byebug" + gem "rb-readline" + gem "cane", "3.0.0" +end + +group :test do + gem "rake" + gem "rspec", "~> 3.2" + gem "simplecov", "~> 0.9" + gem "minitest", "~> 5.3" +end + +group :chefstyle do + gem "chefstyle", "2.2.3" +end diff --git a/README.md b/README.md index 822c821..792b381 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ +# kitchen-dsc + [![Gem Version](https://badge.fury.io/rb/kitchen-dsc.svg)](http://badge.fury.io/rb/kitchen-dsc) -# kitchen-dsc A Test Kitchen Provisioner for PowerShell DSC ## Status @@ -8,19 +9,24 @@ A Test Kitchen Provisioner for PowerShell DSC This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack. ## Requirements + You'll need a driver box with WMF4 or greater (ONLY WINDOWS SYSTEMS) ## Installation & Setup -You'll need the test-kitchen & kitchen-dsc gems installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen. + +You'll need the test-kitchen & kitchen-dsc gems installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen. ### Note: + You will see a delay in the return of the run details due to an difference in how the verbose stream is returned for DSC runs between WMF versions, so I return the verbose stream after the job completes. I'd love to live stream the results, but that'll take a bit more experimentation. (PR's welcome!) ## Example Configurations + * [Repository Style Testing](https://github.com/smurawski/dsc-kitchen-project) * [Module Style Testing](https://github.com/powershellorg/cwebadministration/tree/smurawski/adding_tests) ## Configuration Settings + * configuration_script_folder * Defaults to 'examples'. * The location of a PowerShell script(s) containing the DSC configuration command(s). @@ -42,7 +48,7 @@ You will see a delay in the return of the run details due to an difference in ho * Can be defined in the configuration script or via the `configuration_data` configuration setting. * dsc_local_configuration_manager_version - * Defaults to 'wmf4' + * Defaults to 'wmf4' * Identifies what version of the LCM is in place * Other valid values are 'wmf4_with_update' and 'wmf5' * Currently the only difference between wmf4 and wmf4_with_update/wmf5 is the action_after_reboot and the debug_mode settings. Eventually, I'd like to add support for partial configurations, pull servers, etc.. @@ -64,8 +70,8 @@ You will see a delay in the return of the run details due to an difference in ho * modules_from_gallery * Requires WMF 5 * Takes a string (for one module) or an array (for multiple) to install from the gallery - * Or takes a hash with keys matching the parameters for install-module. - * Name is required. + * Or takes a hash with keys matching the parameters for install-module. + * Name is required. * Force is automatically used and not required as part of the hash table. * Repository defaults to either PSGallery or any custom feed defined, but can be overriden here. @@ -77,12 +83,13 @@ You will see a delay in the return of the run details due to an difference in ho * URI for a custom PowerShell gallery feed. ### Specific to repository style testing + * modules_path * Defaults to 'modules'. * Points to the location of modules containing DSC resources to upload * This path is relative to the root of the repository (the location of the .kitchen.yml). -## Example +## Example ```yaml provisioner: diff --git a/Rakefile b/Rakefile index 40d90b6..7e74f8a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,39 +1,21 @@ require "bundler/gem_tasks" - -require "rake/testtask" -Rake::TestTask.new(:unit) do |t| - t.libs.push "lib" - t.test_files = FileList["spec/**/*_spec.rb"] - t.verbose = true -end - -require "rubocop/rake_task" require "chefstyle" +require "rubocop/rake_task" -desc "Run RuboCop on the lib directory" -RuboCop::RakeTask.new(:rubocop) do |task| - task.patterns = ["lib/**/*.rb"] - # don't abort rake on failure - task.fail_on_error = false +RuboCop::RakeTask.new(:style) do |task| + task.options += ["--display-cop-names", "--no-color"] end -desc "Run all test suites" -task test: [:unit, :rubocop] - -task default: [:test] - -begin - require "github_changelog_generator/task" - require "kitchen-dsc/version" - - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - config.future_release = "v#{Kitchen::Dsc::VERSION}" - config.issues = false - config.pulls = true - config.user = "test-kitchen" - config.project = "kitchen-dsc" - end -rescue LoadError - puts "github_changelog_generator is not available. " \ - "gem install github_changelog_generator to generate changelogs" +# Create the spec task. +require "rspec/core/rake_task" +RSpec::Core::RakeTask.new(:test, :tag) do |t, args| + t.rspec_opts = [].tap do |a| + a << "--color" + a << "--format #{ENV["CI"] ? "documentation" : "progress"}" + a << "--backtrace" if ENV["VERBOSE"] || ENV["DEBUG"] + a << "--seed #{ENV["SEED"]}" if ENV["SEED"] + a << "--tag #{args[:tag]}" if args[:tag] + a << "--default-path test" + a << "-I test/spec" + end.join(" ") end diff --git a/kitchen-dsc.gemspec b/kitchen-dsc.gemspec index 83ac5a0..5f5a270 100644 --- a/kitchen-dsc.gemspec +++ b/kitchen-dsc.gemspec @@ -1,36 +1,21 @@ -$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) +lib = File.expand_path("lib", __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "kitchen-dsc/version" -Gem::Specification.new do |s| - s.name = "kitchen-dsc" - s.version = Kitchen::Dsc::VERSION - s.authors = ["Steven Murawski"] - s.email = ["smurawski@chef.io"] - s.homepage = "https://github.com/test-kitchen/kitchen-dsc" - s.summary = "PowerShell DSC provisioner for test-kitchen" - s.description = "PowerShell DSC provisioner for test-kitchen" - candidates = Dir.glob("lib/**/*") + ["README.md", "kitchen-dsc.gemspec"] - s.files = candidates.sort - s.platform = Gem::Platform::RUBY - s.require_paths = ["lib"] - s.license = "Apache-2.0" - s.add_dependency "test-kitchen", ">= 1.9" - s.add_dependency "dsc_lcm_configuration" +Gem::Specification.new do |gem| + gem.name = "kitchen-dsc" + gem.version = Kitchen::Dsc::VERSION + gem.authors = ["Test Kitchen Team"] + gem.email = ["help@sous-chefs.org"] + gem.homepage = "https://github.com/test-kitchen/kitchen-dsc" + gem.summary = "PowerShell DSC provisioner for test-kitchen" + gem.description = "PowerShell DSC provisioner for test-kitchen" + gem.files = `git ls-files`.split($/) + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.platform = Gem::Platform::RUBY + gem.require_paths = ["lib"] + gem.license = "Apache-2.0" - s.add_development_dependency "countloc", "~> 0.4" - s.add_development_dependency "rake" - s.add_development_dependency "rspec", "~> 3.2" - s.add_development_dependency "simplecov", "~> 0.9" - s.add_development_dependency "minitest", "~> 5.3" - s.add_development_dependency "yard", "~> 0.8" - s.add_development_dependency "pry" - s.add_development_dependency "pry-stack_explorer" - s.add_development_dependency "pry-byebug" - s.add_development_dependency "rb-readline" - - # style and complexity libraries are tightly version pinned as newer releases - # may introduce new and undesireable style choices which would be immediately - # enforced in CI - s.add_development_dependency "chefstyle", "2.2.2" - s.add_development_dependency "cane", "3.0.0" + gem.add_dependency "dsc_lcm_configuration" + gem.add_dependency "test-kitchen", ">= 1.9" end diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..b65764b --- /dev/null +++ b/renovate.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + ":disableDependencyDashboard", + "schedule:automergeEarlyMondays" + ] +}