Update plugin docs. #2143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Codeception Tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
- develop | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
ci: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
env: | |
cache_version: 2 # increment to flush all caches | |
PROJECT_ID: square1 | |
COMPOSE_INTERACTIVE_NO_CLI: 1 | |
COMPOSE_FILE: docker-compose.yml:docker-compose.gh.yml | |
steps: | |
- name: Set up PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: '8.0' | |
coverage: none | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Open permissions on output and directories | |
run: chmod 777 dev/tests/tests/_output | |
- name: Create .env | |
run: | | |
echo "${{ secrets.COMPOSER_ENV }}" > .env | |
- name: Create local config | |
run: | | |
php -r "file_exists( 'local-config.php' ) || copy( 'local-config-sample.php', 'local-config.php' );" | |
php -r "file_exists( 'wp-content/themes/core/local-config.json' ) || copy( 'wp-content/themes/core/local-config-sample.json', 'wp-content/themes/core/local-config.json' );" | |
php -r "file_exists( 'dev/tests/.env' ) || copy( 'dev/tests/.env-dist', 'dev/tests/.env' );" | |
echo "define( 'TWIG_CACHE', false );" >> local-config.php | |
echo "define( 'FORCE_SSL_LOGIN', false );" >> local-config.php | |
echo "define( 'FORCE_SSL_ADMIN', false );" >> local-config.php | |
printf 'SQ1_UID=%d\nSQ1_GID=%d\n' $(id -u) $(id -g) > dev/docker/.env | |
- name: Create composer config files | |
run: | | |
mkdir -p dev/docker/composer | |
printf '{ "config": {}, "repositories": { "packagist": { "type": "composer", "url": "https://packagist.org" } } }' > dev/docker/composer/config.json | |
printf '{ "github-oauth": { "github.com": "%s" } }\n' "${{ secrets.GITHUB_TOKEN }}" > dev/docker/composer/auth.json | |
- name: Check for Cached Composer Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: dev/docker/composer/cache | |
key: ${{ runner.os }}-${{ env.cache_version }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: ${{ runner.os }}-${{ env.cache_version }}-composer- | |
- name: Create docker network | |
run: docker network create --driver=bridge --subnet=172.20.10.0/24 global_proxy | |
working-directory: dev/docker | |
- name: Start project containers | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} up -d --force-recreate | |
working-directory: dev/docker | |
- name: Install composer dependencies | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} exec -T php-fpm composer install --optimize-autoloader -d /application/www | |
working-directory: dev/docker | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install gulp-cli | |
run: npm install gulp-cli -g | |
- name: Install node modules | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Build assets | |
run: npm run server_dist | |
- name: Validate assets | |
run: npm run validate | |
- name: Create test databases | |
run: | | |
mysql -h 127.0.0.1 -uroot -ppassword -e "CREATE DATABASE tribe_square1_tests;" | |
mysql -h 127.0.0.1 -uroot -ppassword -e "CREATE DATABASE tribe_square1_acceptance;" | |
- name: Create cache dir | |
run: | | |
mkdir -p ${{ github.workspace }}/cache/ | |
chmod -R 777 ${{ github.workspace }}/cache/ | |
- name: Run unit tests | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} exec -T php-tests php /application/www/vendor/bin/codecept --config "/application/www/dev/tests" run unit | |
working-directory: dev/docker | |
- name: Run integration tests | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} exec -T php-tests php /application/www/vendor/bin/codecept --config "/application/www/dev/tests" run integration | |
working-directory: dev/docker | |
- name: Run acceptance tests | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} exec -T php-tests php /application/www/vendor/bin/codecept --config "/application/www/dev/tests" run acceptance | |
working-directory: dev/docker | |
- name: Run webdriver tests | |
run: docker-compose --project-name=${{ env.PROJECT_ID }} exec -T php-tests php /application/www/vendor/bin/codecept -vvv --config "/application/www/dev/tests" run webdriver | |
working-directory: dev/docker | |
- uses: actions/upload-artifact@v2 | |
if: ${{ failure() }} | |
with: | |
name: test-artifacts | |
path: dev/tests/tests/_output/ |