Skip to content

Commit

Permalink
Remove ramsey/composer-install (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed Jul 31, 2023
2 parents a83e35e + 153b4ac commit de6c05b
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 1,270 deletions.
86 changes: 48 additions & 38 deletions .github/workflows/automation.yml
Expand Up @@ -36,31 +36,73 @@ jobs:
name: ${{ matrix.name }} on PHP ${{ matrix.php }} with ${{ matrix.dependency }} dependencies
needs: [matrix]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
continue-on-error: ${{ matrix.dependency == 'lowest' || matrix.experimental }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
coverage: pcov
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
php-version: ${{ matrix.php }}
tools: psalm, phpstan, cs2pr, phpcs, phpunit
tools: composer:v2

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install ${{ matrix.dependencies }} dependencies
uses: ramsey/composer-install@v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
dependency-versions: "${{ matrix.dependencies }}"
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency }}-

- name: Validate composer.json file
working-directory: ${{ github.workspace }}
run: |
if [ ! -f "composer.json" ]; then
echo "composer.json does not exist"
exit 1
fi
composer validate --no-check-publish --no-check-lock --no-interaction --ansi --strict
- name: Install ${{ matrix.dependency }} dependencies
working-directory: ${{ github.workspace }}
run: |
composerDependency="${{ matrix.dependency }}"
composerCommand="update"
composerOptions=("--no-interaction" "--no-progress" "--ansi")
case ${composerDependency} in
highest) composerCommand="update" ;;
lowest) composerOptions+=("--prefer-lowest" "--prefer-stable") ;;
*) composerCommand="install" ;;
esac
# Use the `update` if there is a composer.lock file
if [ ! -f "composer.lock" ]; then
composerCommand="update"
fi
fullCommand="composer ${composerCommand} ${composerOptions[*]}"
echo "Running: ${fullCommand}"
${fullCommand}
- name: Run ${{ matrix.name }} command
run: ${{ matrix.command }}
Expand All @@ -69,41 +111,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

# - name: ${{ matrix.name }} on PHP ${{ matrix.php }}
# uses: ghostwriter/laminas-continuous-integration-action@temp
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
# with:
# job: '{"php":"${{ matrix.php }}","dependencies":"${{ matrix.dependency }}","extensions":${{ toJSON(matrix.extensions) }},"ini":[],"command":"${{ matrix.command }}"}'
# - name: QA Check ${{ matrix.name }} on PHP ${{ matrix.php }}
# uses: ghostwriter/compliance@qa/test-workflow
# with:
# command: check
# job: ${{ matrix.command }}


codecov:
name: Upload coverage to Codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up php 8.2
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Run tests and collect coverage
run: composer phpunit

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.php == '8.2' && matrix.dependency == 'locked' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{ github.workspace }}/.cache/phpunit/
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Expand Up @@ -37,19 +37,19 @@
"composer-plugin-api": "^2.2.2",
"composer-runtime-api": "^2.2.2",
"composer/semver": "^3.3.2",
"ghostwriter/collection": "^1.3.1",
"ghostwriter/collection": "^1.3.2",
"ghostwriter/config": "^0.3",
"ghostwriter/container": "^1.5",
"ghostwriter/container": "^1.6",
"ghostwriter/environment": "^1.1",
"ghostwriter/event-dispatcher": "^1.4.1",
"ghostwriter/event-dispatcher": "^1.4.2",
"ghostwriter/json": "^1.1",
"ghostwriter/option": "^1.5",
"symfony/console": "^6.3.0",
"symfony/finder": "^6.3.0",
"symfony/process": "^6.3.0"
"ghostwriter/option": "^1.5.1",
"symfony/console": "^6.3.2",
"symfony/finder": "^6.3.3",
"symfony/process": "^6.3.2"
},
"require-dev": {
"composer/composer": ">=2.5.5",
"composer/composer": ">=2.5.8",
"ghostwriter/coding-standard": "dev-main"
},
"minimum-stability": "stable",
Expand Down Expand Up @@ -115,7 +115,7 @@
"phpbench": "phpbench run",
"phpunit": "phpunit --colors=always --testdox --stop-on-failure",
"psalm": "@psalm:shepherd",
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"psalm:baseline": "psalm --no-diff --no-cache --set-baseline=psalm-baseline.xml",
"psalm:dry-run": "psalm --alter --issues=all --dry-run",
"psalm:missing": "psalm --alter --issues=MissingReturnType",
"psalm:security": "psalm --taint-analysis",
Expand Down

0 comments on commit de6c05b

Please sign in to comment.