Skip to content

Commit

Permalink
Plugin updates and fixes (#17)
Browse files Browse the repository at this point in the history
* Update Github actions

* Update packages and add plugin assets

* Remove classname from covers in tests

* Respect codeCoverageIgnore for tests & coverage

* Switch back to action from woocart repo

* Update Makefile commands
  • Loading branch information
akshitsethi authored Feb 16, 2021
1 parent 95c7b79 commit d6d1c27
Show file tree
Hide file tree
Showing 15 changed files with 2,578 additions and 1,760 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ jobs:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout code
uses: actions/checkout@master
- name: Set up PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Build Plugin
run: make dist
- name: WordPress Plugin Deploy
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
on: push
name: Tests
name: PR Checks

jobs:
onMasterOrPR:
name: On master or PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout code
uses: actions/checkout@master
- name: Set up PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install Dependencies
run: make ensure
- name: Lint
run: make fmt
- name: Test
- name: Tests
run: make test
- name: Cover
run: make cover

11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*'

name: Upload Release Asset

Expand All @@ -13,7 +12,11 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Build project # This would actually build your project, using zip for an example artifact
- name: Set up PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Build project
run: make build
- name: Create Release
id: create_release
Expand All @@ -31,7 +34,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/spiderblocker.zip
asset_name: spiderblocker.zip
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ reports
clover.xml
src/vendor
dist
.phpunit.result.cache
Binary file added .wordpress-org/banner-1544x500.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 1.2.6
VERSION := 1.3.0
PLUGINSLUG := spiderblocker
SRCPATH := $(shell pwd)/src

Expand All @@ -22,22 +22,22 @@ test: vendor

dist: ensure
sed -i "s/@##VERSION##@/${VERSION}/" src/index.php
sed -i "s/@##VERSION##@/${VERSION}/" src/i18n/spiderblocker.pot
sed -i "s/@##VERSION##@/${VERSION}/" src/i18n/$(PLUGINSLUG).pot
mkdir -p dist
cp -r $(SRCPATH)/. dist/
sed -i "s/${VERSION}/@##VERSION##@/" src/index.php
sed -i "s/${VERSION}/@##VERSION##@/" src/i18n/spiderblocker.pot
sed -i "s/${VERSION}/@##VERSION##@/" src/i18n/$(PLUGINSLUG).pot

build: ensure
sed -i "s/@##VERSION##@/${VERSION}/" src/index.php
sed -i "s/@##VERSION##@/${VERSION}/" src/i18n/spiderblocker.pot
sed -i "s/@##VERSION##@/${VERSION}/" src/i18n/$(PLUGINSLUG).pot
mkdir -p build
cp -ar $(SRCPATH) $(PLUGINSLUG)
zip -r $(PLUGINSLUG).zip $(PLUGINSLUG)
rm -rf $(PLUGINSLUG)
mv $(PLUGINSLUG).zip build/
sed -i "s/${VERSION}/@##VERSION##@/" src/index.php
sed -i "s/${VERSION}/@##VERSION##@/" src/i18n/spiderblocker.pot
sed -i "s/${VERSION}/@##VERSION##@/" src/i18n/$(PLUGINSLUG).pot

release:
git stash
Expand All @@ -47,7 +47,6 @@ release:
git tag v$(VERSION)
git push origin v$(VERSION)
git pull -r
@echo "Go to the https://github.com/niteoweb/spiderblocker/releases/new?tag=v$(VERSION) and publish the release in order to build the package for distribution!"

fmt: ensure
bin/phpcbf --standard=WordPress src
Expand All @@ -58,10 +57,10 @@ lint: ensure
bin/phpcs --standard=WordPress tests --ignore=vendor

psr:
composer dump-autoload -a
composer dump-autoload -o

i18n:
wp i18n make-pot src src/i18n/spiderblocker.pot
wp i18n make-pot src src/i18n/$(PLUGINSLUG).pot

cover: vendor
bin/coverage-check clover.xml 100
Expand Down
39 changes: 18 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{
"require": {
"php": ">=7.2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "*",
"phpunit/phpunit": "6.5.9",
"10up/wp_mock": "0.3.0",
"antecedent/patchwork": "*",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"rregeer/phpunit-coverage-check": "^0.1.6",
"phpunit/phpcov": "*",
"phpro/grumphp": "^0.14.2",
"sensiolabs/security-checker": "^5.0",
"maglnet/composer-require-checker": "^1.1",
"wp-cli/wp-cli": "^2.0"
},
"config": {
"bin-dir": "bin/"
}
"require": {
"php": ">=7.2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpunit/phpunit": "^9.5.0",
"10up/wp_mock": "^0.4.2",
"antecedent/patchwork": "^2.1.12",
"php-coveralls/php-coveralls": "^2.4.3",
"squizlabs/php_codesniffer": "^3.5.8",
"wp-coding-standards/wpcs": "^2.3.0",
"rregeer/phpunit-coverage-check": "^0.3.1",
"phpunit/phpcov": "^8.2.0",
"phpro/grumphp": "^1.3.0"
},
"config": {
"bin-dir": "bin/"
}
}
Loading

0 comments on commit d6d1c27

Please sign in to comment.