blessing-skin-server/.github/workflows/CI.yml

108 lines
3.0 KiB
YAML
Raw Normal View History

name: CI
2019-12-05 19:01:03 +08:00
on:
push:
2019-12-10 11:09:08 +08:00
branches:
- dev
2019-12-05 19:01:03 +08:00
pull_request:
2019-12-10 11:09:08 +08:00
branches:
- dev
jobs:
2019-12-03 11:40:06 +08:00
twig:
name: Twig Linting
runs-on: ubuntu-latest
2019-12-07 23:54:06 +08:00
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
2019-12-03 11:40:06 +08:00
- name: Checkout code
2020-02-29 16:44:36 +08:00
uses: actions/checkout@v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
2019-09-17 23:17:56 +08:00
- name: Prepare
run: |
cp .env.example .env
php artisan key:generate
2019-09-17 23:10:44 +08:00
- name: Validate Twig templates
run: php artisan twig:lint -v
2019-12-03 11:40:06 +08:00
php:
name: PHP ${{ matrix.php }} Tests
2019-09-11 23:34:42 +08:00
runs-on: ubuntu-latest
2019-12-07 23:54:06 +08:00
if: "!contains(github.event.head_commit.message, 'skip ci')"
2019-12-03 11:40:06 +08:00
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4']
2019-09-11 23:34:42 +08:00
steps:
2019-12-03 11:40:06 +08:00
- name: Checkout code
2020-02-29 16:44:36 +08:00
uses: actions/checkout@v2
2019-12-03 11:40:06 +08:00
- name: Setup PHP only
2020-02-29 16:44:36 +08:00
uses: shivammathur/setup-php@v2
2019-12-03 11:40:06 +08:00
if: matrix.php != '7.2'
with:
php-version: ${{ matrix.php }}
coverage: none
2019-12-22 23:05:49 +08:00
extensions: mbstring, dom, fileinfo, sqlite, gd, zip
2019-12-03 11:40:06 +08:00
- name: Setup PHP with Xdebug
2020-02-29 16:44:36 +08:00
uses: shivammathur/setup-php@v2
2019-12-03 11:40:06 +08:00
if: matrix.php == '7.2'
with:
php-version: ${{ matrix.php }}
coverage: xdebug
2019-12-22 23:05:49 +08:00
extensions: mbstring, dom, fileinfo, sqlite, gd, zip
2019-12-03 11:40:06 +08:00
- name: Cache Composer dependencies
uses: actions/cache@v1
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Prepare application
run: |
cp .env.example .env
php artisan key:generate
- name: Run tests only
if: matrix.php != '7.2'
run: ./scripts/phpunit.ps1
shell: pwsh
- name: Run tests with coverage report
if: matrix.php == '7.2'
run: ./scripts/phpunit.ps1 -Coverage
shell: pwsh
- name: Upload coverage report
uses: codecov/codecov-action@v1
if: matrix.php == '7.2' && success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: github-actions
lint:
name: Frontend Linting
runs-on: ubuntu-latest
2019-12-07 23:54:06 +08:00
if: "!contains(github.event.head_commit.message, 'skip ci')"
2019-12-03 11:40:06 +08:00
steps:
- name: Checkout code
2020-02-29 16:44:36 +08:00
uses: actions/checkout@v2
2019-09-11 23:34:42 +08:00
- name: Install dependencies
run: yarn
2019-09-15 14:46:21 +08:00
- name: Run checks
2019-09-11 23:34:42 +08:00
run: |
2020-02-10 11:45:25 +08:00
# yarn lint
2020-01-16 16:14:49 +08:00
yarn tsc -p . --noEmit
2020-01-21 10:22:20 +08:00
yarn tsc -p ./resources/assets/tests --noEmit
2019-12-03 11:40:06 +08:00
jest:
name: Frontend Tests
runs-on: ubuntu-latest
2019-12-07 23:54:06 +08:00
if: "!contains(github.event.head_commit.message, 'skip ci')"
2019-12-03 11:40:06 +08:00
steps:
- name: Checkout code
2020-02-29 16:44:36 +08:00
uses: actions/checkout@v2
2019-12-03 11:40:06 +08:00
- name: Install dependencies
run: yarn
- name: Run tests
run: yarn test --coverage
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: github-actions