Build #1196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 22 * * *' | |
env: | |
extensions: mbstring, mysql, redis | |
key: cache-v1 # can be any string, change to clear the extension cache. | |
jobs: | |
phpunit: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.2', '7.3', '7.4' ] | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: miaoxing | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
redis: | |
image: redis | |
ports: | |
- 6379/tcp | |
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-phpunit | |
env: | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
REDIS_PORT: ${{ job.services.redis.ports[6379] }} | |
- name: Upload coverage results to Coveralls | |
continue-on-error: true | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }} | |
run: | | |
composer global require twinh/php-coveralls | |
php-coveralls --coverage_clover=build/logs/clover.xml -vvv | |
jest: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [ 14, 16, 18, 20 ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep '' main | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Composer install | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Yarn install | |
run: yarn install --ignore-engines | |
- name: Run | |
run: yarn miaoxing-jest | |
- name: Coveralls | |
if: startsWith(hashFiles('coverage/lcov.info'), '5df6e0e27613') == false | |
continue-on-error: true | |
env: | |
COVERALLS_FLAG_NAME: node-${{ matrix.node-version }} | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
coveralls-finish: | |
needs: [ phpunit, jest ] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true | |
phpstan: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.4' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-phpstan | |
phpcs: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.4' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-phpcs | |
phpmd: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.4' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-phpmd | |
phpmnd: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.4' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-phpmnd | |
php-cs-fixer: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '7.4' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep composer.json main | |
- name: Composer install | |
run: | | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run | |
run: ./vendor/bin/miaoxing-php-cs-fixer | |
eslint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 20 ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep package.json main | |
- name: Yarn install | |
run: yarn install | |
- name: Run | |
run: yarn miaoxing-eslint | |
stylelint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 20 ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Replace package dependencies | |
run: npx replace-pkg-dep package.json main | |
- name: Yarn install | |
run: yarn install | |
- name: Run | |
run: yarn miaoxing-stylelint |