-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (81 loc) · 3.16 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
on:
pull_request:
workflow_dispatch:
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Authenticate with Fontawesome NPM reposity
run: |
npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.NPM_FONTAWESOME_AUTH_TOKEN }}
- name: Read PHP version from composer.json to env
run: |
echo "PHP_VERSION=$(cat ./composer.json | jq -r '.config.platform.php')" >> "$GITHUB_ENV"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
env:
COMPOSER_TOKEN: ${{ secrets.PACKAGIST_GITHUB_TOKEN }}
- name: Start MySQL service
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE db;' -uroot -proot
mysql -e "CREATE USER 'db'@'localhost' IDENTIFIED BY 'db';" -uroot -proot
mysql -e "GRANT ALL PRIVILEGES ON db.* TO 'db'@'localhost' WITH GRANT OPTION;" -uroot -proot
- name: Configure basic http authentication for Composer
run: composer config --global http-basic.satispress.generodigital.com ${{ secrets.SATISPRESS_API_KEY }} ${{ secrets.SATISPRESS_PASSWORD }}
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer Cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install development packages to run tests
run: composer install:development
- name: Run CI tests
run: composer ci --no-interaction
- name: Launch web server
run: ./vendor/bin/wp server &
- name: Setup .env
run: |
cp .env.example .env
sed -i 's/WP_HOME=.*/WP_HOME=http:\/\/localhost:8080/g' .env
sed -i 's/DB_HOST=.*/DB_HOST=localhost/g' .env
- name: Install WordPress
run: |
./vendor/bin/wp core install \
--url=http://localhost:8080 \
--title="Bedrock" \
--admin_user="admin" \
--admin_email="bedrock@example.test" \
--skip-email
# - name: Install WordPress (multisite)
# run: |
# ./vendor/bin/wp core multisite-install \
# --url=http://localhost:8080 \
# --title="Bedrock" \
# --admin_email="bedrock@example.test" \
# --skip-config \
# --skip-email
- name: Optimize acorn
run: ./vendor/bin/wp acorn optimize
- name: Load frontpage and verify app.js script is loaded
run: curl http://localhost:8080/ | grep '<script.*src=".*app/themes/gds/public/scripts/app.js'
- name: Run unit tests
run: composer phpunit