Skip to content

test with spot

test with spot #53

Workflow file for this run

name: PHP Composer
on:
push:
branches: [ master ]
pull_request:
branches: [ master, rc-* ]
jobs:
detect-targets:
runs-on: ubuntu-latest
outputs:
modified_targets: ${{ steps.filter.outputs.modified_targets }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Detect modified targets
id: filter
run: |
MODIFIED_TARGETS=("spot")
# # Determine base commit: use HEAD^ if it exists, otherwise use the first commit
# if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
# BASE_COMMIT="HEAD^"
# else
# BASE_COMMIT=$(git rev-list --max-parents=0 HEAD)
# fi
# # Loop through each client directory in "src/"
# for client in src/*; do
# CLIENT_NAME=$(basename "$client")
# # Check for changes in the client directory between BASE_COMMIT and HEAD
# if ! git diff --quiet "$BASE_COMMIT" HEAD -- "$client"; then
# echo "Changes detected in $CLIENT_NAME"
# MODIFIED_TARGETS+=("$CLIENT_NAME")
# fi
# done
# Convert the array of modified targets into a JSON array
MODIFIED_TARGETS_JSON=$(printf '%s\n' "${MODIFIED_TARGETS[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "modified_targets: $MODIFIED_TARGETS_JSON"
echo "modified_targets=$MODIFIED_TARGETS_JSON" >> $GITHUB_ENV
echo "::set-output name=modified_targets::$MODIFIED_TARGETS_JSON"
phpunit:
runs-on: ubuntu-latest
needs: detect-targets
name: PHP Tests
strategy:
matrix:
target: ${{ fromJson(needs.detect-targets.outputs.modified_targets) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Install dependencies and run tests
if: ${{ matrix.target != 'common' }}
run: |
composer install --ignore-platform-reqs && ./vendor/phpunit/phpunit/phpunit src/${{ matrix.target }}