Skip to content

Commit ea818e6

Browse files
Merge pull request #31 from move-elevator/feature/reusable-github-actions
chore(ci): use reusable github actions workflows
2 parents 2c0761c + ca43e66 commit ea818e6

3 files changed

Lines changed: 18 additions & 74 deletions

File tree

.github/workflows/cgl.yml

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,6 @@ on:
66

77
jobs:
88
cgl:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v7
12-
with:
13-
fetch-depth: 0
14-
15-
# Prepare environment
16-
- name: Setup PHP
17-
uses: shivammathur/setup-php@v2
18-
with:
19-
# @todo Use PHP 8.4 once PHP-CS-Fixer supports PHP 8.4
20-
php-version: 8.3
21-
tools: composer:v2, composer-require-checker, composer-unused, cs2pr
22-
env:
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
25-
# Validation
26-
- name: Validate composer.json
27-
run: composer validate
28-
29-
# Install dependencies
30-
- name: Add required packages
31-
run: composer require composer/composer:"^2.2"
32-
33-
# Check Composer dependencies
34-
- name: Check dependencies
35-
run: composer-require-checker check
36-
- name: Reset composer.json
37-
run: git checkout composer.json
38-
- name: Re-install Composer dependencies
39-
uses: ramsey/composer-install@4.0.0
40-
- name: Check for unused dependencies
41-
run: composer-unused --excludePackage=deployer/deployer --excludePackage=sourcebroker/deployer-extended
42-
43-
# Linting
44-
- name: Update composer.lock
45-
run: composer update --lock
46-
- name: Lint composer.json
47-
run: composer lint:composer
48-
- name: Lint Editorconfig
49-
run: composer lint:editorconfig
50-
- name: Lint PHP
51-
run: composer lint:php -- --format checkstyle | cs2pr
52-
53-
# SCA
54-
- name: SCA PHP
55-
run: composer sca:php -- --error-format github
56-
57-
# Migration
58-
- name: Run Rector migration
59-
run: composer migration:rector -- --dry-run
9+
uses: konradmichalik/reusable-github-actions/.github/workflows/cgl.yml@main
10+
with:
11+
php-version: '8.3'

.github/workflows/release.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,5 @@ on:
66
- '*'
77

88
jobs:
9-
# Job: Create release
109
release:
11-
if: startsWith(github.ref, 'refs/tags/')
12-
runs-on: ubuntu-latest
13-
outputs:
14-
release-notes-url: ${{ steps.create-release.outputs.url }}
15-
steps:
16-
- uses: actions/checkout@v7
17-
with:
18-
fetch-depth: 0
19-
20-
# Check if tag is valid
21-
- name: Check tag
22-
run: |
23-
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
24-
exit 1
25-
fi
26-
27-
# Create release
28-
- name: Create release
29-
id: create-release
30-
uses: softprops/action-gh-release@v3
31-
with:
32-
generate_release_notes: true
10+
uses: konradmichalik/reusable-github-actions/.github/workflows/release.yml@main

composer-unused.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use ComposerUnused\ComposerUnused\Configuration\Configuration;
6+
use ComposerUnused\ComposerUnused\Configuration\NamedFilter;
7+
8+
return static function (Configuration $config): Configuration {
9+
// These packages are consumed via Deployer's recipe loading mechanism,
10+
// not through PHP `use`/autoload, so composer-unused cannot detect them.
11+
return $config
12+
->addNamedFilter(NamedFilter::fromString('deployer/deployer'))
13+
->addNamedFilter(NamedFilter::fromString('sourcebroker/deployer-extended'));
14+
};

0 commit comments

Comments
 (0)