-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* change branch name Signed-off-by: Xheni Myrtaj <[email protected]> * Disable REST API by default Signed-off-by: Xheni Myrtaj <[email protected]> * Change path Signed-off-by: Xheni Myrtaj <[email protected]> * Remove prefix Signed-off-by: Xheni Myrtaj <[email protected]> * [FEATURE] Get the number of subscribers of list and added tests (#116) Closes #115 * [BUGFIX] Fix the expected number in an integration test (#119) Signed-off-by: Xheni Myrtaj <[email protected]> * [CLEANUP] Fix a warning with newer PHPMD versions (#125) * update php dependencies * update to pass building * ISSUE-337: update package versions * ISSUE-337: use local * ISSUE-337: symfony 6.4 * ISSUE-337: test fix * ISSUE-337: fix the rest of tests * GitHub actions (#132) * added github workflow(action) for build and test ci tasks Signed-off-by: fenn-cs <[email protected]> * updated php_codesniffer dep Signed-off-by: fenn-cs <[email protected]> * removed travis ci config file Signed-off-by: fenn-cs <[email protected]> (cherry picked from commit 70d45ad) * ISSUE-337: add pipeline * ISSUE-337: fix phpstan * ISSUE-337: fix phpstmd * ISSUE-337: openapi docs * ISSUE-337: move to bundle file * ISSUE-337: changelog * ISSUE-337: update core * ISSUE-337: fix phpstan * ISSUE-337: fix phpcs * ISSUE-337: force push * ISSUE-337: name fix --------- Signed-off-by: Xheni Myrtaj <[email protected]> Co-authored-by: Xheni Myrtaj <[email protected]> Co-authored-by: Oliver Klee <[email protected]> Co-authored-by: Michiel Dethmers <[email protected]> Co-authored-by: Tatevik <[email protected]> Co-authored-by: F. E Noel Nfebe <[email protected]>
- Loading branch information
1 parent
5307afd
commit 789315a
Showing
30 changed files
with
1,451 additions
and
1,254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,93 @@ | ||
name: Publish REST API Docs | ||
on: [push, pull_request] | ||
name: Publish REST API Docs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
make-restapi-docs: | ||
name: Checkout phpList rest-api and generate docs specification (OpenAPI latest-restapi.json) | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP with Composer and Extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
php-version: 8.1 | ||
extensions: mbstring, dom, fileinfo, mysql | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
|
||
- name: Cache Composer Dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
# Use composer.json for key, if composer.lock is not committed. | ||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
path: ~/.composer/cache | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install current dependencies from composer.lock | ||
run: composer install | ||
- name: Generate OpenAPI Specification JSON for REST API | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install Composer Dependencies | ||
run: composer install --no-interaction --prefer-dist | ||
|
||
- name: Generate OpenAPI Specification JSON | ||
run: vendor/bin/openapi -o docs/latest-restapi.json --format json src | ||
- name: Upload REST API(latest-restapi.json) Spec | ||
uses: actions/upload-artifact@v2 | ||
|
||
- name: Upload REST API Specification | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: restapi-json | ||
path: docs/latest-restapi.json | ||
|
||
deploy-docs: | ||
name: Deploy REST API specification. | ||
name: Deploy REST API Specification | ||
runs-on: ubuntu-20.04 | ||
needs: make-restapi-docs | ||
steps: | ||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
- name: Install openapi-checker | ||
run: npm install -g openapi-checker | ||
- name: Checkout phplist/restapi-docs | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: phpList/restapi-docs | ||
fetch-depth: 0 | ||
token: ${{ secrets.PUSH_REST_API_DOCS }} | ||
- name: Restore REST API Spec | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: restapi-json | ||
- name: Validate latest-restapi.json | ||
run: openapi-checker latest-restapi.json | ||
- name: Get difference between latest-restapi.json and restapi.json | ||
# `|| true` to supress exit code 1 [git diff exits with 1 when there is a difference between the two files and 0 for the reverse. | ||
run: git diff --no-index --output=restapi-diff.txt latest-restapi.json restapi.json || true | ||
- name: Verify difference latest-restapi.json and restapi.json | ||
id: allow-deploy | ||
run: | | ||
if [ -s restapi-diff.txt ]; then echo "Updates made to restapi.json deployment proceeding."; echo '::set-output name=DEPLOY::true'; else echo "No updates made to restapi.json deployment would be skipped."; echo '::set-output name=DEPLOY::false'; fi | ||
- name: Commit and changes and deply | ||
if: ${{ steps.allow-deploy.outputs.DEPLOY == 'true' }} | ||
run: | | ||
mv latest-restapi.json restapi.json | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git add restapi.json | ||
git commit -s -m "phplist/rest-api docs deployment `date`" | ||
git push | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Install openapi-checker | ||
run: npm install -g swagger-cli | ||
|
||
- name: Checkout REST API Docs Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: phpList/restapi-docs | ||
fetch-depth: 0 | ||
token: ${{ secrets.PUSH_REST_API_DOCS }} | ||
|
||
- name: Download Generated REST API Specification | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: restapi-json | ||
path: docs | ||
|
||
- name: Validate OpenAPI Specification | ||
run: swagger-cli validate docs/latest-restapi.json | ||
|
||
- name: Compare Specifications | ||
run: git diff --no-index --output=restapi-diff.txt docs/latest-restapi.json restapi.json || true | ||
|
||
- name: Check Differences and Decide Deployment | ||
id: allow-deploy | ||
run: | | ||
if [ -s restapi-diff.txt ]; then | ||
echo "Updates detected in the REST API specification. Proceeding with deployment."; | ||
echo 'DEPLOY=true' >> $GITHUB_ENV; | ||
else | ||
echo "No changes detected in the REST API specification. Skipping deployment."; | ||
echo 'DEPLOY=false' >> $GITHUB_ENV; | ||
fi | ||
- name: Commit and Deploy Updates | ||
if: env.DEPLOY == 'true' | ||
run: | | ||
mv docs/latest-restapi.json docs/restapi.json | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git add docs/restapi.json | ||
git commit -m "Update REST API documentation `date`" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
/public/ | ||
/var/ | ||
/vendor/ | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
services: | ||
Psr\Container\ContainerInterface: | ||
alias: 'service_container' | ||
|
||
PhpList\RestBundle\Controller\: | ||
resource: '../src/Controller' | ||
public: true | ||
autowire: true | ||
tags: ['controller.service_arguments'] | ||
|
||
# Symfony\Component\Serializer\SerializerInterface: | ||
# autowire: true | ||
# autoconfigure: true | ||
|
||
my.secure_handler: | ||
class: \PhpList\RestBundle\ViewHandler\SecuredViewHandler | ||
class: \PhpList\RestBundle\ViewHandler\SecuredViewHandler | ||
|
||
my.secure_view_handler: | ||
parent: fos_rest.view_handler.default | ||
calls: | ||
- ['registerHandler', [ 'json', ['@my.secure_handler', 'createResponse'] ] ] | ||
parent: fos_rest.view_handler.default | ||
calls: | ||
- ['registerHandler', [ 'json', ['@my.secure_handler', 'createResponse'] ] ] | ||
|
||
PhpList\Core\Security\Authentication: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
PhpList\RestBundle\EventListener\ExceptionListener: | ||
tags: | ||
- { name: kernel.event_listener, event: kernel.exception } | ||
|
||
PhpList\RestBundle\EventListener\ResponseListener: | ||
tags: | ||
- { name: kernel.event_listener, event: kernel.response } |
Oops, something went wrong.