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

upkeep/148: add php8 compatibility workflow #144

Merged
merged 22 commits into from
Apr 8, 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
24 changes: 24 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ESLint

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: npm install
run: npm install
- name: Run eslint
run: npm run lint
35 changes: 35 additions & 0 deletions .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: PHP Compatibility

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
php_compatibility:
name: PHP minimum 7.2
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer:v2
coverage: none

- name: Remove non-production dependencies
run: rm composer.lock && composer remove --dev phpunit/phpunit yoast/phpunit-polyfills

- name: Install dependencies
run: composer install

- name: Run PHP Compatibility
run: vendor/bin/phpcs autoshare-for-twitter.php includes/ --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.2-
31 changes: 31 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PHPCS

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
phpcs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer install

- name: Run PHPCS
run: vendor/bin/phpcs autoshare-for-twitter.php includes/ --extensions=php -s
28 changes: 5 additions & 23 deletions .github/workflows/test.yml → .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: PHPUnit

on:
push:
Expand All @@ -10,26 +10,7 @@ on:
- develop

jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: npm install
run: npm install
- name: eslint
uses: icrawl/action-eslint@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

with:
job-name: eslint

test_php:
phpunit:
runs-on: ubuntu-latest
services:
mysql:
Expand All @@ -40,8 +21,9 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3']
php-versions: ['7.3', '8.0']

steps:
- name: Checkout
Expand All @@ -53,5 +35,5 @@ jobs:
coverage: none
extensions: mysql, imagick

- name: Test
- name: Run PHPUnit
run: ./bin/test.sh
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
> Automatically tweets the post title or custom message and a link to the post.

[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/releases/latest) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/autoshare-for-twitter?label=WordPress) [![GPLv2 License](https://img.shields.io/github/license/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/blob/develop/LICENSE.md)
![ESLint](https://github.com/10up/autoshare-for-twitter/actions/workflows/eslint.yml/badge.svg)
![PHPCompatibility](https://github.com/10up/autoshare-for-twitter/actions/workflows/php-compatibility.yml/badge.svg)
![PHPCS](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpcs.yml/badge.svg)
![PHPUnit](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpunit.yml/badge.svg)

## Overview

Expand Down
2 changes: 1 addition & 1 deletion autoshare-for-twitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Automatically tweets the post title or custom message and a link to the post.
* Disclaimer: TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc. or its affiliates.
* Version: 1.0.6
* Requires at least: 4.7
* Requires at least: 4.9
* Requires PHP: 7.2
* Author: 10up
* Author URI: https://10up.com
Expand Down
1 change: 0 additions & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ set -e

php -v
composer install
composer run lint
composer run setup-local-tests
composer run test
22 changes: 14 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@
"role": "Developer"
}
],
"require": {
"abraham/twitteroauth": "1.2.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"wp-coding-standards/wpcs": "^2.2",
"10up/wpacceptance": "dev-master",
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"yoast/phpunit-polyfills": "^1.0.3"
"10up/phpcs-composer": "dev-master",
"phpunit/phpunit": "9.5.x-dev",
"yoast/phpunit-polyfills": "1.x-dev"
},
"scripts": {
"test": "phpunit",
"setup-local-tests": "bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest",
"test:acceptance": "wpacceptance run",
"lint": "./vendor/bin/phpcs --extensions=php -s .",
"phpcs": "vendor/bin/phpcs autoshare-for-twitter.php includes/ --extensions=php -s",
"phpcs:compat": "vendor/bin/phpcs autoshare-for-twitter.php includes/ --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.0-",
"lint-fix": "./vendor/bin/phpcbf --extensions=php ."
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require": {
"abraham/twitteroauth": "2.0.0"
}
}
Loading