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

Release/1.2.1 #11

Merged
merged 6 commits into from
Sep 7, 2022
Merged
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
107 changes: 51 additions & 56 deletions .github/workflows/cypress-tests.yml → .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
name: Cypress Tests

on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '.gitignore'
- '**.md'
- master
- trunk
- develop
- release/*
- feature/*
- add/*
- update/*
- fix/*
- try/*
pull_request:
types: [ opened, edited, synchronize, reopened, ready_for_review ]
types: [opened, edited, reopened, ready_for_review]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
tests:
test:
name: Run Cypress Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository

- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer, cs2pr

- name: Setup workflow context
id: workflow
working-directory: ${{ runner.temp }}
Expand All @@ -29,12 +47,23 @@ jobs:
echo ::set-output name=DIST::${PWD}/dist
echo ::set-output name=PACKAGE::${REPO##*/}

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
php-version: '7.4'
coverage: none
tools: composer
node-version: 16.x

- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-


- name: Get Composer cache directory
id: composer-cache
Expand All @@ -46,40 +75,23 @@ jobs:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14
${{ runner.os }}-composer-

- name: Cache node modules
uses: actions/cache@v2
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: Log debug information
- name: Show versions
run: |
php --version
composer --version
node --version
npm --version

- name: Validate composer.json and composer.lock files
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install PHP Dependencies
run: composer install --no-progress --no-dev --optimize-autoloader
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Run NPM Install
run: npm install
- name: NPM Install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build
Expand Down Expand Up @@ -107,24 +119,7 @@ jobs:
name: screenshots
path: ./tests/cypress/screenshots

- name: Check if a debug.log file exists
id: hasErrors
run: npx wp-env run wordpress test ! -f /var/www/html/wp-content/debug.log

- name: Copy debug.log file
if: ${{ steps.hasErrors.outputs.failure }}
run: cat /var/www/html/wp-content/debug.log 1>./debug.log 2>/dev/null

- name: Store debug.log file
if: ${{ steps.hasErrors.outputs.failure }}
uses: actions/upload-artifact@v2
with:
name: logs
path: ./debug.log

# - name: Store a copy of the plugin on success
# if: ${{ success() }}
# uses: actions/upload-artifact@v1
# with:
# name: ${{ steps.workflow.outputs.PACKAGE }}
# path: ${{ steps.workflow.outputs.DIST }}
- name: Output debug.log file contents
if: ${{ always() }}
continue-on-error: true
run: npx wp-env run wordpress "cat /var/www/html/wp-content/debug.log"
53 changes: 38 additions & 15 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,63 @@
name: Lint PHP
on:
push:
branches:
- '**'
paths:
- '**.php'
pull_request:
types: [ opened, edited, synchronize, reopened, ready_for_review ]
paths:
- '**.php'
pull_request:
types: [opened, edited, reopened, ready_for_review]
paths:
- '**.php'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
lint-php:
phpcs:
name: Run PHP Code Sniffer
runs-on: ubuntu-latest
steps:
- name: Checkout repository

- name: Checkout
uses: actions/checkout@v2

# User PHP 7.4 here for compatibility with the WordPress codesniffer rules.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, phpcs
tools: composer, cs2pr

- name: Validate composer.json and composer.lock
run: composer validate
- uses: technote-space/get-diff-action@v6
with:
SUFFIX_FILTER: .php

- name: Install PHP Dependencies
run: composer install --no-progress
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
if: "!! env.GIT_DIFF"

- name: Get changed files
uses: technote-space/get-diff-action@v3
- name: Cache Composer vendor directory
uses: actions/cache@v2
with:
SUFFIX_FILTER: .php
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
if: "!! env.GIT_DIFF"

- name: Validate composer.json and composer.lock
run: composer validate
if: "!! env.GIT_DIFF"

- name: Install dependencies
run: composer install --no-progress --optimize-autoloader --prefer-dist
if: "!! env.GIT_DIFF"

- name: Detecting PHP Code Standards Violations
run: vendor/bin/phpcs --colors -s ${{ env.GIT_DIFF }}
run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }}
if: "!! env.GIT_DIFF"
2 changes: 1 addition & 1 deletion .github/workflows/satis-webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
token: ${{ secrets.WEBHOOK_TOKEN }}
repository: newfold-labs/satis
event-type: 'satis-build'
event-type: 'Trigger Satis Build'
client-payload: >-
{
"vendor": "${{ github.repository_owner }}",
Expand Down
52 changes: 32 additions & 20 deletions .github/workflows/upload-artifact-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
name: Build Plugin

on:
push:
branches:
- main
- master
- develop
- release/*
- feature/*
- add/*
- update/*
- fix/*
- try/*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
build:
name: On Push to Main
name: On Push
runs-on: ubuntu-latest
steps:

Expand All @@ -17,11 +28,11 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'
coverage: none
tools: composer, cs2pr

- name: Setup Workflow Context
- name: Setup workflow context
id: workflow
working-directory: ${{ runner.temp }}
env:
Expand All @@ -30,19 +41,11 @@ jobs:
mkdir dist
echo ::set-output name=DIST::${PWD}/dist
echo ::set-output name=PACKAGE::${REPO##*/}
- name: PHP version
run: php --version

- name: Set Node.js 14.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Node version
run: node --version

- name: NPM version
run: npm --version
node-version: 16.x

- name: Get npm cache directory
id: npm-cache
Expand All @@ -55,13 +58,8 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm install
run: npm install

- name: Validate composer.json and composer.lock
run: composer validate

- name: Get Composer Cache Directory
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

Expand All @@ -72,9 +70,23 @@ jobs:
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 --optimize-autoloader --prefer-dist

- name: NPM Install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build

Expand Down
Loading