-
Notifications
You must be signed in to change notification settings - Fork 25
100 lines (83 loc) · 3.06 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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