Skip to content

Add ability to check for multiple extends #1669

Add ability to check for multiple extends

Add ability to check for multiple extends #1669

Workflow file for this run

name: Test
on:
push:
pull_request:
release:
types:
- published
jobs:
build:
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
coverage-driver: [ 'pcov' ]
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2.2
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist
- name: Coding Standard Checks
run: PHP_CS_FIXER_IGNORE_ENV=1 ./bin/php-cs-fixer fix --dry-run -v
- name: Static Analysis
run: ./bin/psalm
- name: Test
run: ./bin/phpunit -d memory_limit=-1 --coverage-clover clover.xml
- name: Upload coverage to Codecov
if: ${{ matrix.php-versions == '7.1' }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
phar:
runs-on: "ubuntu-20.04"
needs: build
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v2.2
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: Install dependencies
run: composer install --prefer-dist --no-dev -o
- name: "Compile phparkitect phar"
run: php bin/box.phar compile -c ./box.json
- name: "Check phar"
run: php ./phparkitect.phar
- name: "Rename phar to avoid conflicts"
run: mv ./phparkitect.phar phparkitect-${{ github.sha }}.phar
- name: "Upload phar file artifact"
uses: actions/upload-artifact@v3
with:
name: phar-artifact
path: ./phparkitect-${{ github.sha }}.phar
retention-days: 1
smoke-test-phar:
needs: phar
runs-on: "ubuntu-20.04"
strategy:
matrix:
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
coverage-driver: [ 'pcov' ]
steps:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: "Download phar ./phparkitect-${{ github.sha }}.phar"
uses: actions/download-artifact@v3
with:
# will download phar in project root
name: phar-artifact
- name: "Smoke test phar"
run: php ./phparkitect-${{ github.sha }}.phar
publish_phar:
needs: [build, smoke-test-phar]
runs-on: "ubuntu-20.04"
if: github.event_name == 'release'
steps:
- name: "Download phar ./phparkitect-${{ github.sha }}.phar"
uses: actions/download-artifact@v3
with:
# will download phar in project root
name: phar-artifact
- name: Upload Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./phparkitect-${{ github.sha }}.phar
asset_name: phparkitect.phar
tag: ${{ github.ref }}
publish_docker_images:
needs: [build, smoke-test-phar]
runs-on: "ubuntu-20.04"
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: phparkitect/phparkitect
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
type=ref,event=tag
flavor: |
latest=false
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}