Skip to content

Commit

Permalink
Add the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 28, 2022
1 parent 57487a7 commit b20cbd6
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/code-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Create Code Reports

on:
push:
branches: [ master ]

workflow_dispatch:

jobs:
create-coverage-report:
runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.0'
coverage: xdebug
extensions: fileinfo
- name: Install Hyde
run: git clone https://github.com/hydephp/hyde.git $(pwd)
- name: Install Dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Set Framework version to dev-master
run: composer require hyde/framework:dev-master
- name: Set environment to testing
run: echo "ENV=testing" > .env
- name: Run tests with HTML coverage reporting
run: vendor/bin/pest --coverage-html covrep
env:
ENV: testing

- name: Upload the report as an artifact
uses: actions/upload-artifact@v1
with:
name: 'coverage-report'
path: 'covrep'


build-php-docs:
runs-on: ubuntu-latest
steps:
- name: Download the Framework
run: git clone https://github.com/hydephp/framework.git

- name: Download phpDocumentor
run: |
wget https://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
- name: Run phpDocumentor
run: php phpDocumentor.phar -d framework/src -t api-docs

- name: Upload the documentation as an artifact
uses: actions/upload-artifact@v1
with:
name: 'api-docs'
path: 'api-docs'


upload-html-files:
needs: [create-coverage-report, build-php-docs]
runs-on: ubuntu-latest

steps:
- name: Download coverage report artifact
uses: actions/download-artifact@v3
with:
name: coverage-report
path: coverage-report

- name: Download api docs artifact
uses: actions/download-artifact@v3
with:
name: api-docs
path: api-docs

- name: Create .nojekyll file
run: touch .nojekyll

- name: Write run metadata to file
run: |
currentDate=`date`
echo "Report automatically uploaded by GitHub at $currentDate" > coverage-report/report-information.txt
echo "Report automatically uploaded by GitHub at $currentDate" > api-docs/report-information.txt
- name: Upload files to GitHub Pages
uses: cpina/[email protected]

env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: "."
destination-github-username: "hydephp"
destination-repository-name: "developer-tools"
target-branch: gh-pages

0 comments on commit b20cbd6

Please sign in to comment.