Skip to content

phplint

phplint #2

Workflow file for this run

name: List Test Deploy
on:
push:
branches:
- "production"
- "staging"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phplint, laravel/pint
- name: Check syntax
run: phplint .
- name: Check code style
run: pint --test
test:
needs: lint
strategy:
matrix:
operating-system:
- ubuntu-latest
php-version:
- '8.3'
name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo, tokenizer, xml
coverage: xdebug
- name: Prepare the environment
run: cp .env.example .env
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Setup composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate application key
run: php artisan key:generate
- name: Run Feature and Unit Tests
run: php artisan test --coverage --min=38 --testsuite Unit,Feature
env:
DB_CONNECTION: mysql
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_USERNAME: root
DB_DATABASE: test
DB_PASSWORD: null
PASSPORT_PRIVATE_KEY: ${{ secrets.TESTS_PASSPORT_PRIV_KEY}}
PASSPORT_PUBLIC_KEY: ${{ secrets.TESTS_PASSPORT_PUB_KEY}}
deploy:
needs: test
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
coverage: none
- name: Require Vapor CLI
run: composer global require laravel/vapor-cli
- name: Install Project Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Deploy Environment
run: vapor deploy ${{ github.ref_name }} --commit="${{ github.event.head_commit.id }}" --message="${{ github.event.head_commit.message }}"
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}