From da8c6a6d02191f05ed74ddccd2fc3e2fb002376b Mon Sep 17 00:00:00 2001 From: Martin Heise Date: Fri, 12 Jan 2024 15:11:44 +0100 Subject: [PATCH] Setup GitHub CI (#1) * Enable Github CI * Update ci.yml * Require "colymba/gridfield-bulk-editing-tools" for now to fix "class not found" issue * Fix CI tests * Deacticate phplinting for now --- .github/workflows/ci.yml | 13 +++++++++++++ CONTRIBUTING.md | 14 ++++++++++++++ composer.json | 4 ++-- phpcs.xml.dist | 5 ++++- tests/Model/DLPageTest.php | 3 +++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..feaf26e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,13 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + ci: + name: CI + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 + with: + phplinting: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 854139a..c5ede07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,15 @@ # Contributing + +- Maintenance on this module is a shared effort of those who use it +- To contribute improvements to the code, ensure you raise a pull request and discuss with the module maintainers +- Please follow the Silverstripe CMS [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard) +- Supply documentation that follows the [GitHub Flavored Markdown](https://help.github.com/articles/markdown-basics/) conventions +- When having discussions about this module in issues or pull request please adhere to the [Silverstripe CMS Community Code of Conduct](https://docs.silverstripe.org/en/project_governance/code_of_conduct/) + +## Contributor license agreement + +By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright +of that code to Martin Heise, on the condition that these code changes are released under the +same BSD license as the original module. We ask for this so that the ownership in the license is clear +and unambiguous. By releasing this code under a permissive license such as BSD, this copyright assignment +won't prevent you from using the code in any way you see fit. diff --git a/composer.json b/composer.json index 33ecd1e..05df970 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ ], "require": { "php": "^8.0", - "silverstripe/framework": "^4.0 || ^5.0" + "silverstripe/framework": "^4.0 || ^5.0", + "colymba/gridfield-bulk-editing-tools": "^3.0 || ^4.0" }, "require-dev": { "phpunit/phpunit": "^9.5" }, "suggest": { "bummzack/sortablefile": "Support for sortable UploadFields, e.g. for Download Package files", - "colymba/gridfield-bulk-editing-tools": "Support for bulk actions in Admin", "ext/zip": "Support for DownloadPackages as zip" }, "autoload": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index fe58f6f..af86128 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,7 +1,10 @@ - + CodeSniffer ruleset for SilverStripe coding conventions. + src + tests + diff --git a/tests/Model/DLPageTest.php b/tests/Model/DLPageTest.php index 930b296..da7ef03 100644 --- a/tests/Model/DLPageTest.php +++ b/tests/Model/DLPageTest.php @@ -5,6 +5,7 @@ use Mhe\DownloadCodes\Model\DLCode; use Mhe\DownloadCodes\Model\DLRedemption; use Page; +use PHPUnit\Util\Test; use SilverStripe\Assets\Dev\TestAssetStore; use SilverStripe\Assets\File; use SilverStripe\Assets\Folder; @@ -40,6 +41,8 @@ protected function setUp(): void // setup test file storage TestAssetStore::activate('DownloadFiles'); + // test response code like in live mode + TestAssetStore::config()->set('denied_response_code', 404); /** @var File $file */ $files = File::get()->exclude('ClassName', Folder::class); foreach ($files as $file) {