Last active
April 24, 2023 09:46
-
-
Save Mte90/abbb816e9755f189ad52272e71b7c959 to your computer and use it in GitHub Desktop.
GitLab CI version for WPBP
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
image: jakzal/phpqa:alpine | |
cache: | |
paths: | |
- vendor/ | |
stages: | |
- Code Quality | |
coding-standards: | |
stage: Code Quality | |
script: | |
- composer validate | |
- composer update --no-interaction --no-progress --no-suggest | |
- composer normalize --dry-run | |
- vendor/bin/phpcs -s --standard=CodeatCodingStandard . | |
static-code-analysis: | |
stage: Code Quality | |
script: | |
- composer update --no-interaction --no-progress --no-suggest | |
- vendor/bin/phpstan analyse | |
editorconfig: | |
stage: Code Quality | |
script: | |
- curl -O -L -C - https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.1.0/ec-linux-amd64.tar.gz | |
- tar xzf ec-linux-amd64.tar.gz | |
- ./bin/ec-linux-amd64 --exclude 'vendor|\.git|bin|languages' . | |
wpunit-tests: | |
stage: Automated Tests | |
services: | |
- mysql:8.0 | |
before_script: | |
- docker-php-ext-install mysqli | |
- apk add mysql-client mariadb-connector-c-dev | |
script: | |
- curl -s -o /tmp/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
- chmod +x /tmp/wp-cli.phar && mv /tmp/wp-cli.phar /usr/local/bin/wp | |
- mkdir -p /tmp/WP | |
- cd /tmp/WP | |
- wp core download --allow-root | |
- wp config create --dbname="wordpress_unit_tests" --dbuser="root" --dbpass="test" --dbhost="mysql" --dbprefix="wp_full_" --allow-root | |
- wp core install --url="localhost:8000" --title="Test" --admin_user="admin" --admin_password="password" --admin_email="admin@plugin-name.test" --skip-email --allow-root | |
- wp rewrite structure '/%postname%/' --hard --allow-root | |
- ln -s /builds/[yourrepopath] /tmp/WP/wp-content/plugins/ | |
- cd - | |
- rm tests/_envs/.env | |
- mv tests/_envs/.env.testing tests/_envs/.env | |
- composer update --no-interaction --no-progress | |
- ./vendor/bin/codecept run wpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment