Skip to content

Commit 4a99689

Browse files
committed
add test workflow
1 parent 13a9758 commit 4a99689

File tree

7 files changed

+460
-54
lines changed

7 files changed

+460
-54
lines changed

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
max_line_length = 9999999
8+
9+
[*.json]
10+
indent_style = space
11+
indent_size = 2
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
[.vscode/settings.json]
16+
indent_style = tab
17+
insert_final_newline = true
18+
trim_trailing_whitespace = true
19+
20+
[*.yaml]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[*.yml]
25+
indent_style = space
26+
indent_size = 2
27+
28+
[*.md]
29+
trim_trailing_whitespace = false

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test
2+
on:
3+
push:
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
# Test node 18/20/22/24 on ubuntu
17+
# Test node 24 on macos/windows
18+
# Enable annotations only for node 24 + ubuntu
19+
matrix:
20+
os: [ubuntu-latest]
21+
php: ['8.1', '8.2']
22+
wordpress: ['6.6.4']
23+
services:
24+
mysql:
25+
image: mysql:8
26+
env:
27+
MYSQL_RANDOM_ROOT_PASSWORD: 1
28+
MYSQL_DATABASE: wp_tests_db
29+
MYSQL_USER: wp_test
30+
MYSQL_PASSWORD: password
31+
MYSQL_HOST: 127.0.0.1
32+
ports:
33+
- 3306
34+
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
35+
steps:
36+
- uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php }}
39+
40+
- name: check out
41+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
42+
43+
- name: setup
44+
env:
45+
WP_VERSION: ${{ matrix.wordpress }}
46+
run: |
47+
bash bin/install-wp-tests.sh wp_tests_db wp_test password 127.0.0.1 $WP_VERSION
48+
pecl install imagick
49+
50+
- name: test
51+
run: |
52+
phpunit

.phpcs.xml.dist

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Mr. Henry's rules">
3+
<description>All the rules!</description>
4+
5+
<!-- ##### WordPress sniffs #####-->
6+
<rule ref="WordPress">
7+
<exclude name="PSR12.Files.FileHeader.IncorrectOrder" />
8+
<exclude name="Squiz.Commenting.ClassComment.Missing" />
9+
<exclude name="Squiz.Commenting.FileComment.Missing" />
10+
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
11+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
12+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
13+
<exclude name="Squiz.Commenting.FileComment.WrongStyle" />
14+
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
15+
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
16+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
17+
<exclude name="Squiz.Commenting.VariableComment.Missing" />
18+
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed" />
19+
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
20+
<exclude name="WordPress.NamingConventions.ValidHookName.NotLowercase" />
21+
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
22+
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode" />
23+
<exclude name="WordPress.PHP.YodaConditions" />
24+
<exclude name="WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents" />
25+
<exclude name="Generic.Functions.CallTimePassByReference" />
26+
</rule>
27+
</ruleset>

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ script:
2727

2828
after_script:
2929
# Push coverage off to Codecov
30-
- bash <(curl -s https://codecov.io/bash)
30+
- bash <(curl -s https://codecov.io/bash)

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"phpsab.executablePathCBF": "vendor/bin/phpcbf",
3+
"phpsab.fixerEnable": true,
4+
"phpsab.snifferEnable": true,
5+
"phpsab.snifferMode": "onSave",
6+
"phpsab.allowedAutoRulesets": [
7+
".phpcs.xml",
8+
".phpcs.xml.dist",
9+
"phpcs.ruleset.xml",
10+
"phpcs.xml",
11+
"phpcs.xml.dist",
12+
"ruleset.xml"
13+
],
14+
"intelephense.files.maxSize": 10000000,
15+
"intelephense.environment.phpVersion": "^8.2",
16+
"intelephense.maxMemory": 1024,
17+
"intelephense.phpdoc.useFullyQualifiedNames": true,
18+
"intelephense.format.enable": false
19+
}

composer.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,13 @@
77
],
88
"license": "GPL-2.0+",
99
"support" : {
10-
"issues": "https://github.com/mrhenry/s3-uploads/issues",
11-
"source": "https://github.com/mrhenry/s3-uploads"
10+
"issues": "https://github.com/mrhenry/S3-Uploads/issues",
11+
"source": "https://github.com/mrhenry/S3-Uploads"
1212
},
1313
"type": "wordpress-plugin",
1414
"require": {
1515
"composer/installers": "^1.0 || ^2.0"
1616
},
17-
"require-dev": {
18-
"wp-coding-standards/wpcs": "^2.2"
19-
},
20-
"scripts": {
21-
"post-install-cmd": [
22-
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
23-
],
24-
"post-update-cmd": [
25-
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
26-
]
27-
},
2817
"archive": {
2918
"exclude": [
3019
".git",
@@ -35,7 +24,11 @@
3524
},
3625
"config": {
3726
"allow-plugins": {
38-
"composer/installers": true
27+
"composer/installers": true,
28+
"dealerdirect/phpcodesniffer-composer-installer": true
3929
}
30+
},
31+
"require-dev": {
32+
"wp-coding-standards/wpcs": "^3.0"
4033
}
4134
}

0 commit comments

Comments
 (0)