Skip to content

Commit

Permalink
feat: Add workflows (#123)
Browse files Browse the repository at this point in the history
* feat: Add workflows

BREAKING: Require Ruby 3.1
  Ruby 2.7 is now EOL

Add publish and lint workflows
Add Renovate

Signed-off-by: Dan Webb <[email protected]>

* fix: Rubocop targetting Ruby 3.1

Signed-off-by: Dan Webb <[email protected]>

---------

Signed-off-by: Dan Webb <[email protected]>
  • Loading branch information
damacus authored Nov 28, 2023
1 parent 63a0b59 commit 6799c10
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ name: 'Test'

jobs:
lint-unit:
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2
34 changes: 34 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
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-google
version-file: lib/kitchen/driver/gce_version.rb

- 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 }}
7 changes: 5 additions & 2 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
MD012: false
default: true
MD013: false
MD024: false
MD026: false
MD036: false
MD012: false
MD029: false
MD004: false
1 change: 0 additions & 1 deletion .mdlrc

This file was deleted.

10 changes: 9 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
require:
- chefstyle

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 3.1
Include:
- "**/*.rb"
Exclude:
- "vendor/**/*"
- "spec/**/*"
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
source "https://rubygems.org"

# Specify your gem's dependencies in kitchen-google.gemspec
gemspec

group :test do
Expand Down
8 changes: 4 additions & 4 deletions kitchen-google.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Gem::Specification.new do |s|
s.version = Kitchen::Driver::GCE_VERSION
s.summary = "Kitchen::Driver::Gce"
s.description = "A Test-Kitchen driver for Google Compute Engine"
s.authors = ["Andrew Leonard", "Chef Partner Engineering"]
s.email = ["[email protected]", "[email protected]"]
s.authors = ["Test Kitchen Team"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/test-kitchen/kitchen-google"
s.license = "Apache-2.0"

Expand All @@ -16,7 +16,7 @@ Gem::Specification.new do |s|

s.add_dependency "gcewinpass", "~> 1.1"
s.add_dependency "google-api-client", ">= 0.23.9", "<= 0.54.0"
s.add_dependency "test-kitchen", ">= 1.4.1"
s.add_dependency "test-kitchen", ">= 1.0.0", "< 4.0"

s.required_ruby_version = ">= 2.7"
s.required_ruby_version = ">= 3.1"
end
8 changes: 4 additions & 4 deletions lib/kitchen/driver/gce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Gce < Kitchen::Driver::Base
default_config :metadata, {}
default_config :labels, {}

DISK_NAME_REGEX = /(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)/.freeze
DISK_NAME_REGEX = /(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)/

def name
"Google Compute (GCE)"
Expand Down Expand Up @@ -272,11 +272,11 @@ def update_windows_password(server_name)
info("Resetting the Windows password for user #{username} on #{server_name}...")

state[:password] = GoogleComputeWindowsPassword.new(
project: project,
zone: zone,
project:,
zone:,
instance_name: server_name,
email: config[:email],
username: username
username:
).new_password

info("Password reset complete on #{server_name} complete.")
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"
]
}

0 comments on commit 6799c10

Please sign in to comment.