Skip to content

Craft 5.x

Craft 5.x #699

Workflow file for this run

name: Test Build
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
permissions:
contents: read
jobs:
test:
name: Craft on PHP ${{ matrix.php-versions }} + ${{ matrix.db }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.2"]
db: ["mysql", "pgsql"]
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
nginx:
image: craftcms/nginx:8.2
options: --volume ${{ github.workspace }}:/app --user www-data:www-data
ports:
- 80:8080
steps:
- uses: actions/checkout@v2
- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath, mbstring, intl, gd, imagick, zip, dom, pdo_mysql, pdo_pgsql, fileinfo
ini-values: post_max_size=256M
tools: php-cs-fixer, phpunit
- name: Prepare Craft environment
run: cp .github/workflows/.env.${{ matrix.db }} .env
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Add Docker database host aliases to build environment
run: sudo echo "127.0.0.1 nginx postgres mysql" | sudo tee -a /etc/hosts
- name: Install Craft
run: php craft install/craft --username=admin --password=password [email protected] --site-name=Craft Blog --site-url=$DEFAULT_SITE_URL --interactive=0
- name: Add Craft demo content
run: php craft migrate/up --track=content --interactive=0
- name: Set Craft writable folder permissions
run: chmod -R 777 config storage web/cpresources
# This project is used for schema introspection, so we do need to know that the API is healthy:
- name: Ping GraphQL endpoint
run: |-
curl -s -X POST -H "Content-Type: application/json" --data '{ "query": "{ ping }" }' http://nginx/api
- name: Upload Craft logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: craft-logs
path: storage/logs/*.log