-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·92 lines (74 loc) · 2.87 KB
/
github-actions-build-qa.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
# Github actions Build and QA pipeline
# This was autogenerated from Azure Pipelines YAML with https://pipelinestoactions.azurewebsites.net/
name: Build and test
on:
pull_request:
branches:
- master
- stage
push:
branches:
- master
- stage
workflow_dispatch:
env:
phpVersion: '8.2'
nodeVersion: '18.x'
rootFolder: ${{ github.workspace }}
pluginFolder: "${{ github.workspace }}/wp-content/plugins/ewplugin"
themeFolder: "${{ github.workspace }}/wp-content/themes/ew-theme"
jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP 8.2 to agent
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.phpVersion }}
- name: Set PHP version to ${{ env.phpVersion }}
run: |
sudo update-alternatives --set php /usr/bin/php${{ env.phpVersion }}
sudo update-alternatives --set phar /usr/bin/phar${{ env.phpVersion }}
sudo update-alternatives --set phpdbg /usr/bin/phpdbg${{ env.phpVersion }}
sudo update-alternatives --set php-cgi /usr/bin/php-cgi${{ env.phpVersion }}
sudo update-alternatives --set phar.phar /usr/bin/phar.phar${{ env.phpVersion }}
php -version
shell: bash
- name: Set Node version to ${{ env.nodeVersion }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.nodeVersion }}
cache: 'yarn'
- name: Install composer packages in plugin
run: composer install --no-interaction --prefer-dist
shell: bash
working-directory: ${{ env.pluginFolder }}
- name: Install composer packages in theme
run: composer install --no-interaction --prefer-dist
working-directory: ${{ env.themeFolder }}
shell: bash
- name: Install yarn packages in theme
run: yarn install
shell: bash
working-directory: ${{ env.themeFolder }}
- name: Build theme assets
run: yarn build
shell: bash
working-directory: ${{ env.themeFolder }}
- name: Install PHP testing environment
run: |
# Run MySQL server
sudo systemctl start mysql.service
# Download empty Wordpress installation and setup testing database
bash bin/install-wp-tests.sh wp_wp-starter-test root root localhost latest
# Add permissions to this folder so that tests can create their files
sudo chmod 777 -R ./tests/tmp
shell: bash
working-directory: ${{ env.pluginFolder }}
- name: Run plugin PHP tests
run: sudo php ./vendor/bin/phpunit --log-junit test-php-results.xml
shell: bash
working-directory: ${{ env.pluginFolder }}