diff --git a/.github/composer-config.json b/.github/composer-config.json new file mode 100644 index 0000000..3cf8468 --- /dev/null +++ b/.github/composer-config.json @@ -0,0 +1,13 @@ +{ + "config": { + "cache-vcs-dir": "/dev/null", + "platform-check": false, + "preferred-install": { + "*": "dist" + }, + "allow-plugins": { + "ergebnis/composer-normalize": true, + "symfony/flex": true + } + } +} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cb73b40..a5b14d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,91 +9,6 @@ on: - main jobs: - cs-fixer: - name: 'PHP CS Fixer' - - runs-on: 'ubuntu-latest' - - strategy: - matrix: - php-version: - - '8.2' - - steps: - - - name: 'Check out' - uses: 'actions/checkout@v4' - - - - name: 'Set up PHP' - uses: 'shivammathur/setup-php@v2' - with: - php-version: '${{ matrix.php-version }}' - coverage: 'none' - - - - name: 'Get Composer cache directory' - id: 'composer-cache' - run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT' - - - - name: 'Cache dependencies' - uses: 'actions/cache@v3' - with: - path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - - - - name: 'Install dependencies' - run: 'composer install --no-progress' - - - - name: 'Check the code style' - run: 'make cs' - - phpstan: - name: 'PhpStan' - - runs-on: 'ubuntu-latest' - - strategy: - matrix: - php-version: - - '8.2' - - steps: - - - name: 'Check out' - uses: 'actions/checkout@v4' - - - - name: 'Set up PHP' - uses: 'shivammathur/setup-php@v2' - with: - php-version: '${{ matrix.php-version }}' - coverage: 'none' - - - - name: 'Get Composer cache directory' - id: 'composer-cache' - run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT' - - - - name: 'Cache dependencies' - uses: 'actions/cache@v3' - with: - path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - - - - name: 'Install dependencies' - run: 'composer update --no-progress --prefer-stable' - - - - name: 'Run PhpStan' - run: 'vendor/bin/phpstan analyze --no-progress' tests: name: 'PHPUnit' @@ -118,10 +33,15 @@ jobs: composer-options: '--prefer-stable' symfony-version: '^8.0' + - + php-version: '8.5' + composer-options: '--prefer-stable' + symfony-version: '^8.0' + steps: - name: 'Check out' - uses: 'actions/checkout@v4' + uses: 'actions/checkout@v6' - name: 'Set up PHP' @@ -140,7 +60,7 @@ jobs: uses: 'actions/cache@v3' with: path: '${{ steps.composer-cache.outputs.cache_dir }}' - key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.json') }}" restore-keys: 'php-${{ matrix.php-version }}-composer-locked-' - diff --git a/.github/workflows/inspector-bot.yaml b/.github/workflows/inspector-bot.yaml new file mode 100644 index 0000000..4b9d36e --- /dev/null +++ b/.github/workflows/inspector-bot.yaml @@ -0,0 +1,16 @@ +name: CS + +on: + pull_request: + +permissions: + contents: read + +jobs: + call-inspector-bot: + name: InspectorBot + uses: rollerscapes/inspector-bot/.github/workflows/inspector-bot.yml@main + with: + package: Rollerworks-password-common-list + check_license: true + diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml new file mode 100644 index 0000000..d61d1b4 --- /dev/null +++ b/.github/workflows/phpstan.yaml @@ -0,0 +1,64 @@ +name: PHPStan + +on: + pull_request: + branches: + - main + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-24.04 + + env: + php-version: '8.2' + steps: + - + name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php-version }} + ini-values: "memory_limit=-1" + coverage: none + + - + name: Checkout target branch + uses: actions/checkout@v6 + with: + ref: ${{ github.base_ref }} + + - + name: Checkout PR + uses: actions/checkout@v6 + + - + name: Install dependencies + run: | + COMPOSER_HOME="$(composer config home)" + ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" + composer install --no-progress --ansi --no-plugins + + - + name: Generate PHPStan baseline + run: | + git checkout composer.json + git checkout -m ${{ github.base_ref }} + vendor/bin/phpstan analyze --generate-baseline --allow-empty-baseline --no-progress + git checkout -m FETCH_HEAD + + - + name: PHPStan + run: | + vendor/bin/phpstan analyze --no-progress --error-format=github + diff --git a/composer.json b/composer.json index 8e51725..3157ebb 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,7 @@ "symfony/validator": "^6.4 || ^7.4 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.10.39", - "phpstan/phpstan-phpunit": "1.3.15", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^9.5", "rollerscapes/standards": "^1.0", "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", diff --git a/phpstan.neon b/phpstan.neon index b377b7f..e748508 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,6 @@ parameters: - ./src - ./tests excludePaths: - - ./src/Resources + - ./Resources #ignoreErrors: