Skip to content

Commit

Permalink
feat: Update workflows
Browse files Browse the repository at this point in the history
- Use reusable workflows
- Use release-please for releasing gem

Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus committed Nov 25, 2023
1 parent a9995e7 commit c79d458
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 45 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@main

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
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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"}"
Expand Down
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

0 comments on commit c79d458

Please sign in to comment.