Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicLuidold committed Apr 3, 2024
1 parent 81fe17d commit 835284b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 41 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/common/composer-install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Composer setup
description: Setup, install and cache Composer dependencies

inputs:
symfony-version:
description: The required Symfony version that will be installed
required: false
type: string

install-doctrine-annotations:
description: If the doctrine/annotations package should be additionally installed as a dev dependency
required: true
type: boolean

composer-flags:
description: Additional flags that are passed to the `composer install` step
required: false
type: string

runs:
using: composite
steps:
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
${{ runner.os }}-composer-
- name: Install doctrine/annotations
if: ${{ inputs.install-doctrine-annotations }}
run: composer require --dev --no-update doctrine/annotations
shell: bash

- name: Remove packages not compatible Symfony 7
if: ${{ inputs.symfony-version == '7.0.*' }}
run: composer remove --dev --no-update friendsofsymfony/rest-bundle sensio/framework-extra-bundle
shell: bash

- name: Install dependencies with Composer
env:
SYMFONY_REQUIRE: ${{ inputs.symfony-version }}
run: composer update --no-interaction --no-progress ${{ inputs.composer-flags }}
shell: bash
49 changes: 15 additions & 34 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# from doctrine/instantiator:
# https://github.com/doctrine/instantiator/blob/97aa11bb71ad6259a8c5a1161b4de2d6cdcc5501/.github/workflows/continuous-integration.yml

name: "CI"
name: CI

on:
pull_request:
branches:
- "*.x"
- master
push:
branches:
- "*.x"
- master
# branches:
# - "*.x"
# - master

env:
fail-fast: true

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-22.04"
name: PHPUnit
runs-on: ubuntu-22.04

strategy:
fail-fast: false
Expand Down Expand Up @@ -54,43 +54,24 @@ jobs:
doctrine-annotations: false

steps:
- name: "Checkout"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: "Install PHP without coverage"
- name: Install PHP without coverage
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
php-version: ${{ matrix.php-version }}
tools: composer, flex
coverage: pcov

- name: "Get composer cache directory"
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: actions/cache@v3
- name: Setup dependencies
uses: ./.github/workflows/common/composer-install
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install doctrine/annotations
if: matrix.doctrine-annotations == true
run: |
composer require doctrine/annotations --no-update
- name: Remove packages not compatible symfony 7
if: matrix.symfony-require == '7.0.*'
run: |
composer remove friendsofsymfony/rest-bundle sensio/framework-extra-bundle --no-update --dev
- name: "Install dependencies with composer"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony-require }}"
run: composer update --no-interaction --no-progress ${{ matrix.composer-flags }}
symfony-version: ${{ matrix.symfony-require }}
install-doctrine-annotations: ${{ matrix.doctrine-annotations }}
composer-flags: ${{ matrix.composer-flags }}

- name: "PHPUnit Tests"
- name: PHPUnit Tests
run: vendor/bin/phpunit --configuration phpunit.xml.dist --coverage-text
7 changes: 0 additions & 7 deletions .styleci.yml

This file was deleted.

0 comments on commit 835284b

Please sign in to comment.