2019-11-27 07:30:34 +07:00
|
|
|
# GitHub Action for roots/sage
|
|
|
|
name: Testing Sage
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
|
|
sage:
|
|
|
|
name: Sage (PHP ${{ matrix.php-versions }} & Node ${{ matrix.node-versions }})
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
|
|
|
node-versions: ['8', '10']
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2020-01-02 00:06:25 +07:00
|
|
|
uses: actions/checkout@v2
|
2019-11-27 07:30:34 +07:00
|
|
|
- name: Setup Node.js
|
2019-11-28 06:47:56 +07:00
|
|
|
uses: actions/setup-node@v1
|
2019-11-27 07:30:34 +07:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-versions }}
|
|
|
|
- name: Setup PHP, with composer and extensions
|
2020-02-14 14:15:46 +07:00
|
|
|
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
2019-11-27 07:30:34 +07:00
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2019-12-09 12:22:43 +07:00
|
|
|
extensions: mbstring
|
2019-11-27 07:30:34 +07:00
|
|
|
- name: Check node versions
|
|
|
|
run: node -v
|
|
|
|
- name: Get yarn cache
|
|
|
|
id: yarn-cache
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
2020-05-30 12:57:44 +07:00
|
|
|
- uses: actions/cache@v2
|
2019-11-27 07:30:34 +07:00
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-yarn-
|
|
|
|
- name: Get composer cache directory
|
2020-06-19 05:56:37 +07:00
|
|
|
id: composercache
|
2019-11-27 07:30:34 +07:00
|
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
2020-05-30 12:57:44 +07:00
|
|
|
uses: actions/cache@v2
|
2019-11-27 07:30:34 +07:00
|
|
|
with:
|
2020-06-19 05:56:37 +07:00
|
|
|
path: ${{ steps.composercache.outputs.dir }}
|
2019-12-28 01:53:51 +07:00
|
|
|
# Use composer.json for key, if composer.lock is not committed.
|
|
|
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
2019-11-27 07:30:34 +07:00
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-composer-
|
|
|
|
- name: Install yarn dependencies
|
|
|
|
run: yarn -V
|
|
|
|
- name: Install Composer dependencies
|
2020-06-19 12:22:35 +07:00
|
|
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
2019-11-27 07:30:34 +07:00
|
|
|
- name: Yarn test and build
|
|
|
|
run: |
|
|
|
|
yarn run test
|
|
|
|
yarn run build
|
|
|
|
yarn run rmdist
|
|
|
|
yarn run "build:production"
|
|
|
|
- name: PHP test
|
|
|
|
run: composer test
|