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

Commit

Permalink
Moved to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Jan 15, 2022
1 parent 9db2931 commit abd2544
Show file tree
Hide file tree
Showing 22 changed files with 515 additions and 445 deletions.
50 changes: 0 additions & 50 deletions .codeclimate.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
52 changes: 52 additions & 0 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Coding Standards

on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
checkcs:
name: 'PHPCS check'
runs-on: ubuntu-latest

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
coverage: none

- name: 'Composer: set up PHPCS dependencies'
run: |
composer require --no-update squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: 'Run Composer Update'
run: |
composer update
# Check the code-style consistency of the PHP files.
- name: Check PHP code style
continue-on-error: true
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
run: cs2pr --graceful-warnings ./phpcs-report.xml
126 changes: 126 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Unit Tests

on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Notes regarding supported versions in WP:
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
php: ['7.1', '7.2', '7.3', '7.4']
wp: ['latest']
experimental: [false]

include:
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
# PHP 8.0 is sort of supported since WP 5.6.
# PHP 7.4 is supported since WP 5.3.
- php: '8.0'
wp: 'latest'
experimental: true
- php: '8.0'
wp: '5.6'
experimental: true
- php: '7.4'
wp: '5.5'
experimental: true
- php: '7.4'
wp: 'nightly'
experimental: true

name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }}"

continue-on-error: ${{ matrix.experimental }}

services:
mysql:
# WP 5.4 is the first WP version which largely supports MySQL 8.0.
# See: https://core.trac.wordpress.org/ticket/49344
# During the setting up of these tests, it became clear that MySQL 8.0
# in combination with PHP < 7.4 is not properly/sufficiently supported
# within WP Core.
# See: https://core.trac.wordpress.org/ticket/52496
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.4 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpunit-polyfills
coverage: none
# The PHP 5.6 and 7.0 images don't include mysql[i] by default.
extensions: mysqli

- name: Set up WordPress
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}

# On WP 5.2, PHPUnit 5.x, 6.x and 7.x are supported.
# On PHP >= 8.0, PHPUnit 7.5+ is needed, no matter what.
- name: Determine supported PHPUnit version
id: set_phpunit
run: |
if [[ "${{ matrix.php }}" > "7.4" ]]; then
echo '::set-output name=PHPUNIT::7.5.*'
else
echo '::set-output name=PHPUNIT::5.7.*||6.*||7.5.*'
fi
- name: 'Composer: set up PHPUnit'
run: composer require --no-update phpunit/phpunit:"${{ steps.set_phpunit.outputs.PHPUNIT }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies for PHP < 8.0
if: ${{ matrix.php < 8.0 }}
uses: "ramsey/composer-install@v1"

# For the PHP 8.0 and above, we need to install with ignore platform reqs as not all dependencies allow it yet.
- name: Install Composer dependencies for PHP >= 8.0
if: ${{ matrix.php >= 8.0 }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs

- name: 'Run Composer Update'
run: |
composer update --ignore-platform-reqs
- name: Tool versions
run: |
php --version
composer --version
phpunit --version
which phpunit
- name: Run the unit tests - single site
run: vendor/bin/phpunit

- name: Run the unit tests - multisite
run: vendor/bin/phpunit
env:
WP_MULTISITE: 1
43 changes: 43 additions & 0 deletions .github/workflows/zipitup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# GitHub Action: whenever creating a new release of the source code,
# also create a release of the installable plugin.
# Steps to execute:
# - Checkout the source code
# - Run "composer install" to download all dependencies under vendor/
# - Create a .zip file, excluding:
# - All hidden files (.git, .gitignore, etc)
# - All development files, ending in .dist
# - All composer files <= after installing dependencies, no need for them anymore
# - Markdown files concerning development
# - Folder build/ <= created only to store the .zip file
# - Folder dev-helpers/ <= not needed for the plugin
# - Upload the .zip file as an artifact to the action (this step is possibly optional)
# - Upload the .zip file as a release, for download
name: Generate Installable Plugin, and Upload as Release Asset
on:
release:
types: [published]
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
run: |
mkdir build
- name: Create artifact
uses: montudor/[email protected]
with:
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**
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: top-10-fast-tracker
path: build/top-10-fast-tracker.zip
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: build/top-10-fast-tracker.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit abd2544

Please sign in to comment.