Skip to content

skip release test

skip release test #77

name: Plugins Tester
on:
workflow_dispatch:
inputs:
plugins:
type: string
description: 'Plugins list seperated by comma'
required: false
diffThreshold:
type: string
description: 'Ignore mismatch threshold'
required: false
default: '0.2'
pull_request:
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-plugin:
name: Build plugin
runs-on: ubuntu-latest
outputs:
changelog_diff: ${{ steps.changelog_diff_files_PT.outputs.diff }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Check if this is only a changelog PR
id: changelog_diff_files_PT
uses: technote-space/get-diff-action@v6
with:
# PATTERNS are:
# Everything: **/*
# Everything in directories starting with a period: .*/**/*
# Not readme.txt: !readme.txt
PATTERNS: |
**/*
.*/**/*
!readme.txt
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
if: github.event.pull_request.title == null || steps.changelog_diff_files_PT.outputs.diff
run: npm ci
- name: Build
if: github.event.pull_request.title == null || steps.changelog_diff_files_PT.outputs.diff
run: npx grunt build
- name: Save build to cache
if: github.event.pull_request.title == null || steps.changelog_diff_files_PT.outputs.diff
uses: actions/cache@v3
id: restore-build
with:
path: ./build/*
key: ${{ github.sha }}
test:
name: Test Plugins
runs-on: ubuntu-latest
needs: [build-plugin]
if: ${{ github.event.pull_request.title == null || needs.build-plugin.outputs.changelog_diff }}
strategy:
matrix:
testSuite:
- 'test:part1'
- 'test:part2'
- 'test:part1:containers'
- 'test:part2:containers'
- 'test'
exclude:
- testSuite: ${{ !github.event.inputs.plugins || 'test:part1' }}
- testSuite: ${{ !github.event.inputs.plugins || 'test:part2' }}
- testSuite: ${{ !github.event.inputs.plugins || 'test:part1:containers' }}
- testSuite: ${{ !github.event.inputs.plugins || 'test:part2:containers' }}
- testSuite: ${{ github.event.inputs.plugins || 'test' }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Restore build from cache
uses: actions/cache@v3
id: restore-build
with:
path: ./build/*
key: ${{ github.sha }}
- name: Set Env vars
run: |
echo "PLUGINS_TESTER__PLUGINS_TO_TEST=${{ github.event.inputs.plugins }}" >> $GITHUB_ENV
echo "PLUGINS_TESTER__DIFF_THRESHOLD=${{ github.event.inputs.diffThreshold }}" >> $GITHUB_ENV
- name: Run wp-env
uses: ./.github/workflows/run-wp-env
with:
PLUGINS: './tests/plugins-tester/plugins/elementor-tests-utils'
PORT: '7777' # In order to enable local run side by side with another default server (port 8888)
- run: wp-env run cli "wp option update elementor_onboarded 1"
- run: cd ./tests/plugins-tester && npm install
- name: Run tests
run: cd ./tests/plugins-tester && npm run ${{ matrix.testSuite }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: errors-reports
path: ./tests/plugins-tester/errors-reports/
retention-days: 7