Skip to content

Instantly share code, notes, and snippets.

@mathieutu
Created March 25, 2020 18:18
Show Gist options
  • Select an option

  • Save mathieutu/b47e3900bf50ff6adcf8ca8b2dbe8180 to your computer and use it in GitHub Desktop.

Select an option

Save mathieutu/b47e3900bf50ff6adcf8ca8b2dbe8180 to your computer and use it in GitHub Desktop.
Github action php laravel
name: Back
on: [push]
jobs:
tests:
name: Tests d'API
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: root
POSTGRES_DB: local
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
extensions: pdo, pdo_pgsql, bcmath
tools: prestissimo
coverage: none
- name: Setup Problem Matchers for PHPUnit
uses: mheap/phpunit-matcher-action@master
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
working-directory: ./src/back
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Run composer install
run: composer install -n --prefer-dist
working-directory: ./src/back
- name: Run tests
run: ./vendor/bin/phpunit --teamcity
working-directory: ./src/back
env:
DATABASE_URL: postgresql://root:@127.0.0.1:5432/local
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
tools: phpcs, cs2pr
coverage: none
- name: Run Lint
run: phpcs -nq --report=checkstyle | cs2pr
working-directory: ./src/back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment