diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37bf958..5b13499 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,54 +3,15 @@ name: Lint & Unit "on": pull_request: - push: - branches: - - main 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 - - unit: - name: Unit test on Ruby ${{ matrix.ruby }} - needs: [yamllint, chefstyle] - runs-on: ubuntu-latest - strategy: - matrix: - ruby: ["2.7", "3.0", "3.1"] - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - run: bundle exec rake spec + lint-unit: + uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.1 integration-windows: name: Windows ${{matrix.suite}} ${{matrix.os}} runs-on: windows-latest - needs: unit + needs: lint-unit strategy: fail-fast: false matrix: @@ -69,7 +30,7 @@ jobs: integration-linux: name: Linux ${{matrix.suite}} ${{matrix.os}} runs-on: ubuntu-latest - needs: unit + needs: lint-unit strategy: fail-fast: false matrix: @@ -106,7 +67,7 @@ jobs: integration-capabilities: name: Linux ${{matrix.suite}} ${{matrix.os}} runs-on: ubuntu-latest - needs: unit + needs: lint-unit strategy: fail-fast: false matrix: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..a5d0ecd --- /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: workflow-testing-gem + version-file: lib/kitchen/driver/docker_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/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..5df560a --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,8 @@ +default: true +MD013: false +MD024: false +MD026: false +MD036: false +MD012: false +MD029: false +MD004: false diff --git a/Gemfile b/Gemfile index 025550b..092f311 100644 --- a/Gemfile +++ b/Gemfile @@ -3,20 +3,18 @@ source 'https://rubygems.org' gemspec group :development do + # Integration testing gems. + gem 'kitchen-inspec', '~> 2.0' + gem 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released +end + +group :test do gem 'bundler' gem 'rake' - # Style checker gems. - gem 'countloc' - - # Unit testing gems. gem 'rspec', '~> 3.2' gem 'rspec-its', '~> 1.2' - gem 'fuubar', '~> 2.0' - # gem 'simplecov', '~> 0.9' - gem 'codecov', '~> 0.0', '>= 0.0.2' - gem 'chefstyle', '~> 2.2', '>= 2.2.3' +end - # Integration testing gems. - gem 'kitchen-inspec', '~> 2.0' - gem 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released +group :chefstyle do + gem 'chefstyle', '~> 2.2', '>= 2.2.3' end diff --git a/README.md b/README.md index e26f522..0c9a47a 100644 --- a/README.md +++ b/README.md @@ -127,18 +127,21 @@ Examples: If you are using the InSpec verifier on Windows, using named pipes for the Docker engine will not work with the Docker transport. Set the socket option with the TCP socket address of the Docker engine as shown below: + ```yaml socket: tcp://localhost:2375 ``` The Docker engine must be configured to listen on a TCP port (default port is 2375). This can be configured by editing the configuration file (usually located in `C:\ProgramData\docker\config\daemon.json`) and adding the hosts value: -``` + +```json "hosts": ["tcp://0.0.0.0:2375"] ``` Example configuration is shown below: -``` + +```json { "registry-mirrors": [], "insecure-registries": [], @@ -171,6 +174,7 @@ Configuration section for more details). The isolation technology for the container. This is not set by default and will use the default container isolation settings. For example, the following driver configuration options can be used to specify the container isolation technology for Windows containers: + ```yaml # Hyper-V isolation: hyperv @@ -238,6 +242,7 @@ driver_config: provision_command: curl -L https://www.opscode.com/chef/install.sh | bash require_chef_omnibus: false ``` + ### env_variables Adds environment variables to Docker container @@ -376,6 +381,7 @@ Examples: - 8.8.8.8 - 8.8.4.4 ``` + ### http\_proxy Sets an http proxy for the suite container using the `http_proxy` environment variable. @@ -385,6 +391,7 @@ Examples: ```yaml http_proxy: http://proxy.host.com:8080 ``` + ### https\_proxy Sets an https proxy for the suite container using the `https_proxy` environment variable. @@ -394,6 +401,7 @@ Examples: ```yaml https_proxy: http://proxy.host.com:8080 ``` + ### forward Set suite container port(s) to forward to the host machine. You may specify @@ -525,11 +533,11 @@ Share a host device with the container. Host device must be an absolute path. Examples: -``` +```yaml devices: /dev/vboxdrv ``` -``` +```yaml devices: - /dev/vboxdrv - /dev/vboxnetctl @@ -637,6 +645,7 @@ example: ## License +```text Copyright 2013-2016, [Sean Porter](https://github.com/portertech) Copyright 2015-2016, [Noah Kantrowitz](https://github.com/coderanger) @@ -651,14 +660,12 @@ 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. +``` [issues]: https://github.com/test-kitchen/kitchen-docker/issues -[license]: https://github.com/test-kitchen/kitchen-docker/blob/master/LICENSE [repo]: https://github.com/test-kitchen/kitchen-docker [docker_installation]: https://docs.docker.com/installation/#installation -[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223 [docker_index]: https://index.docker.io/ -[docker_default_image]: https://index.docker.io/_/base/ [test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/ [chef_omnibus_dl]: https://downloads.chef.io/chef-client/ [cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html diff --git a/Rakefile b/Rakefile index f237487..8962295 100644 --- a/Rakefile +++ b/Rakefile @@ -1,22 +1,11 @@ require "bundler/gem_tasks" -desc "Display LOC stats" -task :stats do - puts "\n## Production Code Stats" - sh "countloc -r lib" -end - -desc "Run all quality tasks" -task quality: [:stats] - -task default: [:quality] - # Create the spec task. require "rspec/core/rake_task" -RSpec::Core::RakeTask.new(:spec, :tag) do |t, args| +RSpec::Core::RakeTask.new(:test, :tag) do |t, args| t.rspec_opts = [].tap do |a| a << "--color" - a << "--format #{ENV["CI"] ? "documentation" : "Fuubar"}" + 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] 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" + ] +} diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb index 15db6b5..fd01cf0 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -17,27 +17,6 @@ require "rake" require "rspec" require "rspec/its" -require "simplecov" - -# Check for coverage stuffs -formatters = [] - -if ENV["CODECOV_TOKEN"] || ENV["CI"] - require "codecov" - formatters << SimpleCov::Formatter::Codecov -end - -unless formatters.empty? - SimpleCov.formatters = formatters -end - -SimpleCov.start do - # Don't get coverage on the test cases themselves. - add_filter "/spec/" - add_filter "/test/" - # Codecov doesn't automatically ignore vendored files. - add_filter "/vendor/" -end require "kitchen/driver/docker"