Skip to content

Add basic functions

Add basic functions #1

Workflow file for this run

name: cbrfservice_laravel
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: CBRF service for laravel (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['8.2', '8.3']
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 and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-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
- name: Run infection testing
run: composer run-script infection
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']
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 }}
- name: Install CBRF service
run: |
cd example-app
composer req "liquetsoft/cbrfservice-laravel:dev-${{ steps.extract_branch.outputs.branch }}" -W
php artisan config:clear
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}