1
0
mirror of https://github.com/jordansissel/fpm synced 2025-11-12 18:42:07 +01:00
fpm/.github/workflows/ruby.yml
Jordan Sissel ead34158a6 Github Actions: shard rspec by top-level description.
This is done by doing `rspec -fd --dry-run` and selecting only top-level descriptions
Then feeding that into a matrix setting.

Hopefully this will make testing faster/easier to debug when there are flakey tests.
2025-10-02 17:31:51 -07:00

47 lines
1.3 KiB
YAML

name: Ruby
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
split:
runs-on: ubuntu-24.04
outputs:
rspec_groups: ${{ steps.groups.outputs.rspec_groups }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- id: groups
run: |
printf "rspec_groups<<JSON\n" >> $GITHUB_OUTPUT
bundle exec rspec -fd --dry-run | sed -ne '/^Finished in /q; /^\S/p' | jq -R | jq -s >> $GITHUB_OUTPUT
printf "JSON\n" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-22.04
needs: [ split ]
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.4']
rspec-group: ${{ fromJSON(needs.split.outputs.rspec_groups) }}
steps:
- run: |
sudo apt-get update
sudo apt install -y libarchive-tools lintian cpanminus
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: |
[ ! -z "$RUNNER_DEBUG" ] && export DEBUG=1
bundle exec rspec -fd -e "${{ matrix.rspec-group }}"
env:
SHELL: /usr/bin/bash