diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml new file mode 100644 index 0000000..c624cc1 --- /dev/null +++ b/.github/workflows/lint-php.yml @@ -0,0 +1,60 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: Lint php + +on: + pull_request: + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: lint-php-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + php-lint: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: [ "8.1" ] + + name: php-lint + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Lint + run: composer run lint + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: php-lint + + if: always() + + name: php-lint-summary + + steps: + - name: Summary status + run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi diff --git a/.github/workflows/pr-feedback.yml b/.github/workflows/pr-feedback.yml new file mode 100644 index 0000000..46eaff9 --- /dev/null +++ b/.github/workflows/pr-feedback.yml @@ -0,0 +1,34 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: 'Ask for feedback on PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + pr-feedback: + runs-on: ubuntu-latest + steps: + - name: The get-github-handles-from-website action + uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0 + id: scrape + with: + website: 'https://nextcloud.com/team/' + - uses: marcelklehr/pr-feedback-action@601109aa729eb4c8d6d0ece7567b9d4901db4aef + with: + feedback-message: | + Hello there, + Thank you so much for taking the time and effort to create a pull request to our Nextcloud project. + + We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. + + Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 + + Thank you for contributing to Nextcloud and we hope to hear from you soon! + days-before-feedback: 14 + start-date: "2023-11-08" + exempt-authors: "${{ steps.scrape.outputs.users }},nextcloud-command,nextcloud-android-bot" + exempt-bots: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a8984e9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,75 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: Generate OpenAPI + +on: + pull_request: + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: openapi-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + openapi: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: [ "8.1" ] + + name: openapi + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: composer i + + - name: Generate OpenAPI + working-directory: tests/ + run: ../generate-spec + + - name: Check openapi changes + run: | + bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)" + + - name: Show changes on failure + if: failure() + run: | + git status + git --no-pager diff + exit 1 # make it red to grab attention + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: openapi + + if: always() + + name: openapi-summary + + steps: + - name: Summary status + run: if ${{ needs.openapi.result != 'success' && needs.openapi.result != 'skipped' }}; then exit 1; fi diff --git a/composer.json b/composer.json index 4a93196..a57585e 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,31 @@ { - "name": "nextcloud/openapi-extractor", - "require": { - "php": "^8.1", - "ext-simplexml": "*", - "nikic/php-parser": "^4.16", - "adhocore/cli": "^v1.6", - "phpstan/phpdoc-parser": "^1.23" - }, - "require-dev": { - "nextcloud/coding-standard": "^1.1" - }, - "bin": [ - "generate-spec", - "merge-specs" - ], - "autoload": { - "psr-4": { - "OpenAPIExtractor\\": "src" - } - }, - "scripts": { - "cs:check": "php-cs-fixer fix --dry-run --diff", - "cs:fix": "php-cs-fixer fix" - } + "name": "nextcloud/openapi-extractor", + "bin": [ + "generate-spec", + "merge-specs" + ], + "config": { + "sort-packages": true + }, + "autoload": { + "psr-4": { + "OpenAPIExtractor\\": "src" + } + }, + "require": { + "php": "^8.1", + "ext-simplexml": "*", + "nikic/php-parser": "^4.16", + "adhocore/cli": "^v1.6", + "phpstan/phpdoc-parser": "^1.23" + }, + "require-dev": { + "nextcloud/coding-standard": "^1.1" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './tests/*' -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l && php -l generate-spec && php -l merge-specs", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "test:unit": "cd tests && ../generate-spec" + } }