Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches: [ master, v3-branch ]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: docker run --rm -v $PWD:/code --entrypoint='' humanmade/plugin-tester composer install

- name: Run tests
run: ./tests/run-tests.sh --coverage-clover=coverage.xml

- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
Lightweight "drop-in" for storing WordPress uploads on Amazon S3 instead of the local filesystem.
</td>
<td align="right" width="20%">
<a href="https://shepherd.dev/github/humanmade/S3-Uploads/">
<a href="https://shepherd.dev/github/humanmade/S3-Uploads">
<img src="https://shepherd.dev/github/humanmade/S3-Uploads/coverage.svg" alt="Psalm coverage">
</a>
<a href="https://travis-ci.com/humanmade/S3-Uploads">
<img src="https://travis-ci.com/humanmade/S3-Uploads.svg?branch=master" alt="Build status">
<a href="https://github.com/humanmade/S3-Uploads/actions/workflows/ci.yml">
<img src="https://github.com/humanmade/S3-Uploads/actions/workflows/ci.yml/badge.svg" alt="CI">
</a>
<a href="http://codecov.io/github/humanmade/S3-Uploads?branch=master">
<img src="http://codecov.io/github/humanmade/S3-Uploads/coverage.svg?branch=master" alt="Coverage via codecov.io" />
<a href="https://codecov.io/github/humanmade/S3-Uploads" >
<img src="https://codecov.io/github/humanmade/S3-Uploads/graph/badge.svg?token=JmeqBWddkV"/>
</a>
</td>
</tr>
Expand All @@ -32,7 +32,7 @@ It's focused on providing a highly robust S3 interface with no "bells and whistl

## Requirements

- PHP >= 7.1
- PHP >= 7.4
- WordPress >= 5.3

## Getting Set Up
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"require-dev": {
"phpunit/phpunit": "7.5",
"pcov/clobber": "^2.0",
"humanmade/psalm-plugin-wordpress": "^1.0"
"humanmade/psalm-plugin-wordpress": "^1.0",
"yoast/phpunit-polyfills": "^4.0"
},
"scripts": {
"test": "./tests/run-tests.sh",
Expand Down
1 change: 1 addition & 0 deletions inc/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ public function set_attachment_files_acl( int $attachment_id, string $acl ) : ?W
*
* @param int $attachment_id Attachment whose ACL has been changed.
* @param string $acl The new ACL that's been set.
* @psalm-suppress TooManyArguments -- Currently do_action doesn't detect variable number of arguments.
*/
do_action( 's3_uploads_set_attachment_files_acl', $attachment_id, $acl );

Expand Down
2 changes: 1 addition & 1 deletion tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mkdir /tmp/s3-uploads-tests/tests

docker run --rm --name s3-uploads-tests-minio -d --rm -p 9000:9000 -e MINIO_ACCESS_KEY=AWSACCESSKEY -e MINIO_SECRET_KEY=AWSSECRETKEY -v /tmp/s3-uploads-tests:/data minio/minio server /data > /dev/null

docker run --rm -e S3_UPLOADS_BUCKET=tests -e S3_UPLOADS_KEY=AWSACCESSKEY -e S3_UPLOADS_SECRET=AWSSECRETKEY -e S3_UPLOADS_REGION=us-east-1 -v $PWD:/code humanmade/plugin-tester $@
docker run --rm -e AWS_SUPPRESS_PHP_DEPRECATION_WARNING=1 -e S3_UPLOADS_BUCKET=tests -e S3_UPLOADS_KEY=AWSACCESSKEY -e S3_UPLOADS_SECRET=AWSSECRETKEY -e S3_UPLOADS_REGION=us-east-1 -v $PWD:/code humanmade/plugin-tester $@
docker kill s3-uploads-tests-minio > /dev/null

echo "Running Psalm..."
Expand Down
8 changes: 4 additions & 4 deletions tests/test-s3-uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function test_generate_attachment_metadata() {
$upload_dir = wp_upload_dir();
copy( dirname( __FILE__ ) . '/data/sunflower.jpg', $upload_dir['path'] . '/sunflower.jpg' );
$test_file = $upload_dir['path'] . '/sunflower.jpg';
$attachment_id = $this->factory->attachment->create_object( $test_file, 0, array(
$attachment_id = self::factory()->attachment->create_object( $test_file, 0, array(
'post_mime_type' => 'image/jpeg',
'post_excerpt' => 'A sample caption',
) );
Expand All @@ -99,7 +99,7 @@ public function test_generate_attachment_metadata_for_mp4() {
$upload_dir = wp_upload_dir();
copy( dirname( __FILE__ ) . '/data/video.m4v', $upload_dir['path'] . '/video.m4v' );
$test_file = $upload_dir['path'] . '/video.m4v';
$attachment_id = $this->factory->attachment->create_object( $test_file, 0, array(
$attachment_id = self::factory()->attachment->create_object( $test_file, 0, array(
'post_mime_type' => 'video/mp4',
'post_excerpt' => 'A sample caption',
) );
Expand All @@ -116,7 +116,7 @@ public function test_image_sizes_are_deleted_on_attachment_delete() {
$upload_dir = wp_upload_dir();
copy( dirname( __FILE__ ) . '/data/sunflower.jpg', $upload_dir['path'] . '/sunflower.jpg' );
$test_file = $upload_dir['path'] . '/sunflower.jpg';
$attachment_id = $this->factory->attachment->create_object( $test_file, 0, array(
$attachment_id = self::factory()->attachment->create_object( $test_file, 0, array(
'post_mime_type' => 'image/jpeg',
'post_excerpt' => 'A sample caption',
) );
Expand All @@ -138,7 +138,7 @@ public function test_generate_attachment_metadata_for_pdf() {
$upload_dir = wp_upload_dir();
copy( dirname( __FILE__ ) . '/data/gdpr.pdf', $upload_dir['path'] . '/gdpr.pdf' );
$test_file = $upload_dir['path'] . '/gdpr.pdf';
$attachment_id = $this->factory->attachment->create_object( $test_file, 0, array(
$attachment_id = self::factory()->attachment->create_object( $test_file, 0, array(
'post_mime_type' => 'application/pdf',
'post_excerpt' => 'A sample caption',
) );
Expand Down
Loading