Skip to content

Merge pull request #39 from github/deprecate-ruby-2 #206

Merge pull request #39 from github/deprecate-ruby-2

Merge pull request #39 from github/deprecate-ruby-2 #206

Workflow file for this run

name: acceptance
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
# Detects changes to any of the source files for entitlements-app
changes:
runs-on: ubuntu-latest
outputs:
has_change: ${{ steps.diff.outputs.has_change}}
steps:
- uses: actions/checkout@v4
- id: fetch-base
if: github.event_name == 'pull_request'
name: fetch the latest commit in the base branch to diff against
run: git fetch --no-tags --prune --depth=1 origin '+refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}'
- id: diff
if: github.event_name == 'pull_request'
name: diff against the base branch latest commit for specific paths
run: |
git diff \
origin/${{ github.base_ref }} \
HEAD \
-- \
'bin/**' \
'lib/**' \
'script/**' \
'spec/**' \
'vendor/**' \
'.ruby-version' \
'entitlements.gemspec' \
'Gemfile' \
'Gemfile.lock' \
> diff.txt
# If the diff file is not empty, it has changes.
[ -s diff.txt ] && echo "has_change=true" >> "$GITHUB_OUTPUT" || echo "has_change=false" >> "$GITHUB_OUTPUT"
- name: set has_change to true for push to main/master
if: github.event_name == 'push'
run: echo "has_change=true" >> "$GITHUB_OUTPUT"
acceptance-suite:
needs: changes
runs-on: ubuntu-latest-xl
name: runner / acceptance-tests
strategy:
matrix:
ruby: [ '3.1.2', '3.2.2', '3.3.0', '3.3.1' ]
steps:
- uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # [email protected]
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
# If source files were not changed, we don't need the acceptance test suite
- name: bypass
if: ${{ needs.changes.outputs.has_change != 'true' }}
run: |
echo "✅ Bypassing acceptance tests - they are not required for this change"
- name: checkout
if: ${{ needs.changes.outputs.has_change == 'true' }}
uses: actions/checkout@v4
# Use Docker layer caching for 'docker build' and 'docker-compose build' commands.
# https://github.com/satackey/action-docker-layer-caching/releases/tag/v0.0.11
- uses: satackey/action-docker-layer-caching@46d2c640b1d8ef50d185452ad6fb324e6bd1d052
if: ${{ needs.changes.outputs.has_change == 'true' }}
continue-on-error: true
- name: acceptance tests
if: ${{ needs.changes.outputs.has_change == 'true' }}
run: script/cibuild-entitlements-app-acceptance
- name: acceptance tests passed
run: echo "✅ The acceptance test suite has passed"