-
Notifications
You must be signed in to change notification settings - Fork 1
feat(ci): migrate php checks , docs, and php unit tests from Drone to GitHub Actions
#294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| COMPOSER_HOME: ${{ github.workspace }}/.cache/composer | ||
| DEFAULT_PHP_VERSION: '8.1' | ||
|
|
||
| jobs: | ||
| php-checks: | ||
| name: PHP checks | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 | ||
| with: | ||
| php-version: ${{ env.DEFAULT_PHP_VERSION }} | ||
| tools: composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5 | ||
|
|
||
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | ||
| with: | ||
| path: .cache/composer | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
|
|
||
| - run: composer install | ||
|
|
||
| - name: codeStyle | ||
| run: make test-php-style | ||
|
|
||
| - name: phpStan | ||
| run: make test-php-phpstan | ||
|
|
||
| - name: phpPhan | ||
| run: make test-php-phan | ||
|
|
||
| php-unit-tests-without-coverage: | ||
| name: php unit tests ${{ matrix.php-version}} without coverage | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-version : ['8.1', '8.2', '8.3'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
| tools: composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5 | ||
| coverage: xdebug | ||
|
|
||
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | ||
| with: | ||
| path: .cache/composer | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
|
|
||
| - run: composer install | ||
|
|
||
| - name: unitTests-${{ matrix.php-version }} | ||
| run: make test-php-unit | ||
|
|
||
| php-unit-tests-with-coverage: | ||
| name: php unit tests ${{ matrix.php-version}} with coverage | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-version : ['8.1', '8.2', '8.3'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
| tools: composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5 | ||
| coverage: xdebug | ||
|
|
||
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | ||
| with: | ||
| path: .cache/composer | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
|
|
||
| - run: composer install | ||
|
|
||
| - name: unitTests-${{ matrix.php-version }} | ||
| run: make test-php-unit | ||
|
|
||
| - name: coverage rename | ||
| run: mv tests/output/clover.xml tests/output/clover-unitTests-${{ matrix.php-version }}.xml | ||
|
|
||
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: coverage-unitTests-${{ matrix.php-version }} | ||
| path: tests/output/clover-unitTests-${{ matrix.php-version }}.xml | ||
|
|
||
| docs: | ||
| name: docs | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 | ||
| with: | ||
| php-version: ${{ env.DEFAULT_PHP_VERSION }} | ||
| tools: composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5 | ||
| coverage: none | ||
|
|
||
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | ||
| with: | ||
| path: .cache/composer | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
|
|
||
| - run: composer install | ||
|
|
||
| - name: docs generate | ||
| uses: docker://phpdoc/phpdoc:3 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using docker image. needs to clarify if this is ok.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc: @DeepDiver1975
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please see if any of these fits the needs https://github.com/marketplace?query=phpdoc&type=actions |
||
|
|
||
| - name: publish api docs | ||
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from unverified creator
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc: @DeepDiver1975
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if: github.event_name != 'pull_request' | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: docs | ||
| publish_branch: docs | ||
| force_orphan: true | ||
|
|
||
| - name: compile docs hugo | ||
| run: | | ||
| mkdir docs-hugo | ||
| cat docs-hugo-header.md README.md > docs-hugo/_index.md | ||
|
|
||
| - name: publish docs hugo | ||
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | ||
| if: github.event_name != 'pull_request' | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: docs-hugo | ||
| publish_branch: docs-hugo | ||
| force_orphan: true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most commonly used php setup but not verified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @DeepDiver1975
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/owncloud/reusable-workflows/blob/main/.github/workflows/php-unit.yml
and any other workflows in that folder. Those are being used with ownCloud core and apps.
Use anything from there as examples.
I don't think that we will be using https://github.com/owncloud-ci/php because actually we are easily using shivammathur/setup-php to get and configure PHP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github.com/owncloud/impersonate/pull/256 has GitHub workflow actions that I am doing for ownCloud core and apps. So look there also to get any ideas.