Remove husky #92
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: Cypress Tests | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
paths-ignore: | |
- '.github/**' | |
- '!.github/workflows/cypress.yml' | |
- '.gitignore' | |
- '**.md' | |
pull_request: | |
types: [ opened, edited, synchronize, reopened, ready_for_review ] | |
pull_request_review: | |
types: [ submitted, edited ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Run Cypress Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
coverage: none | |
tools: composer, cs2pr | |
- name: Setup Workflow Context | |
id: workflow | |
working-directory: ${{ runner.temp }} | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
mkdir dist | |
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT | |
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT | |
- name: Set Node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer vendor directory | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Show versions | |
run: | | |
php --version | |
composer --version | |
node --version | |
npm --version | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Install PHP Dependencies | |
run: composer install --no-progress --no-dev | |
- name: NPM Install | |
run: npm install | |
- name: Create Distribution Copy | |
run: rsync -r --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }} | |
- name: List Distribution Files | |
working-directory: ${{ steps.workflow.outputs.DIST }} | |
run: find . | |
- name: Configure WordPress | |
run: echo '{"plugins":["${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}"]}' > .wp-env.json | |
- name: Configure Cypress | |
run: | | |
echo '{"wpVersion": "6.7","phpVersion": "8.2"}' > cypress.env.json | |
- name: Install WordPress | |
run: npx wp-env start --debug | |
- name: Run Cypress Tests | |
run: npm run test | |
- name: Store screenshots of test failures | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ./tests/cypress/screenshots |