Skip to content

Merge pull request #1423 from fetus-hina/autoupdate-depends-1731972052 #4258

Merge pull request #1423 from fetus-hina/autoupdate-depends-1731972052

Merge pull request #1423 from fetus-hina/autoupdate-depends-1731972052 #4258

Workflow file for this run

name: CI
'on':
- push
- pull_request
env:
UTILITY_PHP_VERSION: '8.2'
jobs:
ciDoesNotSkip:
name: 'Tag Check: `[ci skip]`'
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
-
run: |
echo "CI Running"
phpSyntaxCheck:
name: 'PHP Syntax Check (PHP ${{ matrix.php.version }})'
strategy:
matrix:
php:
-
version: '8.2'
multiple: false
experimental: false
-
version: '8.3'
multiple: true
experimental: false
-
version: '8.4'
multiple: true
experimental: true
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
if: "!contains(github.event.head_commit.message, '[no php]')"
steps:
-
uses: actions/checkout@v4
-
name: 'Set PHP environment (PHP ${{ matrix.php.version }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php.version }}'
extensions: :php-psr
-
name: 'Syntax Check'
continue-on-error: '${{ matrix.php.experimental }}'
run: |
find . \( -type d \( -name '.git' -or -name 'vendor' -or -name 'runtime' -or -name 'node_modules' \) -prune \) -or \( -type f -name '*.php' -print \) \
| sort \
| xargs ${{ matrix.php.multiple && ' ' || ' -n 1 '}} php -l
env:
LANG: C
phpStyleCheck:
name: 'PHP Coding Style'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
- phpSyntaxCheck
- setupComposer
if: "!contains(github.event.head_commit.message, '[no php]')"
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
vendor
~/.cache/composer/files
key: "composer-${{ hashFiles('composer.lock') }}"
-
name: 'Set PHP environment (PHP ${{ env.UTILITY_PHP_VERSION }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ env.UTILITY_PHP_VERSION }}'
extensions: :php-psr
-
name: 'Run PHPCS'
run: 'php vendor/bin/phpcs -p'
phpCheckAuthor:
name: 'Check Author'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
if: "!contains(github.event.head_commit.message, '[no php]') && !contains(github.event.head_commit.message, '[no author]')"
steps:
-
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: 'Composer cache'
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: 'author-composer-cache-${{ github.sha }}'
restore-keys: author-composer-cache-
-
name: 'Set PHP environment (PHP 7.4)'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
-
name: 'Prepare for phpcq/author-validation'
run: |
rm -f composer.json
mv composer.check-author.json composer.json
-
name: 'Install phpcq/author-validation'
uses: nick-invision/retry@v3
with:
timeout_seconds: 300
max_attempts: 3
retry_on: error
command: |
rm -rf composer.lock vendor
make composer.phar
./composer.phar update
-
name: 'Execute check-author.php'
run: |
patch -p0 -d vendor/phpcq/author-validation < data/patch/check-author.nofollow.patch
php -d memory_limit=-1 vendor/bin/check-author.php --php-files \
actions \
assets \
commands \
components \
controllers \
messages \
migrations \
models
phpComposerStyle:
name: 'Check composer.json normalized'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
- phpSyntaxCheck
- setupComposer
if: "!contains(github.event.head_commit.message, '[no php]')"
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
vendor
~/.cache/composer/files
key: "composer-${{ hashFiles('composer.lock') }}"
-
name: 'Set PHP environment (PHP ${{ env.UTILITY_PHP_VERSION }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ env.UTILITY_PHP_VERSION }}'
extensions: :php-psr
-
name: 'Check composer.json normalized'
run: 'composer.phar normalize --dry-run'
setupNPM:
name: 'Setup NPM (install node_modules)'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: "npm-2-${{ hashFiles('package-lock.json') }}"
restore-keys: npm-2-
-
name: 'Use node.js 20 LTS'
uses: actions/setup-node@v4
with:
node-version: '20'
-
name: 'Install NPM packages'
run: 'npm clean-install'
jsStyleCheck:
name: 'JS Coding Style'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
- setupNPM
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: "npm-2-${{ hashFiles('package-lock.json') }}"
-
name: 'Use node.js 20 LTS'
uses: actions/setup-node@v4
with:
node-version: '20'
-
name: 'Run `semistandard`'
run: 'npx semistandard "resources/**/*[ej]s"'
cssStyleCheck:
name: 'CSS Coding Style'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
- setupNPM
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: "npm-2-${{ hashFiles('package-lock.json') }}"
-
name: 'Use node.js 20 LTS'
uses: actions/setup-node@v4
with:
node-version: '20'
-
name: 'Run StyleLint'
run: 'npx stylelint "resources/**/*.scss" "resources/**/*.css"'
setupComposer:
name: 'Setup Composer (install vendor)'
runs-on: ubuntu-22.04
needs:
- ciDoesNotSkip
- phpSyntaxCheck
if: "!contains(github.event.head_commit.message, '[no php]')"
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
vendor
~/.cache/composer/files
key: "composer-${{ hashFiles('composer.lock') }}"
restore-keys: composer-
-
name: 'Set PHP environment (PHP ${{ env.UTILITY_PHP_VERSION }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ env.UTILITY_PHP_VERSION }}'
extensions: :php-psr
-
name: 'Install composer packages'
run: |
rm -rf vendor
make composer.phar
make vendor
licenseCheck:
name: 'Check license'
needs:
- ciDoesNotSkip
- setupComposer
- setupNPM
runs-on: ubuntu-22.04
steps:
-
name: 'Install packages'
run: |
sudo apt update -y
sudo apt install -y jpegoptim libxml2-utils
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
vendor
~/.cache/composer/files
key: "composer-${{ hashFiles('composer.lock') }}"
-
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: "npm-2-${{ hashFiles('package-lock.json') }}"
-
name: 'Set PHP environment (PHP ${{ env.UTILITY_PHP_VERSION }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ env.UTILITY_PHP_VERSION }}'
extensions: :php-psr
-
name: 'Use node.js 20 LTS'
uses: actions/setup-node@v4
with:
node-version: '20'
-
name: 'Basic setup the app'
run: 'make init-no-resource'
-
name: 'Check licenses'
run: './yii license'
phpUnit:
name: 'Build & Test (PHP ${{ matrix.php.version }}, PgSQL ${{ matrix.pgsql.version }})'
needs:
- ciDoesNotSkip
- phpSyntaxCheck
- setupComposer
- setupNPM
if: "!contains(github.event.head_commit.message, '[no php]')"
continue-on-error: '${{ matrix.php.experimental || matrix.pgsql.experimental }}'
strategy:
matrix:
php:
-
version: '8.2'
experimental: false
-
version: '8.3'
experimental: false
-
version: '8.4'
experimental: true
pgsql:
-
version: '11'
experimental: false
image: 11-alpine
-
version: latest
experimental: false
image: alpine
services:
postgres:
image: 'postgres:${{ matrix.pgsql.image }}'
ports:
- '5432:5432'
env:
POSTGRES_USER: statink
POSTGRES_PASSWORD: statink
POSTGRES_DB: statink
POSTGRES_INITDB_ARGS: '-E UTF-8 --locale=en_US.UTF8 -k'
options: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5'
env:
GEOIP_LICENSE_KEY: '${{ secrets.GEOIP_LICENSE_KEY }}'
runs-on: ubuntu-22.04
steps:
-
name: 'Install packages'
run: |
sudo apt update -y
sudo apt install -y jpegoptim libxml2-utils
-
uses: actions/checkout@v4
-
uses: actions/cache@v4
with:
path: |
vendor
~/.cache/composer/files
key: "composer-${{ hashFiles('composer.lock') }}"
-
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: "npm-2-${{ hashFiles('package-lock.json') }}"
-
name: 'Set PHP environment (PHP ${{ matrix.php.version }})'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php.version }}'
extensions: :php-psr
-
name: 'Use node.js 20 LTS'
uses: actions/setup-node@v4
with:
node-version: '20'
-
name: 'Basic setup the app'
run: 'make init'
-
name: 'Reset DB config'
run: './yii secret/db localhost statink'
-
name: 'Migrate DB'
run: 'make migrate-db'
-
name: 'Run Unit test'
run: 'make test'