Skip to content

Feature/plugin DI

Feature/plugin DI #51

# 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 }}