chore: Update rubocop and related gems (June 2024) #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: netsoft-rubocop-main | |
on: | |
pull_request: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+.[0-9a-z]+ | |
- v[0-9]+.[0-9]+.[0-9]+ | |
env: | |
RUBYOPT: "-W:no-deprecated -W:no-experimental" | |
jobs: | |
rubocop: | |
name: Rubocop | |
runs-on: [self-hosted, ubuntu-t3.medium] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 1.0 | |
- uses: actions/cache@v2 | |
with: | |
path: $HOME/.cache/rubocop_cache | |
key: netsoft-rubocop-rubocop-${{ hashFiles('.rubocop.yml') }} | |
restore-keys: | | |
netsoft-rubocop-rubocop-${{ hashFiles('.rubocop.yml') }} | |
netsoft-rubocop-rubocop- | |
- name: Rubocop | |
shell: bash | |
run: | | |
bundle exec rubocop \ | |
--parallel \ | |
--format progress | |
publish: | |
name: Publish | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | |
needs: [ rubocop ] | |
runs-on: [self-hosted, ubuntu-t3.medium] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 1.0 | |
- name: Get Tag Name | |
id: tag_name | |
shell: bash | |
run: | | |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
- name: Tag Name Validation | |
shell: bash | |
env: | |
SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }} | |
run: | | |
[ -z "$SOURCE_TAG" ] && { echo "Tag is empty"; exit 1;} | |
echo "We are on tag: [ ${SOURCE_TAG} ]" | |
- name: VERSION Validation | |
shell: bash | |
env: | |
SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }} | |
run: | | |
version=$(grep VERSION lib/netsoft/rubocop/version.rb | sed -e "s/.*'\([^']*\)'.*/\1/") | |
[[ "v$version" == "$SOURCE_TAG" ]] && { echo "VERSION $version matches $SOURCE_TAG"; exit 0; } | |
[[ "v$version" != "$SOURCE_TAG" ]] && { echo "VERSION $version does not match $SOURCE_TAG"; exit 2; } | |
- name: Release Gem | |
shell: bash | |
env: | |
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}} | |
run: | | |
./bin/setup-rubygems.sh | |
rm -rf pkg | |
rake build | |
gem push pkg/*.gem | |
danger: | |
name: Run danger | |
if: github.event_name == 'pull_request' && always() | |
needs: [ rubocop ] | |
runs-on: [self-hosted, ubuntu-t3.medium] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
- name: Install Danger | |
shell: bash | |
run: | | |
gem install netsoft-danger --no-document | |
- name: Run danger | |
shell: bash | |
env: | |
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} | |
run: | | |
danger |