diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 3b594a3..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Lint & Unit - -"on": - pull_request: - -jobs: - yamllint: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Run yaml Lint - uses: actionshub/yamllint@main - - chefstyle: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - ruby: ["3.1"] - name: Chefstyle on Ruby ${{ matrix.ruby }} - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - uses: r7kamura/rubocop-problem-matchers-action@v1 - - run: bundle exec chefstyle diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..e3af73d --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,9 @@ +--- +name: Lint & Unit + +"on": + pull_request: + +jobs: + lint-unit: + uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 25b1c98..05bbabd 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,12 +9,9 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v3.7.13 + - uses: google-github-actions/release-please-action@v4 id: release with: - release-type: ruby - package-name: workflow-testing-gem - version-file: lib/kitchen/driver/version.rb token: ${{ secrets.PORTER_GITHUB_TOKEN }} - name: Checkout diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..df86f79 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.7" +} diff --git a/.rubocop.yaml b/.rubocop.yaml index 24d1ba7..2b9b10e 100644 --- a/.rubocop.yaml +++ b/.rubocop.yaml @@ -2,7 +2,6 @@ require: [chefstyle] AllCops: - TargetRubyVersion: 3.2 Include: - "**/*.rb" Exclude: diff --git a/Gemfile b/Gemfile index c7043f4..554f2fc 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,12 @@ source "https://rubygems.org" gemspec +group :test do + gem "bundler" + gem "rake" + gem "rspec", ">= 3.2" +end + group :chefstyle do - gem "chefstyle", "2.2.3" + gem "chefstyle", ">= 2.2.3" end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f1c0104 --- /dev/null +++ b/Rakefile @@ -0,0 +1,16 @@ +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +begin + require "chefstyle" + require "rubocop/rake_task" + RuboCop::RakeTask.new(:style) do |task| + task.options += ["--display-cop-names", "--no-color"] + end +rescue LoadError + puts "chefstyle is not available. (sudo) gem install chefstyle to do style checking." +end + +RSpec::Core::RakeTask.new(:test) + +task default: %i{test style} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..333e4bb --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "packages": { + ".": { + "package-name": "workflow-testing-gem", + "changelog-path": "CHANGELOG.md", + "release-type": "ruby", + "include-component-in-tag": false, + "version-file": "lib/kitchen/driver/version.rb" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..30e9e58 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,17 @@ +# +# Author:: Chef Partner Engineering () +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/spec/version_spec.rb b/spec/version_spec.rb new file mode 100644 index 0000000..20d4fc5 --- /dev/null +++ b/spec/version_spec.rb @@ -0,0 +1,31 @@ +# +# Authors:: Chef Partner Engineering () +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require "spec_helper" +require "kitchen/driver/version" + +describe Kitchen::Driver::WORKFLOW_TESTING_VERSION do + it "exists" do + expect(defined?(Kitchen::Driver::WORKFLOW_TESTING_VERSION)).to be_truthy + end + + it "compares versions correctly" do + version_1 = Kitchen::Driver::WORKFLOW_TESTING_VERSION + version_2 = Kitchen::Driver::WORKFLOW_TESTING_VERSION + expect(version_1).to eq(version_2) + end +end