Add an accept header in JSON request to help 3rd party services like localstack #5919
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: ~ | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Components tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
strategy: ['default'] | |
include: | |
# Minimum supported dependencies with the oldest PHP version | |
- php: '7.2' | |
strategy: 'lowest' | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
tools: flex | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Initialize tests | |
run: make initialize -j 4 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer | |
uses: actions/cache@v3 | |
if: steps.composer-cache.outputs.dir | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: composer-${{ github.sha }} | |
restore-keys: composer- | |
- name: Download phpunit | |
run: | | |
rm composer.* | |
composer init --no-interaction --name "async-aws/aws" | |
echo ::group::Download | |
composer require symfony/phpunit-bridge | |
echo ::endgroup:: | |
echo ::group::Install | |
./vendor/bin/simple-phpunit install | |
echo ::endgroup:: | |
- name: Modify composer.json - default | |
run: | | |
CURRENT_DIR=$(pwd) | |
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort) | |
do | |
echo ::group::$COMPONENT | |
echo "$CURRENT_DIR/$COMPONENT" | |
cd "$CURRENT_DIR/$COMPONENT" | |
sed -i -re 's/"require": \{/"repositories": [{"type": "path","url": "..\/..\/Core", "options": {"versions": {"async-aws\/core": "dev-master"}}, "canonical": ${{matrix.strategy != 'lowest' && 'true' || 'false'}} }],"require": \{/' composer.json | |
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json | |
cat composer.json | |
echo ::endgroup:: | |
done | |
cd "$CURRENT_DIR" | |
for COMPONENT in $(find src/Integration -maxdepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort) | |
do | |
echo ::group::$COMPONENT | |
echo "$CURRENT_DIR/$COMPONENT" | |
cd "$CURRENT_DIR/$COMPONENT" | |
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json | |
cat composer.json | |
echo ::endgroup:: | |
done | |
- name: Download dependencies | |
env: | |
PHP_VERSION: ${{ matrix.php }} | |
# Make sure we don't download awfully old Symfony versions. | |
SYMFONY_REQUIRE: '>=4.4' | |
run: | | |
CURRENT_DIR=$(pwd) | |
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort) | |
do | |
echo ::group::$COMPONENT | |
echo "$CURRENT_DIR/$COMPONENT" | |
cd "$CURRENT_DIR/$COMPONENT" | |
localExit=0 | |
composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1 | |
echo ::endgroup:: | |
if [ $localExit -ne 0 ]; then | |
echo "::error::$COMPONENT error" | |
exit $localExit | |
fi | |
done | |
- name: Run tests | |
env: | |
OVERRIDE_SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.strategy == 'lowest' && 'max[self]=9999' || '' }} | |
run: | | |
ok=0 | |
if [ -n "$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER" ]; then | |
export SYMFONY_DEPRECATIONS_HELPER=$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER | |
fi | |
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort) | |
do | |
echo ::group::$COMPONENT | |
localExit=0 | |
./vendor/bin/simple-phpunit -c ./$COMPONENT 2>&1 || localExit=1 | |
ok=$(( $localExit || $ok )) | |
echo ::endgroup:: | |
if [ $localExit -ne 0 ]; then | |
echo "::error::$COMPONENT failed" | |
fi | |
done | |
exit $ok | |
root: | |
name: Root tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
minimum_stability: [dev, stable] | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: none | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Initialize tests | |
run: make initialize -j 4 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: composer-${{ github.sha }} | |
restore-keys: composer- | |
- name: Download dependencies | |
run: | | |
composer config minimum-stability ${{ matrix.minimum_stability }} | |
composer update --no-interaction --prefer-dist --optimize-autoloader | |
- name: Run tests | |
run: | | |
echo ::group::Install | |
./vendor/bin/simple-phpunit install | |
echo ::endgroup:: | |
./vendor/bin/simple-phpunit |