Display admin notice if WooCommerce isn’t active. #26
Workflow file for this run
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: QIT Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
test: | |
description: 'Test to run' | |
required: true | |
default: 'default' | |
type: choice | |
options: | |
- default | |
- activation | |
- api | |
- e2e | |
- phpstan | |
- security | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
branches: | |
- trunk | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
build: | |
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') }}" | |
uses: woocommerce/woocommerce-gateway-payfast/.github/workflows/generate-zip.yml@trunk | |
test: | |
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') }}" | |
needs: build | |
name: run | |
runs-on: ubuntu-latest | |
env: | |
NO_COLOR: 1 | |
QIT_DISABLE_ONBOARDING: yes | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download build | |
uses: actions/download-artifact@v3 | |
with: | |
name: woocommerce-gateway-payfast | |
- name: Build plugin zip | |
run: mv woocommerce-gateway-payfast woocommerce-payfast-gateway && zip -r woocommerce-payfast-gateway.zip woocommerce-payfast-gateway | |
- name: Set PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
tools: composer:v2 | |
coverage: none | |
- name: Install QIT via composer | |
run: composer require woocommerce/qit-cli | |
- name: Add partner | |
run: ./vendor/bin/qit partner:add --user='${{ secrets.PARTNER_USER }}' --application_password='${{ secrets.PARTNER_SECRET }}' | |
- name: Run activation test | |
if: "${{ ( inputs.tests == 'default' || inputs.tests == 'activation' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') }}" | |
id: run-activation-test | |
run: ./vendor/bin/qit run:activation woocommerce-payfast-gateway --zip=woocommerce-payfast-gateway.zip --wait > activation-result.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: ${{ failure() && steps.run-activation-test.conclusion == 'failure' }} | |
with: | |
header: QIT activation result | |
recreate: true | |
path: activation-result.txt | |
- name: Run API test | |
if: "${{ ( ( inputs.tests == 'default' || inputs.tests == 'api' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') ) && ( success() || failure() ) }}" | |
id: run-api-test | |
run: ./vendor/bin/qit run:api woocommerce-payfast-gateway --zip=woocommerce-payfast-gateway.zip --wait > api-result.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: ${{ failure() && steps.run-api-test.conclusion == 'failure' }} | |
with: | |
header: QIT API result | |
recreate: true | |
path: api-result.txt | |
- name: Run E2E test | |
if: "${{ ( ( inputs.tests == 'default' || inputs.tests == 'e2e' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') ) && ( success() || failure() ) }}" | |
id: run-e2e-test | |
run: ./vendor/bin/qit run:e2e woocommerce-payfast-gateway --zip=woocommerce-payfast-gateway.zip --wait > e2e-result.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: ${{ failure() && steps.run-e2e-test.conclusion == 'failure' }} | |
with: | |
header: QIT E2E result | |
recreate: true | |
path: e2e-result.txt | |
- name: Run PHPStan test | |
if: "${{ inputs.tests == 'phpstan' || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') && ( success() || failure() ) }}" | |
id: run-phpstan-test | |
run: ./vendor/bin/qit run:phpstan woocommerce-payfast-gateway --zip=woocommerce-payfast-gateway.zip --wait > phpstan-result.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: ${{ failure() && steps.run-phpstan-test.conclusion == 'failure' }} | |
with: | |
header: QIT PHPStan result | |
recreate: true | |
path: phpstan-result.txt | |
- name: Run security test | |
if: "${{ inputs.tests == 'security' || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') && ( success() || failure() ) }}" | |
id: run-security-test | |
run: ./vendor/bin/qit run:security woocommerce-payfast-gateway --zip=woocommerce-payfast-gateway.zip --wait > security-result.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: ${{ failure() && steps.run-security-test.conclusion == 'failure' }} | |
with: | |
header: QIT security result | |
recreate: true | |
path: security-result.txt |