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

Use amazing print #802

Merged
merged 4 commits into from
Jul 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 4 additions & 24 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: PR auto-{approve,merge}
name: "Bot auto-{approve,merge}"

on:
workflow_dispatch:
pull_request_target:

permissions:
Expand All @@ -9,26 +10,5 @@ permissions:

jobs:
dependabot:
name: Dependabot
runs-on: ubuntu-latest

if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve Dependabot PR
if: ${{steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Merge Dependabot PR
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: yettoapp/actions/.github/workflows/automerge_dependabot.yml@main
secrets: inherit
14 changes: 7 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: Lint
name: Linting

on:
pull_request:
paths:
- "**/*.rb"

permissions:
contents: read

jobs:
test:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
- name: Set up Ruby
uses: yettoapp/actions/setup-languages@main
with:
ruby-version: 3.1
bundler-cache: true

- run: bundle install
ruby: true

- name: Rubocop
run: bundle exec rake rubocop
69 changes: 9 additions & 60 deletions .github/workflows/tag_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tag and Release
name: Release

on:
workflow_dispatch:
Expand All @@ -9,62 +9,11 @@ on:
- "lib/html_proofer/version.rb"

jobs:
release:
env:
GEM_NAME: html_proofer
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_BOT_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Configure Git
run: |
git config --local user.email "actions@github.com"
git config --local user.name "Actions Auto Build"

- name: Get current version
id: version-label
run: |
VERSION=$(grep VERSION lib/html_proofer/version.rb | head -n 1 | cut -d'"' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: Create tag
run: |
git tag -a v${{ steps.version-label.outputs.version }} -m "Release v${{ steps.version-label.outputs.version }}"
git push origin --tags

- name: Generate CHANGELOG.md
id: changelog
run: script/generate_changelog

- name: Commit & Push Changelog
run: |
git config --local user.email "actions@github.com"
git config --local user.name "Actions Auto Build"
git add -f CHANGELOG.md
git commit -m "docs: update changelog" || true
git push

- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.version-label.outputs.version }} --generate-notes

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
bundle exec rake build
for gem in pkg/html-proofer-${{ steps.version-label.outputs.version }}*.gem ; do
gem push "$gem" --host https://rubygems.org
done
ruby:
uses: yettoapp/actions/.github/workflows/ruby_gem_release.yml@main
secrets:
rubygems_api_key: ${{ secrets.RUBYGEMS_API_BOT_KEY }}
gh_token: ${{ secrets.PUBLIC_PUSH_TO_PROTECTED_BRANCH }}
with:
gem_name: html_proofer
version_filepath: lib/html_proofer/version.rb
16 changes: 5 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: CI

on:
pull_request:
Expand All @@ -8,21 +8,15 @@ permissions:

jobs:
test:
env:
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
- name: Set up Ruby
uses: yettoapp/actions/setup-languages@main
with:
ruby-version: 3.1
bundler-cache: true

- name: Install dependencies
run: bundle install
ruby: true

- name: Run tests
run: bundle exec rake
run: bundle exec rake test
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.1
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gem "ruby-lsp", "~> 0.3.2", group: :development

gem "github_changelog_generator", "~> 1.16"

gem "awesome_print"
gem "amazing_print"

gem "debug" if "#{RbConfig::CONFIG["MAJOR"]}.#{RbConfig::CONFIG["MINOR"]}".to_f >= 3.1
gem "rake"
Expand Down
5 changes: 4 additions & 1 deletion lib/html_proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
require "fileutils"

if ENV.fetch("DEBUG", false)
require "awesome_print"
require "debug"
begin
require "amazing_print"
rescue LoadError # rubocop:disable Lint/SuppressedException
end
end

module HTMLProofer
Expand Down
2 changes: 1 addition & 1 deletion lib/html_proofer/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module HTMLProofer
VERSION = "5.0.7"
VERSION = "5.0.8"
end