name: PHP CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: runs-on: ubuntu-latest strategy: matrix: php-version: ['7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Checkout uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} extensions: mbstring, gd, xml tools: phpcs - name: Install dependencies run: composer install --prefer-dist - name: Install FFmpeg uses: FedericoCarboni/setup-ffmpeg@v1 id: setup-ffmpeg - name: Lint run: composer codesniffer - name: Run tests run: composer test - name: Generate Documentation if: matrix.php-version == '8.1' # phpdocumentor installed via composer doesn't work, so we're using this workaround run: | wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.1.2/phpDocumentor.phar php phpDocumentor.phar run -d ./src/ -t docs - name: Upload build artifacts if: matrix.php-version == '8.1' && github.ref == 'refs/heads/master' uses: actions/upload-artifact@v2 with: name: docs path: ./docs deploy: name: Deploy if: github.ref == 'refs/heads/master' needs: [ test ] runs-on: ubuntu-latest steps: - name: Download documentation uses: actions/download-artifact@v2 - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@3.7.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages # The branch the action should deploy to. FOLDER: docs # The folder the action should deploy. CLEAN: true # Automatically remove deleted files from the deploy branch