You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.9 KiB
100 lines
2.9 KiB
3 years ago
|
name: Run Standards & Tests
|
||
4 years ago
|
on:
|
||
|
push:
|
||
3 years ago
|
branches: [ dev, master ]
|
||
4 years ago
|
tags:
|
||
|
- '*.*.*'
|
||
|
pull_request:
|
||
|
branches: [ dev ]
|
||
|
jobs:
|
||
|
tests:
|
||
|
runs-on: ${{ matrix.os }}
|
||
3 years ago
|
continue-on-error: ${{ matrix.experimental }}
|
||
4 years ago
|
strategy:
|
||
3 years ago
|
fail-fast: false
|
||
4 years ago
|
matrix:
|
||
3 years ago
|
php: [ 7.4 ]
|
||
3 years ago
|
os: [ ubuntu-20.04 ]
|
||
3 years ago
|
wordpress: [ 5.9.3, latest ]
|
||
3 years ago
|
experimental: [ false ]
|
||
3 years ago
|
include:
|
||
3 years ago
|
- php: 8.0
|
||
3 years ago
|
os: ubuntu-20.04
|
||
|
wordpress: latest
|
||
|
experimental: true
|
||
4 years ago
|
name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
|
||
|
|
||
|
env:
|
||
|
WP_VERSION: ${{ matrix.wordpress }}
|
||
|
WP_MULTISITE: 1
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Start required services
|
||
|
run: sudo systemctl start mysql.service
|
||
|
|
||
|
- name: Cache PHP dependencies
|
||
3 years ago
|
uses: actions/cache@v2
|
||
4 years ago
|
with:
|
||
|
path: vendor
|
||
3 years ago
|
key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
|
||
4 years ago
|
|
||
3 years ago
|
- name: Setup PHP with Composer 2
|
||
4 years ago
|
uses: shivammathur/setup-php@v2
|
||
|
with:
|
||
|
php-version: ${{ matrix.php }}
|
||
3 years ago
|
tools: phpcs, composer
|
||
4 years ago
|
coverage: pcov
|
||
|
|
||
3 years ago
|
- name: Install PHP dependencies
|
||
|
run: |
|
||
4 years ago
|
export PATH="$HOME/.composer/vendor/bin:$PATH"
|
||
|
composer install --no-interaction
|
||
3 years ago
|
|
||
3 years ago
|
- name: Run PHP CodeSniffer
|
||
4 years ago
|
run: composer standards
|
||
|
|
||
|
- name: Install WP tests
|
||
|
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }}
|
||
|
|
||
3 years ago
|
- name: Run PHP Tests
|
||
|
run: composer test
|
||
|
if: matrix.experimental == true
|
||
|
|
||
|
- name: Run PHP Tests and PCOV
|
||
3 years ago
|
run: composer test-coverage
|
||
3 years ago
|
if: matrix.experimental == false
|
||
4 years ago
|
|
||
3 years ago
|
- name: Upload Coverage to Codecov
|
||
|
run: bash <(curl -s https://codecov.io/bash)
|
||
3 years ago
|
if: matrix.experimental == false
|
||
4 years ago
|
|
||
|
- name: Prepare Build
|
||
|
if: startsWith(github.ref, 'refs/tags/')
|
||
|
run: |
|
||
|
export GITHUB_BUILD_PATH=${{github.workspace}}
|
||
|
export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})"
|
||
|
export GITHUB_TAG="$(basename ${{github.ref}})"
|
||
|
echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip"
|
||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||
|
chmod +x wp-cli.phar
|
||
|
mv wp-cli.phar /usr/local/bin/wp
|
||
|
wp package install wp-cli/dist-archive-command
|
||
3 years ago
|
npm run build
|
||
4 years ago
|
composer install --no-dev --optimize-autoloader
|
||
|
cd ..
|
||
|
wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip
|
||
|
cd $GITHUB_BUILD_PATH
|
||
|
ls $GITHUB_BUILD_PATH
|
||
3 years ago
|
|
||
4 years ago
|
- name: Deploy
|
||
|
if: startsWith(github.ref, 'refs/tags/')
|
||
|
uses: softprops/action-gh-release@v1
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
with:
|
||
|
files:
|
||
3 years ago
|
${{github.workspace}}/*.zip
|