Skip to content

Commit 1c99660

Browse files
authored
Merge pull request #1 from tinify/master
Update
2 parents d14d5f8 + b1198b1 commit 1c99660

File tree

74 files changed

+21560
-2470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+21560
-2470
lines changed

.github/actions/setup/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup PHP
2+
description: Setup PHP environment, cache dependencies, and install dependencies
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up PHP
7+
uses: shivammathur/setup-php@v2
8+
with:
9+
php-version: ${{ inputs.php }}
10+
tools: composer
11+
12+
- name: Cache Composer Dependencies
13+
uses: actions/cache@v3
14+
with:
15+
path: vendor
16+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
17+
restore-keys: |
18+
${{ runner.os }}-composer-
19+
20+
- name: Install Dependencies
21+
shell: bash
22+
run: composer install --prefer-dist --no-progress --no-suggest
23+
24+
inputs:
25+
php:
26+
description: PHP version
27+
required: true

.github/workflows/check-test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Check and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
continue-on-error: true # We haven't solved all formatting issues yet.
16+
strategy:
17+
matrix:
18+
php: ['7.4']
19+
steps:
20+
- name: Checkout Code
21+
uses: actions/checkout@v3
22+
23+
- name: Setup
24+
uses: ./.github/actions/setup
25+
with:
26+
php: ${{ matrix.php }}
27+
28+
- name: PHPCS
29+
run: ./bin/check-style
30+
31+
test:
32+
needs: check
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 10
35+
strategy:
36+
matrix:
37+
php: ['7.4']
38+
steps:
39+
- name: Checkout Code
40+
uses: actions/checkout@v3
41+
42+
- name: Setup
43+
uses: ./.github/actions/setup
44+
with:
45+
php: ${{ matrix.php }}
46+
47+
- name: PHPUnit
48+
run: ./bin/unit-tests
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
strategy:
16+
matrix:
17+
include:
18+
- { wp: 40, php: 56 }
19+
- { wp: 40, php: 70 }
20+
- { wp: 57, php: 73 }
21+
- { wp: 60, php: 73 }
22+
- { wp: 63, php: 80 }
23+
- { wp: 67, php: 82 }
24+
- { wp: 67, php: 83 }
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
cache: 'npm'
34+
35+
- name: Cache node_modules
36+
uses: actions/cache@v4
37+
with:
38+
path: node_modules
39+
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
40+
restore-keys: |
41+
${{ runner.os }}-node-modules-
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Get installed Playwright version
47+
id: playwright-version
48+
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
49+
50+
- name: Cache Playwright
51+
uses: actions/cache@v4
52+
id: playwright-cache
53+
with:
54+
path: |
55+
~/.cache/ms-playwright
56+
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
57+
58+
- run: npx playwright install --with-deps
59+
if: steps.playwright-cache.outputs.cache-hit != 'true'
60+
61+
- name: Run script
62+
run: ./bin/integration-tests ${{ matrix.wp }} ${{ matrix.php}}
63+
64+
- uses: actions/upload-artifact@v4
65+
if: ${{ !cancelled() }}
66+
with:
67+
name: playwright-report-${{ matrix.wp }}-${{ matrix.php }}
68+
path: playwright-report/
69+
retention-days: 30

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ composer.phar
66
/tmp/*
77
!/tmp/.gitkeep
88
/src/languages/
9+
node_modules/
10+
/test-results/
11+
/playwright-report/
12+
/blob-report/
13+
/playwright/.cache/
14+
test/integration/.auth/user.json
15+
artifacts/

.travis.yml

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

.wp-env.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": [ "." ]
3+
}

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[<img src="https://travis-ci.org/tinify/wordpress-plugin.svg?branch=master" alt="Build Status">](https://travis-ci.org/tinify/wordpress-plugin)
2-
31
# TinyPNG - JPEG, PNG & WebP image compression for WordPress
42

53
Make your website faster by optimizing your JPEG, PNG, and WebP images.
@@ -19,19 +17,19 @@ Got questions or feedback? Let us know! Contact us at [email protected].
1917
### Prerequisites
2018
* A working Docker 1.12+ and Docker Compose installation (https://docs.docker.com/installation/).
2119
* Composer (https://getcomposer.org/download/).
22-
* PhantomJS 2.1 or greater (http://phantomjs.org).
23-
* MySQL client and admin tools.
20+
* Node LTS
2421

2522
### Running the plugin in WordPress
26-
1. Run `bin/run-wordpress <version>`. E.g. `bin/run-wordpress 60`.
27-
2. Connect to Wordpress on port `80<version>` (e.g. port `8060`).
23+
1. Run `bin/run-wordpress <wordpress version> <php version>`. E.g. `bin/run-wordpress 60 73`.
24+
2. Connect to Wordpress on port `80<wordpress version>` (e.g. port `8060`).
2825

2926
### Running the unit tests
3027
1. Run `bin/unit-tests <optional path to file>`.
3128

3229
### Running the integration tests
3330
1. Install Docker 1.12 and docker-compose.
34-
2. Run `bin/integration-tests <version>`. E.g. `bin/integration-tests 60`.
31+
2. Install npm dependancies
32+
3. Run `bin/integration-tests <wordpress version> <php version>`. E.g. `bin/integration-tests 60 80`.
3533

3634
### Check if the code follows WordPress standard
3735
1. Run `bin/check-style` to make sure there are no errors.

0 commit comments

Comments
 (0)