Skip to content

Build

Build #438

Workflow file for this run

name: Build
on:
push:
branches: ['*']
pull_request:
branches: ['*']
schedule:
- cron: "0 0 * * 5"
jobs:
PHPUnit-MySQL:
strategy:
fail-fast: false
matrix:
php_versions: ['7.3', '7.4', '8.0', '8.1']
runs-on: ubuntu-latest
name: PHPUnit - PHP ${{ matrix.php_versions }} - MySQL
env:
TEST_DB: default
DB_DRIVER: mysql
DB_HOST: 127.0.0.1
DB_USER: userfrosting
DB_PASSWORD: password
DB_NAME: userfrosting
DB_PORT: 3306
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite
coverage: xdebug
tools: pecl, composer
- uses: actions/setup-node@v2
with:
node-version: ^14.0.0
- name: Setup Redis-server
uses: supercharge/[email protected]
with:
redis-version: 6
- name: Setup Memcached
uses: niden/actions-memcached@v7
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Set up MySQL (PHP <= 7.3 -> MySQL 5)
if: ${{ matrix.php_versions == 7.3 }}
uses: mirromutth/[email protected]
with:
mysql version: '5'
mysql database: 'userfrosting'
mysql user: 'userfrosting'
mysql password: 'password'
- name: Set up MySQL (PHP >= 7.4 -> MySQL 8)
if: ${{ matrix.php_versions != 7.3 }}
uses: mirromutth/[email protected]
with:
mysql version: '8'
mysql database: 'userfrosting'
mysql user: 'userfrosting'
mysql password: 'password'
- name: Wait for MySQL
run: |
while ! mysqladmin ping --host=127.0.0.1 --password=password --silent; do
sleep 1
done
- name: Copy .env
run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');"
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Bakery Debug
run: php bakery debug
- name: Migrate DB
run: php bakery migrate
- name: Build Assets
run: php bakery build-assets
- name: Execute tests
run: |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
app/vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
if: github.event_name != 'schedule'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
PHPUnit-SQLite:
strategy:
fail-fast: false
matrix:
php_versions: ['7.3', '7.4', '8.0', '8.1']
runs-on: ubuntu-latest
name: PHPUnit - PHP ${{ matrix.php_versions }} - SQLite
env:
TEST_DB: default
DB_DRIVER: sqlite
DB_NAME: database/database.sqlite
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite
coverage: xdebug
tools: pecl, composer
- uses: actions/setup-node@v2
with:
node-version: ^14.0.0
- name: Setup Redis-server
uses: supercharge/[email protected]
with:
redis-version: 6
- name: Setup Memcached
uses: niden/actions-memcached@v7
- name: Copy .env
run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');"
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Create SQLite Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Bakery Debug
run: php bakery debug
- name: Migrate DB
run: php bakery migrate
- name: Build Assets
run: php bakery build-assets
- name: Execute tests
run: |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
app/vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
if: github.event_name != 'schedule'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
PHPUnit-Postgre:
strategy:
fail-fast: false
matrix:
php_versions: ['7.3', '7.4', '8.0', '8.1']
runs-on: ubuntu-latest
name: PHPUnit - PHP ${{ matrix.php_versions }} - PostgreSQL
env:
TEST_DB: default
DB_DRIVER: pgsql
DB_HOST: 127.0.0.1
DB_USER: userfrosting
DB_PASSWORD: password
DB_NAME: userfrosting
DB_PORT: 5432
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite, pdo_pgsql
coverage: xdebug
tools: pecl, composer
- name: Setup PostgreSQL
uses: harmon758/postgresql-action@v1
with:
postgresql db: 'userfrosting'
postgresql user: 'userfrosting'
postgresql password: 'password'
- uses: actions/setup-node@v2
with:
node-version: ^14.0.0
- name: Setup Redis-server
uses: supercharge/[email protected]
with:
redis-version: 6
- name: Setup Memcached
uses: niden/actions-memcached@v7
- name: Copy .env
run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');"
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Bakery Debug
run: php bakery debug
- name: Migrate DB
run: php bakery migrate
- name: Build Assets
run: php bakery build-assets
- name: Execute tests
run: |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
app/vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
if: github.event_name != 'schedule'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
PHPUnit-Windows:
strategy:
fail-fast: false
matrix:
php_versions: ['7.3', '7.4', '8.0', '8.1']
runs-on: windows-latest
name: PHPUnit - PHP ${{ matrix.php_versions }} - Windows
env:
TEST_DB: default
DB_DRIVER: sqlite
DB_NAME: database/database.sqlite
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: mbstring, dom, fileinfo, gd, pdo, sqlite, pdo_sqlite
coverage: xdebug
tools: pecl, composer
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Copy .env
run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');"
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Create SQLite Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Bakery Debug
run: php bakery debug
- name: Migrate DB
run: php bakery migrate
- name: Build Assets
run: php bakery build-assets
- name: Execute tests
run: |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
app/vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
Asset-Build:
strategy:
fail-fast: false
matrix:
php_versions: [ '8.0' ]
node_versions: [ ^12.17.0, ^14, ^15 ]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: Assets Build - PHP ${{ matrix.php_versions }} - Node ${{ matrix.node_versions }} - ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: mbstring, dom, fileinfo, gd
coverage: xdebug
tools: pecl, composer
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_versions }}
- name: Copy .env
run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');"
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Execute build
run: php bakery build-assets
# Asset-Build-Inspect:
# name: Assets Build Inspection
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: ^14.0.0
# - name: Install Dependencies
# working-directory: build
# run: npm i
# - name: Type Validation
# working-directory: build
# run: node_modules/.bin/tsc -p ./tsconfig.json