Update composer.json (#100) #170
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: liquetsoft_fias | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: Liquetsoft FIAS (PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php-versions: ['8.2', '8.3'] | |
laravel-versions: ['^9.0', '^10.0', '^11.0'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Check PHP Version | |
run: php -v | |
- name: Validate composer.json | |
run: composer validate | |
- name: Set up Laravel components versions | |
run: "sed -i -E \"s#\\\"(laravel/.+)\\\".*:.*\\\"(.+)\\\"#\\\"\\1\\\":\\\"${{ matrix.laravel-versions }}\\\"#g\" composer.json" | |
- name: Set up Illuminate components versions | |
run: "sed -i -E \"s#\\\"(illuminate/.+)\\\".*:.*\\\"(.+)\\\"#\\\"\\1\\\":\\\"${{ matrix.laravel-versions }}\\\"#g\" composer.json" | |
- name: Show composer.json | |
run: cat composer.json | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v2 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-${{ matrix.laravel-versions }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run test suite | |
run: composer run-script test | |
- name: Run linters | |
run: composer run-script linter | |
laravel: | |
name: Testing installation to laravel (PHP ${{ matrix.php-version }}, Laravel ${{ matrix.laravel-version }}) | |
runs-on: ubuntu-latest | |
env: | |
DB_DATABASE: laravel | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: laravel | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: ['8.2', '8.3'] | |
laravel-version: ['^9.0', '^10.0', '^11.0'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, dom, fileinfo, mysql, curl | |
- name: Start mysql service | |
run: sudo /etc/init.d/mysql start | |
- name: Branch used | |
id: extract_branch | |
run: | | |
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then | |
echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})" | |
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then | |
echo "::set-output name=branch::$(echo $GITHUB_HEAD_REF)" | |
else | |
echo "::set-output name=branch::INVALID_EVENT_BRANCH_UNKNOWN" | |
fi | |
- name: Install Laravel | |
run: | | |
composer create-project laravel/laravel example-app ${{ matrix.laravel-version }} | |
unzip ./tests/Pipeline/_fixtures/install_AddressObject.zip -d ./example-app/fias-data-install | |
unzip ./tests/Pipeline/_fixtures/update_AddressObject.zip -d ./example-app/fias-data-update | |
- name: Install FIAS | |
run: | | |
cd example-app | |
composer req "liquetsoft/fias-laravel:dev-${{ steps.extract_branch.outputs.branch }}" -W | |
php artisan config:clear | |
php artisan migrate -v | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} | |
- name: Test FIAS | |
run: | | |
cd example-app | |
php artisan liquetsoft:fias:truncate | |
php artisan liquetsoft:fias:install_from_folder ./fias-data-install | |
php artisan liquetsoft:fias:update_from_folder ./fias-data-update | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} |