Skip to content

Commit

Permalink
feat: Update workflows (#410)
Browse files Browse the repository at this point in the history
- Use reusable workflows (v0.1.1)
- Use release-please for releasing the gem

Renovate 
- Disable dashboard and auto-merge every Monday

---------

Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus authored Nov 27, 2023
1 parent a9995e7 commit 01acb1e
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 96 deletions.
49 changes: 5 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 8 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
default: true
MD013: false
MD024: false
MD026: false
MD036: false
MD012: false
MD029: false
MD004: false
20 changes: 9 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
15 changes: 2 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
8 changes: 8 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":disableDependencyDashboard",
"schedule:automergeEarlyMondays"
]
}
21 changes: 0 additions & 21 deletions test/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 01acb1e

Please sign in to comment.