Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QIT workflow #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/woo-qit.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions docs/woo-qit.md
Original file line number Diff line number Diff line change
@@ -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/). |