Skip to content

Commit

Permalink
update github actions to use shared config (#23)
Browse files Browse the repository at this point in the history
* update github actions to use shared config

* update rubocop

* update target ruby version and gemspec dev dependency cop

* only run ci on pull requests and pushes to main

* inherit secrets in CI config
  • Loading branch information
schoblaska authored May 17, 2024
1 parent 9b09e8b commit 71336be
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 69 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@ on:
workflows: [CI]
types: [completed]
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Tag and Push Gem
id: tag-and-push-gem
uses: discourse/publish-rubygems-action@v2
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GIT_EMAIL: ${{secrets.GUSTO_GIT_NAME}}
GIT_NAME: ${{secrets.GUSTO_GIT_EMAIL}}
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
- name: Create GitHub Release
run: gh release create v${{steps.tag-and-push-gem.outputs.gem_version}} --generate-notes
if: ${{ steps.tag-and-push-gem.outputs.new_version == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/cd.yml@main
secrets: inherit
46 changes: 8 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
name: CI

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- 2.7
# See comment comes from https://github.com/ruby/setup-ruby#matrix-of-ruby-versions
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
- '3.0'
- 3.1
- 3.2
- 3.3
- head
env:
BUNDLE_GEMFILE: Gemfile
name: "RSpec tests: Ruby ${{ matrix.ruby }}"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Run tests
run: bundle exec rspec
static_type_check:
name: "Type Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: head
- name: Run static type checks
run: bundle exec srb tc
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/ci.yml@main
secrets: inherit
8 changes: 8 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'Close stale issues and PRs'

on:
schedule:
- cron: '0 0 * * *'
jobs:
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/stale.yml@main
9 changes: 9 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Label issues as "triage"

on:
issues:
types:
- opened
jobs:
call-workflow-from-shared-config:
uses: rubyatscale/shared-config/.github/workflows/triage.yml@main
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ AllCops:
NewCops: enable
Exclude:
- vendor/bundle/**/**
TargetRubyVersion: 2.6

Metrics/ParameterLists:
Enabled: false
Expand Down Expand Up @@ -120,3 +121,7 @@ Layout/BlockEndNewline:
Naming/FileName:
Exclude:
- lib/packs-specification.rb

Gemspec/DevelopmentDependencies:
Enabled: true
EnforcedStyle: gemspec
30 changes: 17 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ GEM
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
json (2.6.3)
json (2.7.2)
language_server-protocol (3.17.0.3)
method_source (1.0.0)
netrc (0.11.0)
parallel (1.22.1)
parser (3.1.2.1)
parallel (1.24.0)
parser (3.3.1.0)
ast (~> 2.4.1)
racc
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)
rainbow (3.1.1)
rake (13.0.6)
rbi (0.0.16)
ast
parser (>= 2.6.4.0)
sorbet-runtime (>= 0.5.9204)
unparser
regexp_parser (2.6.1)
rexml (3.2.5)
regexp_parser (2.9.1)
rexml (3.2.6)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
Expand All @@ -41,19 +44,20 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.1)
rubocop (1.41.0)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
sorbet (0.5.11370)
sorbet-static (= 0.5.11370)
sorbet-runtime (0.5.11370)
Expand All @@ -77,7 +81,7 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.2.1)
unicode-display_width (2.3.0)
unicode-display_width (2.5.0)
unparser (0.6.5)
diff-lcs (~> 1.3)
parser (>= 3.1.0)
Expand Down

0 comments on commit 71336be

Please sign in to comment.