Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit abd2544

Browse files
committed
Moved to Github Actions
1 parent 9db2931 commit abd2544

22 files changed

+515
-445
lines changed

.codeclimate.yml

-50
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/cs.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Coding Standards
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- '**.md'
9+
- '**.txt'
10+
pull_request:
11+
paths-ignore:
12+
- '**.md'
13+
- '**.txt'
14+
# Allow manually triggering the workflow.
15+
workflow_dispatch:
16+
17+
jobs:
18+
checkcs:
19+
name: 'PHPCS check'
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Install PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: '7.4'
30+
tools: cs2pr
31+
coverage: none
32+
33+
- name: 'Composer: set up PHPCS dependencies'
34+
run: |
35+
composer require --no-update squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer
36+
37+
# Install dependencies and handle caching in one go.
38+
# @link https://github.com/marketplace/actions/install-composer-dependencies
39+
- name: Install Composer dependencies
40+
uses: "ramsey/composer-install@v1"
41+
42+
- name: 'Run Composer Update'
43+
run: |
44+
composer update
45+
46+
# Check the code-style consistency of the PHP files.
47+
- name: Check PHP code style
48+
continue-on-error: true
49+
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
50+
51+
- name: Show PHPCS results in PR
52+
run: cs2pr --graceful-warnings ./phpcs-report.xml

.github/workflows/unit-tests.yml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Unit Tests
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- '**.md'
9+
- '**.txt'
10+
pull_request:
11+
paths-ignore:
12+
- '**.md'
13+
- '**.txt'
14+
# Allow manually triggering the workflow.
15+
workflow_dispatch:
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
# Notes regarding supported versions in WP:
25+
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
26+
php: ['7.1', '7.2', '7.3', '7.4']
27+
wp: ['latest']
28+
experimental: [false]
29+
30+
include:
31+
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
32+
# PHP 8.0 is sort of supported since WP 5.6.
33+
# PHP 7.4 is supported since WP 5.3.
34+
- php: '8.0'
35+
wp: 'latest'
36+
experimental: true
37+
- php: '8.0'
38+
wp: '5.6'
39+
experimental: true
40+
- php: '7.4'
41+
wp: '5.5'
42+
experimental: true
43+
- php: '7.4'
44+
wp: 'nightly'
45+
experimental: true
46+
47+
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }}"
48+
49+
continue-on-error: ${{ matrix.experimental }}
50+
51+
services:
52+
mysql:
53+
# WP 5.4 is the first WP version which largely supports MySQL 8.0.
54+
# See: https://core.trac.wordpress.org/ticket/49344
55+
# During the setting up of these tests, it became clear that MySQL 8.0
56+
# in combination with PHP < 7.4 is not properly/sufficiently supported
57+
# within WP Core.
58+
# See: https://core.trac.wordpress.org/ticket/52496
59+
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.4 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
60+
env:
61+
MYSQL_ALLOW_EMPTY_PASSWORD: false
62+
ports:
63+
- 3306:3306
64+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v2
69+
70+
- name: Install PHP
71+
uses: shivammathur/setup-php@v2
72+
with:
73+
php-version: ${{ matrix.php }}
74+
tools: phpunit-polyfills
75+
coverage: none
76+
# The PHP 5.6 and 7.0 images don't include mysql[i] by default.
77+
extensions: mysqli
78+
79+
- name: Set up WordPress
80+
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
81+
82+
# On WP 5.2, PHPUnit 5.x, 6.x and 7.x are supported.
83+
# On PHP >= 8.0, PHPUnit 7.5+ is needed, no matter what.
84+
- name: Determine supported PHPUnit version
85+
id: set_phpunit
86+
run: |
87+
if [[ "${{ matrix.php }}" > "7.4" ]]; then
88+
echo '::set-output name=PHPUNIT::7.5.*'
89+
else
90+
echo '::set-output name=PHPUNIT::5.7.*||6.*||7.5.*'
91+
fi
92+
93+
- name: 'Composer: set up PHPUnit'
94+
run: composer require --no-update phpunit/phpunit:"${{ steps.set_phpunit.outputs.PHPUNIT }}"
95+
96+
# Install dependencies and handle caching in one go.
97+
# @link https://github.com/marketplace/actions/install-composer-dependencies
98+
- name: Install Composer dependencies for PHP < 8.0
99+
if: ${{ matrix.php < 8.0 }}
100+
uses: "ramsey/composer-install@v1"
101+
102+
# For the PHP 8.0 and above, we need to install with ignore platform reqs as not all dependencies allow it yet.
103+
- name: Install Composer dependencies for PHP >= 8.0
104+
if: ${{ matrix.php >= 8.0 }}
105+
uses: "ramsey/composer-install@v1"
106+
with:
107+
composer-options: --ignore-platform-reqs
108+
109+
- name: 'Run Composer Update'
110+
run: |
111+
composer update --ignore-platform-reqs
112+
113+
- name: Tool versions
114+
run: |
115+
php --version
116+
composer --version
117+
phpunit --version
118+
which phpunit
119+
120+
- name: Run the unit tests - single site
121+
run: vendor/bin/phpunit
122+
123+
- name: Run the unit tests - multisite
124+
run: vendor/bin/phpunit
125+
env:
126+
WP_MULTISITE: 1

.github/workflows/zipitup.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# GitHub Action: whenever creating a new release of the source code,
2+
# also create a release of the installable plugin.
3+
# Steps to execute:
4+
# - Checkout the source code
5+
# - Run "composer install" to download all dependencies under vendor/
6+
# - Create a .zip file, excluding:
7+
# - All hidden files (.git, .gitignore, etc)
8+
# - All development files, ending in .dist
9+
# - All composer files <= after installing dependencies, no need for them anymore
10+
# - Markdown files concerning development
11+
# - Folder build/ <= created only to store the .zip file
12+
# - Folder dev-helpers/ <= not needed for the plugin
13+
# - Upload the .zip file as an artifact to the action (this step is possibly optional)
14+
# - Upload the .zip file as a release, for download
15+
name: Generate Installable Plugin, and Upload as Release Asset
16+
on:
17+
release:
18+
types: [published]
19+
jobs:
20+
build:
21+
name: Upload Release Asset
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
- name: Build project
27+
run: |
28+
mkdir build
29+
- name: Create artifact
30+
uses: montudor/[email protected]
31+
with:
32+
args: zip -X -r build/top-10-fast-tracker.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.yml composer.* dev-helpers** build** wporg-assets** phpunit**
33+
- name: Upload artifact
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: top-10-fast-tracker
37+
path: build/top-10-fast-tracker.zip
38+
- name: Upload to release
39+
uses: JasonEtco/upload-to-release@master
40+
with:
41+
args: build/top-10-fast-tracker.zip application/zip
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)