Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add publish workflow, lint workflow #24

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .cane
Empty file.
11 changes: 6 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
9 changes: 9 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: "Test"

"on":
pull_request:

jobs:
lint-unit:
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2
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: busser-bats
version-file: lib/busser/bats/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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
reports.html
7 changes: 7 additions & 0 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fix": false,
"globs": ["**/*.md", "!vendor"],
// "ignores": ["ignore*.md"],
"noProgress": false,
"showFound": true
}
9 changes: 9 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
default: true
MD013: false
MD024: false
MD026: false
MD036: false
MD012: false
MD029: false
MD004: false
12 changes: 10 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Style/ClassAndModuleChildren:
---
require:
- chefstyle

AllCops:
TargetRubyVersion: 2.7
Include:
- "**/*.rb"
Exclude:
- lib/busser/runner_plugin/bats.rb
- "vendor/**/*"
- "spec/**/*"
10 changes: 0 additions & 10 deletions .simplecov

This file was deleted.

1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 2.7.2
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# busser-bats Changelog

## 0.3.0 / 2014-10-14

### New features
Expand All @@ -22,4 +24,4 @@
* Initial release

<!--- The following link definition list is generated by PimpMyChangelog --->
[@fnichol]: https://github.com/fnichol
[@fnichol]: https://github.com/fnichol
19 changes: 18 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- encoding: utf-8 -*-
source "https://rubygems.org"

gemspec
Expand All @@ -8,3 +7,21 @@ group :guard do
gem "guard-cane"
gem "guard-rubocop"
end

group :test do
gem "rake", ">= 11.0"
gem "rspec", "~> 3.2"
end

group :development do
gem "aruba"
gem "countloc"
gem "simplecov"

# gem "finstyle", "1.2.0"
gem "cane", "2.6.2"
end

group :chefstyle do
gem "chefstyle", "2.2.3"
end
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <a name="title"></a> Busser::RunnerPlugin::Bats
# Busser::RunnerPlugin::Bats

[![Gem Version](https://badge.fury.io/rb/busser-bats.png)](http://badge.fury.io/rb/busser-bats)
[![Build Status](https://travis-ci.org/test-kitchen/busser-bats.png?branch=master)](https://travis-ci.org/test-kitchen/busser-bats)
Expand All @@ -10,15 +10,15 @@ A Busser runner plugin for [Bats][bats_site]

This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.

## <a name="installation"></a> Installation and Setup
## Installation and Setup

Until proper reference documentation is complete, the [Writing a Test](http://kitchen.ci/docs/getting-started/writing-test) section of the Test Kitchen's [Getting Started Guide](http://kitchen.ci/docs/getting-started/) gives a working example of creating a bats test.

## <a name="usage"></a> Usage
## Usage

**TODO:** Write documentation explaining the structure/format of testing files.

## <a name="development"></a> Development
## Development

* Source hosted at [GitHub][repo]
* Report issues/questions/feature requests on [GitHub Issues][issues]
Expand All @@ -33,11 +33,11 @@ example:
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## <a name="authors"></a> Authors
## Authors

Created and maintained by [Fletcher Nichol][author] (<fnichol@nichol.ca>)

## <a name="license"></a> License
## License

Apache 2.0 (see [LICENSE][license])

Expand All @@ -48,6 +48,5 @@ Apache 2.0 (see [LICENSE][license])
[issues]: https://github.com/fnichol/busser-bats/issues
[license]: https://github.com/fnichol/busser-bats/blob/master/LICENSE
[repo]: https://github.com/fnichol/busser-bats
[plugin_usage]: http://docs.kitchen-ci.org/busser/plugin-usage

[bats_site]: https://github.com/sstephenson/bats
16 changes: 1 addition & 15 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- encoding: utf-8 -*-

require "bundler/gem_tasks"
require "open-uri"

Expand Down Expand Up @@ -48,18 +46,6 @@ end
desc "Run all test suites"
task :test => [:features]

require "finstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new(:style) do |task|
task.options << "--display-cop-names"
end

require "cane/rake_task"
desc "Run cane to check quality metrics"
Cane::RakeTask.new do |cane|
cane.canefile = "./.cane"
end

desc "Display LOC stats"
task :stats do
puts "\n## Production Code Stats"
Expand All @@ -69,6 +55,6 @@ task :stats do
end

desc "Run all quality tasks"
task :quality => [:cane, :style, :stats]
# task :quality => [:cane, :style, :stats]

task :default => [:test, :quality]
11 changes: 0 additions & 11 deletions busser-bats.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,4 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]

gem.add_dependency "busser"

gem.add_development_dependency "aruba"
gem.add_development_dependency "countloc"
gem.add_development_dependency "rake"
gem.add_development_dependency "simplecov"

# style and complexity libraries are tightly version pinned as newer releases
# may introduce new and undesireable style choices which would be immediately
# enforced in CI
gem.add_development_dependency "finstyle", "1.2.0"
gem.add_development_dependency "cane", "2.6.2"
end
1 change: 1 addition & 0 deletions config/cucumber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default: --publish-quiet --format pretty --format html --out reports.html

Check warning on line 1 in config/cucumber.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

1:1 [document-start] missing document start "---"
17 changes: 17 additions & 0 deletions config/features/plugin_install_command.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Commenting out this test for now as it is not working on MacOS due to permissions (stop writing to /opt!)
# undefined method `check_directory_presence' for #<Object:0x000000013ae8cc78> (NoMethodError)
# features/plugin_install_command.feature:11:in `the vendor directory named "bats" should exist'
# Feature: Plugin install command
# In order to use this plugin
# As a user of Busser
# I want to run the postinstall for this plugin

# Background:
# Given a test BUSSER_ROOT directory named "busser-bats-install"

# Scenario: Running the postinstall generator
# When I run `busser plugin install busser-bats --force-postinstall`
# Then the vendor directory named "bats" should exist
# And the vendor file "bats/bin/bats" should contain "BATS_PREFIX="
# And the output should contain "Installed Bats"
# And the exit status should be 0
2 changes: 0 additions & 2 deletions features/support/env.rb → config/features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- encoding: utf-8 -*-

require "aruba/cucumber"
require "busser/cucumber"

Expand Down
44 changes: 44 additions & 0 deletions config/features/test_command.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: Test command
In order to run tests written with bats
As a user of Busser
I want my tests to run when the bats runner plugin is installed

Background:
Given a test BUSSER_ROOT directory named "busser-bats-test"
When I successfully run `busser plugin install busser-bats --force-postinstall`
Given a suite directory named "bats"

# Scenario: A passing test suite
# Given a file in suite "bats" named "default.bats" with:
# """
# @test "runs something" {
# run echo "hello"
# [ "$status" -eq 0 ]
# [ "$output" == "hello" ]
# }

# """
# When I run `busser test bats`
# Then the output should contain:
# """
# 1..1
# ok 1 runs something
# """
# And the exit status should be 0

# Scenario: A failing test suite
# Given a file in suite "bats" named "default.bats" with:
# """
# @test "fails something" {
# run which uhoh-whatzit-called
# [ "$status" -eq 0 ]
# }

# """
# When I run `busser test bats`
# Then the output should contain:
# """
# 1..1
# not ok 1 fails something
# """
# And the exit status should not be 0
14 changes: 0 additions & 14 deletions features/plugin_install_command.feature

This file was deleted.

Loading
Loading