Skip to content

Merge pull request #137 from koalatiapp/auto-verify-on-password-reset #983

Merge pull request #137 from koalatiapp/auto-verify-on-password-reset

Merge pull request #137 from koalatiapp/auto-verify-on-password-reset #983

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
coding-standards:
name: Coding standards
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Install PHP dependencies (composer install)
uses: php-actions/composer@v6
with:
php_version: 8.3
php_extensions: xsl bcmath pcntl
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install JS dependencies (npm install)
run: npm i --ignore-scripts --production=false
- name: PHP CS Fixer
run: DEV/ci/php-cs-fixer.sh
- name: PHP Stan
run: DEV/ci/phpstan.sh
- name: PHP MD
run: DEV/ci/phpmd.sh
- name: Twigcs
run: DEV/ci/twigcs.sh
- name: CSS stylelint
run: DEV/ci/stylelint.sh
- name: ESLint (JS)
run: DEV/ci/eslint.sh
build:
name: Build and test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
ini-values: post_max_size=256M, max_execution_time=0
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Pull images
run: docker compose pull
- name: Enable Docker build caching between CI runs
uses: jpribyl/[email protected]
with:
key: docker-layer-cache-{hash}
restore-keys: |
docker-layer-cache-
layer-docker-layer-cache-
continue-on-error: true
- name: Start services
run: docker compose --env-file .env.test up --build -d
- name: Wait for services
run: |
APP_BOOT_TIMEOUT=`expr $(date +%s) + 600`
UNHEALTHY_ALLOWANCE_LEFT=20
while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker compose ps -q php)")"; do
case $status in
starting)
if [ $APP_BOOT_TIMEOUT -lt $(date +%s) ]; then
echo "System boot timed out - 10 mins elapsed."
docker logs --since="10m" "$(docker compose ps -q php)"
exit 1
fi
UNHEALTHY_ALLOWANCE_LEFT=20
sleep 1;;
healthy)
exit 0;;
unhealthy)
if [ $UNHEALTHY_ALLOWANCE_LEFT -eq 0 ]; then
docker logs --since="10m" "$(docker compose ps -q php)"
exit 1
else
UNHEALTHY_ALLOWANCE_LEFT=$((UNHEALTHY_ALLOWANCE_LEFT - 1))
sleep 3
fi;;
esac
done
exit 1
- name: Check HTTP reachability
run: curl http://localhost
- name: Check HTTPS reachability
run: curl -k https://localhost
- name: Install Playwright dependencies
run: npx [email protected] install-deps
- name: Install JS testing dependencies
run: npm ci
- name: Build JS assets with Webpack Encore
run: NODE_ENV=test npm run encore prod
- name: Install Playwright browsers
run: npx playwright install
- name: Run tests
run: ./DEV/ci/run-tests.php --verbose
- name: Prepare log artifacts (copy from container to host)
if: always()
run: sudo docker cp $(docker compose ps -q php):/srv/app/var/log var
- name: Save log artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: var/log
- name: Save testing artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results