Update Craft #673
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: Test Build | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Gatsby + Craft with PHP ${{ matrix.php-versions }} + ${{ matrix.db }} | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ubuntu-latest] | |
php-versions: ["8.0", "8.1"] | |
db: ["mysql", "pgsql"] | |
services: | |
mysql: | |
image: mysql:5.7 | |
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:12 | |
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.0 | |
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 | |
- name: Ping GraphQL endpoint | |
run: |- | |
curl -s -X POST -H "Content-Type: application/json" --data '{ "query": "{ ping }" }' http://nginx/api | |
- name: Prepare Gatsby environment | |
run: cp .github/workflows/.env-gatsby headless-front-end/gatsby/.env | |
- name: Install Gatsby dependencies | |
run: npm install && npm install gatsby-cli | |
working-directory: headless-front-end/gatsby | |
- name: Build Gatsby site | |
run: npm run build | |
working-directory: headless-front-end/gatsby | |
- name: Upload Craft logs | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: craft-logs | |
path: storage/logs/*.log | |