From 8c7451d5fe4a145bc8642095829d0098e4514dff Mon Sep 17 00:00:00 2001 From: David Herrera Date: Tue, 12 Sep 2023 23:39:59 -0400 Subject: [PATCH] Use centralized GitHub workflows --- .github/workflows/coding-standards.yml | 12 +++++++ .github/workflows/cs.yml | 35 ------------------- .github/workflows/tests.yml | 47 -------------------------- .github/workflows/unit-test.yml | 21 ++++++++++++ 4 files changed, 33 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/coding-standards.yml delete mode 100644 .github/workflows/cs.yml delete mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..bd66de4 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,12 @@ +name: Coding Standards + +on: + pull_request: + branches: + - main + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + coding-standards: + if: github.event.pull_request.draft == false + uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml deleted file mode 100644 index a385c7a..0000000 --- a/.github/workflows/cs.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Coding Standards - -on: - pull_request: - -jobs: - cs: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [ 8.0 ] - steps: - - name: Cancel previous runs of this workflow (pull requests only) - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - - name: Check out code - uses: actions/checkout@v3 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - - name: Install composer dependencies - uses: ramsey/composer-install@v2 - - - name: Run PHPCS - run: composer run-script phpcs - - - name: Run PHP-CS-Fixer - run: vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no --allow-risky=yes diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index f3cd890..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Tests - -on: - pull_request: - -jobs: - phpunit: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [ 8.2, 8.1, 8.0 ] - wp_version: [ "latest" ] - can_fail: [ false ] - multisite: [ 0,1 ] - services: - mysql: - image: mysql:5.7 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - continue-on-error: ${{ matrix.can_fail }} - name: WordPress ${{ matrix.wp_version }} @ PHP ${{ matrix.php }} (WP_MULTISITE=${{ matrix.multisite }}) - env: - WP_CORE_DIR: /tmp/wordpress - WP_VERSION: ${{ matrix.wp_version }} - WP_MULTISITE: ${{ matrix.multisite }} - WP_DB_HOST: 127.0.0.1 - WP_DB_USER: root - WP_DB_PASSWORD: '""' - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: json, mysqli, curl, dom, exif, fileinfo, hash, imagick, mbstring, openssl, pcre, xml, zip - - - name: Install composer dependencies - uses: ramsey/composer-install@v2 - - - name: Run PHPUnit - run: composer run-script phpunit diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..de6d38b --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,21 @@ +name: Testing Suite + +on: + pull_request: + branches: + - main + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + php-tests: + if: github.event.pull_request.draft == false + strategy: + matrix: + php: ["8.2", "8.1", "8.0"] + wordpress: ["latest"] + multisite: [false, true] + uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main + with: + php: ${{ matrix.php }} + wordpress: ${{ matrix.wordpress }} + multisite: ${{ matrix.multisite }}