|
| 1 | +--- |
| 2 | +# Lock/Unlock Deps Pattern |
| 3 | +# |
| 4 | +# Two often conflicting goals resolved! |
| 5 | +# |
| 6 | +# - deps_unlocked.yml |
| 7 | +# - All runtime & dev dependencies, but does not have a `gemfiles/*.gemfile.lock` committed |
| 8 | +# - Uses an Appraisal2 "deps_unlocked" gemfile, and the current MRI Ruby release |
| 9 | +# - Know when new dependency releases will break local dev with unlocked dependencies |
| 10 | +# - Broken workflow indicates that new releases of dependencies may not work |
| 11 | +# |
| 12 | +# - deps_locked.yml |
| 13 | +# - All runtime & dev dependencies, and has a `Gemfile.lock` committed |
| 14 | +# - Uses the project's main Gemfile, and the current MRI Ruby release |
| 15 | +# - Matches what contributors and maintainers use locally for development |
| 16 | +# - Broken workflow indicates that a new contributor will have a bad time |
| 17 | +# |
| 18 | +name: Deps Unlocked |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +env: |
| 24 | + K_SOUP_COV_DO: false |
| 25 | + |
| 26 | +on: |
| 27 | + push: |
| 28 | + branches: |
| 29 | + - 'main' |
| 30 | + - "*-stable" |
| 31 | + tags: |
| 32 | + - '!*' # Do not execute on tags |
| 33 | + pull_request: |
| 34 | + branches: |
| 35 | + - '*' |
| 36 | + # Allow manually triggering the workflow. |
| 37 | + workflow_dispatch: |
| 38 | + |
| 39 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 40 | +concurrency: |
| 41 | + # The concurrency group contains the workflow name and the branch name. |
| 42 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 43 | + cancel-in-progress: true |
| 44 | + |
| 45 | +jobs: |
| 46 | + test: |
| 47 | + name: Default rake task w/ unlocked deps ${{ matrix.name_extra || '' }} |
| 48 | + if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')" |
| 49 | + runs-on: ubuntu-latest |
| 50 | + continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }} |
| 51 | + env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps |
| 52 | + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + include: |
| 56 | + # Ruby <whichever version is current, e.g., 3.4 as of 2025-07-12> |
| 57 | + - ruby: "ruby" |
| 58 | + appraisal_name: "deps_unlocked" |
| 59 | + exec_cmd: "rake" |
| 60 | + gemfile: "Appraisal.root" |
| 61 | + rubygems: latest |
| 62 | + bundler: latest |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Setup Ruby & RubyGems |
| 69 | + uses: ruby/setup-ruby@v1 |
| 70 | + with: |
| 71 | + ruby-version: ${{ matrix.ruby }} |
| 72 | + rubygems: ${{ matrix.rubygems }} |
| 73 | + bundler: ${{ matrix.bundler }} |
| 74 | + bundler-cache: false |
| 75 | + |
| 76 | + # Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root) |
| 77 | + # We need to do this first to get appraisal installed. |
| 78 | + # NOTE: This does not use the main Gemfile at all. |
| 79 | + - name: Install Root Appraisal |
| 80 | + run: bundle |
| 81 | + - name: Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal_name }} |
| 82 | + run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle |
| 83 | + - name: Run ${{ matrix.exec_cmd }} on ${{ matrix.ruby }}@${{ matrix.appraisal_name }} |
| 84 | + run: bundle exec appraisal ${{ matrix.appraisal_name }} bundle exec ${{ matrix.exec_cmd }} |
0 commit comments