Skip to content

[restful-api] Introduce Steep Typechecking #11

[restful-api] Introduce Steep Typechecking

[restful-api] Introduce Steep Typechecking #11

# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: Ruby on Rails - RESTful API
on:
push:
branches:
- master
paths:
- .github/actions/setup-ruby-on-rails/action.yml
- .github/workflows/restful-api.yml
- .ruby-version
- ruby-on-rails/restful-api/.ruby-version
- ruby-on-rails/restful-api/Gemfile
- ruby-on-rails/restful-api/Gemfile.lock
- ruby-on-rails/restful-api/Rakefile
- ruby-on-rails/restful-api/.rubocop.yml
- ruby-on-rails/restful-api/.rubocop_todo.yml
- ruby-on-rails/restful-api/Steepfile
- ruby-on-rails/restful-api/**/*.rb
- ruby-on-rails/restful-api/**/*.rbs
- ruby-on-rails/restful-api/**/*.rake
- ruby-on-rails/restful-api/**/*.yml
pull_request:
paths:
- .github/actions/setup-ruby-on-rails/action.yml
- .github/workflows/restful-api.yml
- .ruby-version
- ruby-on-rails/restful-api/.ruby-version
- ruby-on-rails/restful-api/Gemfile
- ruby-on-rails/restful-api/Gemfile.lock
- ruby-on-rails/restful-api/Rakefile
- ruby-on-rails/restful-api/.rubocop.yml
- ruby-on-rails/restful-api/.rubocop_todo.yml
- ruby-on-rails/restful-api/Steepfile
- ruby-on-rails/restful-api/**/*.rb
- ruby-on-rails/restful-api/**/*.rbs
- ruby-on-rails/restful-api/**/*.rake
- ruby-on-rails/restful-api/**/*.yml
permissions:
contents: read
pull-requests: read
jobs:
change-detection:
runs-on: ubuntu-latest
outputs:
ruby-changes: ${{ steps.change-detection.outputs.ruby }}
rubocop-changes: ${{ steps.change-detection.outputs.rubocop}}
steep-changes: ${{ steps.change-detection.outputs.steep}}
steps:
- uses: actions/checkout@v6
- name: Change Detection
uses: dorny/paths-filter@v4
id: change-detection
with:
filters: |
ruby:
- .github/actions/setup-ruby-on-rails/action.yml
- .github/workflows/restful-api.yml
- .ruby-version
- ruby-on-rails/restful-api/.ruby-version
- ruby-on-rails/restful-api/Gemfile
- ruby-on-rails/restful-api/Gemfile.lock
- ruby-on-rails/restful-api/Rakefile
- ruby-on-rails/restful-api/**/*.rb
- ruby-on-rails/restful-api/**/*.rake
- ruby-on-rails/restful-api/**/*.yml
rubocop:
- .github/actions/setup-ruby-on-rails/action.yml
- .github/workflows/restful-api.yml
- .ruby-version
- ruby-on-rails/restful-api/.ruby-version
- ruby-on-rails/restful-api/Gemfile
- ruby-on-rails/restful-api/Gemfile.lock
- ruby-on-rails/restful-api/Rakefile
- ruby-on-rails/restful-api/.rubocop.yml
- ruby-on-rails/restful-api/.rubocop_todo.yml
- ruby-on-rails/restful-api/**/*.rb
- ruby-on-rails/restful-api/**/*.rake
steep:
- .github/actions/setup-ruby-on-rails/action.yml
- .github/workflows/restful-api.yml
- .ruby-version
- ruby-on-rails/restful-api/.ruby-version
- ruby-on-rails/restful-api/Gemfile
- ruby-on-rails/restful-api/Gemfile.lock
- ruby-on-rails/restful-api/Rakefile
- ruby-on-rails/restful-api/Steepfile
- ruby-on-rails/restful-api/**/*.rb
- ruby-on-rails/restful-api/**/*.rbs
- ruby-on-rails/restful-api/**/*.rake
rspec:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
services:
mysql:
image: mysql:9.6.0
env:
DB_USERNAME: '${{ secrets.DB_USERNAME }}'
MYSQL_ROOT_PASSWORD: '${{ secrets.DB_ROOT_PASSWORD }}'
DB_HOST: '${{ secrets.DB_HOST }}'
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
if: needs.change-detection.outputs.ruby-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-ruby-on-rails
with:
working-directory: ./ruby-on-rails/restful-api
job-name: rspec
- name: RSpec
working-directory: ./ruby-on-rails/restful-api
run: bundle exec rspec
brakeman:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.ruby-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-ruby-on-rails
with:
working-directory: ./ruby-on-rails/restful-api
job-name: brakeman
- name: Brakeman
working-directory: ./ruby-on-rails/restful-api
run: bundle exec brakeman --no-pager
rubocop:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.rubocop-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-ruby-on-rails
with:
working-directory: ./ruby-on-rails/restful-api
job-name: rubocop
- name: RuboCop
working-directory: ./ruby-on-rails/restful-api
run: bundle exec rubocop
steep:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.steep-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-ruby-on-rails
with:
working-directory: ./ruby-on-rails/restful-api
job-name: steep
- name: Steep
working-directory: ./ruby-on-rails/restful-api
run: |
bundle exec rbs-inline --output sig/generated/ .
bundle exec steep check