Skip to content

Commit 5b7abde

Browse files
Merge pull request #383 from buddypress/github-actions
Support for Github Actions
2 parents 6dc3d6f + fdd7b2b commit 5b7abde

15 files changed

Lines changed: 3407 additions & 244 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Coding Standards
2+
3+
on: pull_request
4+
5+
jobs:
6+
phpcs:
7+
name: PHPCS
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: ['8.0']
13+
14+
steps:
15+
- name: Cancel previous runs of this workflow (pull requests only)
16+
if: ${{ github.event_name == 'pull_request' }}
17+
uses: styfle/cancel-workflow-action@0.5.0
18+
with:
19+
access_token: ${{ github.token }}
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
coverage: none
30+
31+
- name: Log information
32+
run: |
33+
echo "$GITHUB_REF"
34+
echo "$GITHUB_EVENT_NAME"
35+
git --version
36+
php --version
37+
composer --version
38+
39+
- name: Validate Composer
40+
run: composer validate --strict
41+
42+
- name: Install dependencies
43+
uses: ramsey/composer-install@v1
44+
with:
45+
composer-options: "--ignore-platform-reqs"
46+
47+
- name: Run PHPCS
48+
run: composer phpcs

‎.github/workflows/unit-tests.yml‎

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Unit Tests
2+
3+
on: pull_request
4+
5+
jobs:
6+
tests:
7+
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }}"
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
php: ['7.4', '8.0']
13+
wp_version: ['master']
14+
include:
15+
- php: '8.0'
16+
wp_version: '5.7'
17+
- php: '7.4'
18+
wp_version: '5.7'
19+
env:
20+
WP_ENV_PHP_VERSION: ${{ matrix.php }}
21+
WP_VERSION: ${{ matrix.wp_version }}
22+
23+
steps:
24+
- name: Cancel previous runs of this workflow (pull requests only)
25+
if: ${{ github.event_name == 'pull_request' }}
26+
uses: styfle/cancel-workflow-action@0.5.0
27+
with:
28+
access_token: ${{ github.token }}
29+
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
33+
- name: Check Gitignored files
34+
run: if [[ ! -z $(git ls-files -i --exclude-standard) ]]; then exit 1; fi
35+
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: ${{ matrix.php }}
40+
tools: composer:v2
41+
coverage: none
42+
43+
- name: Log information
44+
run: |
45+
echo "$GITHUB_REF"
46+
echo "$GITHUB_EVENT_NAME"
47+
npm --version
48+
node --version
49+
git --version
50+
php --version
51+
composer --version
52+
53+
- name: Validate Composer
54+
run: composer validate --strict
55+
56+
- name: Install Composer dependencies
57+
uses: ramsey/composer-install@v1
58+
with:
59+
composer-options: "--ignore-platform-reqs"
60+
61+
- name: Cache node modules
62+
uses: actions/cache@v2
63+
env:
64+
cache-name: cache-node-modules
65+
with:
66+
# npm cache files are stored in `~/.npm` on Linux/macOS
67+
path: ~/.npm
68+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
69+
restore-keys: |
70+
${{ runner.os }}-build-${{ env.cache-name }}-
71+
${{ runner.os }}-build-
72+
${{ runner.os }}-
73+
74+
- name: Validate node modules
75+
run: if [[ -f package.json ]]; then npm audit --audit-level=high --production --cache ~/.npm; fi
76+
77+
- name: Install node modules
78+
run: npm ci --cache ~/.npm
79+
80+
- name: Setup WordPress
81+
run: echo "{\"core\":\"WordPress/WordPress#${WP_VERSION}\"}" >> .wp-env.override.json
82+
83+
- name: Install WordPress
84+
run: |
85+
chmod -R 767 ./
86+
npm run wp-env start -- --update
87+
88+
- name: Running single site unit tests
89+
run: npm run phpunit
90+
if: ${{ success() || failure() }}
91+
92+
- name: Running multisite unit tests
93+
run: npm run phpunit:mu
94+
if: ${{ success() || failure() }}
95+
96+
- name: Stop Docker environment
97+
run: npm run wp-env stop
98+
if: ${{ success() || failure() }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/npm-debug.log
55
/vendor/
66
.vscode
7+
.wp-env.override.json
78

89
# Operating system specific files
910
.DS_Store

‎.travis.yml‎

Lines changed: 0 additions & 129 deletions
This file was deleted.

‎.wp-env.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"core": "WordPress/WordPress#master",
3+
"plugins": [ ".", "buddypress/BuddyPress#master" ],
4+
"config": {
5+
"WP_DEBUG": true,
6+
"SCRIPT_DEBUG": true
7+
}
8+
}

‎README.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Access your BuddyPress site's data through an easy-to-use HTTP REST API.
44

5-
[![Build Status](https://travis-ci.org/buddypress/BP-REST.svg?branch=master)](https://travis-ci.org/buddypress/BP-REST)
6-
75
## Documentation
86

97
We have extensive documentation of each endpoint/components and their CRUD actions: <https://developer.buddypress.org/bp-rest-api/>

‎composer.json‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,36 @@
33
"description": "REST API endpoints for BuddyPress",
44
"type": "library",
55
"keywords": [
6-
"bp-rest",
7-
"bp-rest-api",
8-
"buddypress",
9-
"plugin"
10-
],
11-
"homepage": "https://buddypress.org",
12-
"license": "GPL-2.0-or-later",
6+
"bp-rest",
7+
"bp-rest-api",
8+
"buddypress",
9+
"plugin"
10+
],
11+
"homepage": "https://buddypress.org",
12+
"license": "GPL-2.0-or-later",
1313
"authors": [ {
14-
"name": "BuddyPress Community",
15-
"homepage": "https://buddypress.org/about/"
16-
} ],
14+
"name": "BuddyPress Community",
15+
"homepage": "https://buddypress.org/about/"
16+
} ],
1717
"support": {
18-
"forum": "https://buddypress.org/support/",
19-
"docs": "https://codex.buddypress.org/",
20-
"issues": "https://buddypress.trac.wordpress.org/",
21-
"rss": "https://buddypress.org/feed/",
22-
"source": "https://buddypress.trac.wordpress.org/browser/",
23-
"wiki": "https://codex.buddypress.org/"
24-
},
18+
"forum": "https://buddypress.org/support/",
19+
"docs": "https://codex.buddypress.org/",
20+
"issues": "https://buddypress.trac.wordpress.org/",
21+
"rss": "https://buddypress.org/feed/",
22+
"source": "https://buddypress.trac.wordpress.org/browser/",
23+
"wiki": "https://codex.buddypress.org/"
24+
},
2525
"require": {
26-
"composer/installers": "^1.10.0",
27-
"php": ">=5.6.0"
28-
},
26+
"composer/installers": "^1.10.0",
27+
"php": ">=5.6.0"
28+
},
2929
"require-dev": {
3030
"squizlabs/php_codesniffer" : "^3.5.4",
3131
"phpcompatibility/phpcompatibility-wp": "^2.1.0",
32-
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
33-
"wp-coding-standards/wpcs": "*"
32+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
33+
"wp-coding-standards/wpcs": "*",
34+
"phpunit/phpunit": "^7.5",
35+
"wp-phpunit/wp-phpunit": "^5.7"
3436
},
3537
"scripts": {
3638
"phpcs" : "phpcs . --basepath=.",

0 commit comments

Comments
 (0)