diff --git a/.github/workflows/woo-qit.yml b/.github/workflows/woo-qit.yml new file mode 100644 index 00000000..60994ef1 --- /dev/null +++ b/.github/workflows/woo-qit.yml @@ -0,0 +1,67 @@ +name: Run Woo QIT + +on: + workflow_call: + inputs: + ARTIFACT: + description: The name of the generated artifact, usually the output of the archive creation workflow. + required: true + type: string + PLUGIN_FOLDER_NAME: + description: The name of the plugin folder/slug (falls back to the repository name). + default: '' + required: false + type: string + QIT_TEST: + description: The name of the QIT test to run (activation, security, ...). + default: 'activation' + required: false + type: string + QIT_OPTIONS: + description: The string with additional QIT options, such as --wordpress_version=6.5.1 --optional_features=hpos. + default: '' + required: false + type: string + secrets: + WOO_PARTNER_USER: + description: The Woo.com email. + required: true + WOO_PARTNER_SECRET: + description: The Woo.com QIT token. + required: true + +jobs: + qit: + name: Run Woo QIT + timeout-minutes: 5 + runs-on: ubuntu-latest + env: + PLUGIN_FOLDER_NAME: ${{ inputs.PLUGIN_FOLDER_NAME }} + WOO_PARTNER_USER: ${{ secrets.WOO_PARTNER_USER }} + WOO_PARTNER_SECRET: ${{ secrets.WOO_PARTNER_SECRET }} + QIT_DISABLE_ONBOARDING: yes + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.ARTIFACT }} + path: package + + - name: Set up plugin folder name + id: plugin-folder-name + run: echo "plugin-folder-name=${PLUGIN_FOLDER_NAME:-${{ github.event.repository.name }}}" >> $GITHUB_OUTPUT + + - name: Zip artifact + run: zip -r plugin.zip . + working-directory: package + + - name: Install QIT + run: | + wget https://github.com/woocommerce/qit-cli/raw/trunk/qit + chmod +x qit + + - name: Add QIT auth + run: ./qit partner:add --user="${{ env.WOO_PARTNER_USER }}" --qit_token="${{ env.WOO_PARTNER_SECRET }}" + + - name: Run QIT tests + run: ./qit run:${{ inputs.QIT_TEST }} ${{ steps.plugin-folder-name.outputs.plugin-folder-name }} --zip=package/plugin.zip ${{ inputs.QIT_OPTIONS }} --wait diff --git a/docs/woo-qit.md b/docs/woo-qit.md new file mode 100644 index 00000000..c2f3d12a --- /dev/null +++ b/docs/woo-qit.md @@ -0,0 +1,47 @@ +# Run Woo QIT + +This workflow runs the [Quality Insights Toolkit](https://qit.woo.com/) tests. + +Usually it should be used after the [archive creation workflow](/docs/archive-creation.md). + +## Simple usage example: + +```yml +name: Create release package and run QIT +on: + workflow_dispatch: +jobs: + create_archive: + uses: inpsyde/reusable-workflows/.github/workflows/build-plugin-archive.yml@main + qit: + strategy: + matrix: + test: ['activation', 'security'] + uses: inpsyde/reusable-workflows/.github/workflows/woo-qit.yml@main + needs: create_archive + secrets: + WOO_PARTNER_USER: ${{ secrets.WOO_PARTNER_USER }} + WOO_PARTNER_SECRET: ${{ secrets.WOO_PARTNER_SECRET }} + with: + ARTIFACT: ${{ needs.create_archive.outputs.artifact }} + QIT_TEST: ${{ matrix.test }} +``` + +## Configuration parameters + +### Inputs + +| Name | Default | Description | +|------------------------|------------------------|----------------------------------------------------------------------------------------------------------| +| `ARTIFACT` | | The name of the generated artifact, usually the output of the archive creation workflow. | +| `PLUGIN_FOLDER_NAME` | `''` | The name of the plugin folder/slug (falls back to the repository name). | +| `QIT_TEST` | `'activation'` | The name of the QIT test to run (activation, security, ...). | +| `QIT_OPTIONS` | `''` | The string with additional QIT options, such as `'--wordpress_version=6.5.1 --optional_features=hpos'`. | + + +## Secrets + +| Name | Description | +|----------------------|------------------------------------------------------------------------------------------| +| `WOO_PARTNER_USER` | The Woo.com email. | +| `WOO_PARTNER_SECRET` | The Woo.com [QIT token](https://qit.woo.com/docs/support/authenticating/). |