2022-06-07 19:20:09 +03:00
|
|
|
name: acceptance
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
|
2024-03-18 18:59:44 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-06-07 19:20:09 +03:00
|
|
|
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:
|
2024-03-18 18:46:22 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-07 19:20:09 +03:00
|
|
|
|
|
|
|
- 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.
|
2024-01-23 04:34:46 +03:00
|
|
|
[ -s diff.txt ] && echo "has_change=true" >> "$GITHUB_OUTPUT" || echo "has_change=false" >> "$GITHUB_OUTPUT"
|
2022-08-10 04:59:29 +03:00
|
|
|
|
2022-06-07 19:20:09 +03:00
|
|
|
- name: set has_change to true for push to main/master
|
|
|
|
if: github.event_name == 'push'
|
2024-01-23 04:34:46 +03:00
|
|
|
run: echo "has_change=true" >> "$GITHUB_OUTPUT"
|
2022-06-07 19:20:09 +03:00
|
|
|
|
|
|
|
acceptance-suite:
|
|
|
|
needs: changes
|
2024-05-30 19:30:06 +03:00
|
|
|
runs-on: ubuntu-latest-xl
|
2022-06-07 19:20:09 +03:00
|
|
|
name: runner / acceptance-tests
|
2022-08-10 05:14:22 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-30 19:19:14 +03:00
|
|
|
ruby: [ '3.1.2', '3.2.2', '3.3.0', '3.3.1' ]
|
2022-06-07 19:20:09 +03:00
|
|
|
|
|
|
|
steps:
|
2024-05-29 22:52:52 +03:00
|
|
|
- uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # pin@v1.175.1
|
2022-08-10 05:05:16 +03:00
|
|
|
with:
|
2023-08-29 22:53:07 +03:00
|
|
|
bundler-cache: true
|
2022-08-10 05:05:16 +03:00
|
|
|
ruby-version: ${{ matrix.ruby }}
|
|
|
|
|
2022-06-07 19:20:09 +03:00
|
|
|
# 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"
|
|
|
|
|
2023-08-29 22:53:07 +03:00
|
|
|
- name: checkout
|
2022-06-07 19:20:09 +03:00
|
|
|
if: ${{ needs.changes.outputs.has_change == 'true' }}
|
2024-03-18 18:46:22 +03:00
|
|
|
uses: actions/checkout@v4
|
2022-06-07 19:20:09 +03:00
|
|
|
|
|
|
|
# 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' }}
|
2022-08-10 05:05:16 +03:00
|
|
|
run: script/cibuild-entitlements-app-acceptance
|
2022-06-07 19:20:09 +03:00
|
|
|
|
|
|
|
- name: acceptance tests passed
|
|
|
|
run: echo "✅ The acceptance test suite has passed"
|