Skip to content

Commit

Permalink
Add yard as a required build step to GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Burgestrand committed Oct 11, 2024
1 parent 63b9e3b commit e244fc2
Showing 1 changed file with 71 additions and 57 deletions.
128 changes: 71 additions & 57 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Main

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch:

permissions:
Expand All @@ -28,85 +28,99 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '3.3'
- 'jruby-9.3.10' # oldest supported jruby
- 'jruby'
- "3.1"
- "3.2"
- "3.3"
- "jruby-9.3.10" # oldest supported jruby
- "jruby"
include: # HEAD-versions
- ruby-version: 'head'
- ruby-version: "head"
allow-failure: true
- ruby-version: 'jruby-head'
- ruby-version: "jruby-head"
allow-failure: true
- ruby-version: 'truffleruby-head'
- ruby-version: "truffleruby-head"
allow-failure: true

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: ${{ !startsWith(matrix.ruby-version, 'jruby') }}
- name: Bundler install (JRuby workaround)
if: ${{ startsWith(matrix.ruby-version, 'jruby') }}
run: |
gem install psych
bundle install
- name: Run tests
run: bundle exec rspec
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: ${{ !startsWith(matrix.ruby-version, 'jruby') }}
- name: Bundler install (JRuby workaround)
if: ${{ startsWith(matrix.ruby-version, 'jruby') }}
run: |
gem install psych
bundle install
- name: Run tests
run: bundle exec rspec

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: 'ruby'
bundler-cache: true
- name: "Download cc-test-reporter from codeclimate.com"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: "Report to Code Climate that we will send a coverage report."
run: ./cc-test-reporter before-build
- name: Run tests
run: bundle exec rspec
env:
COVERAGE: 1
- name: Upload code coverage to Code Climate
run: |
./cc-test-reporter after-build \
--coverage-input-type simplecov \
./coverage/.resultset.json
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "ruby"
bundler-cache: true
- name: "Download cc-test-reporter from codeclimate.com"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: "Report to Code Climate that we will send a coverage report."
run: ./cc-test-reporter before-build
- name: Run tests
run: bundle exec rspec
env:
COVERAGE: 1
- name: Upload code coverage to Code Climate
run: |
./cc-test-reporter after-build \
--coverage-input-type simplecov \
./coverage/.resultset.json
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: default
ruby-version: 'ruby'
bundler-cache: false
- run: bundle install
- name: Run RuboCop
run: bundle exec rubocop
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: default
ruby-version: "ruby"
bundler-cache: false
- run: bundle install
- name: Run RuboCop
run: bundle exec rubocop

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
rubygems: default
ruby-version: "ruby"
bundler-cache: false
- run: bundle install
- run: rake yard

required-checks:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- test
- matrix-test
- docs
- rubocop
steps:
- name: failure
if: ${{ failure() || contains(needs.*.result, 'failure') }}
run: exit 1
- name: success
run: exit 0
run: exit 0

0 comments on commit e244fc2

Please sign in to comment.