diff --git a/.github/workflows/full-checks.yml b/.github/workflows/full-checks.yml index d053607c..f9ff6204 100644 --- a/.github/workflows/full-checks.yml +++ b/.github/workflows/full-checks.yml @@ -8,6 +8,13 @@ on: branches: - master +permissions: + contents: read + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: full-checks: name: "PHP version ${{ matrix.php-version }}, deps. ${{ matrix.dependencies }}" @@ -27,11 +34,11 @@ jobs: - "8.4" - "8.5" operating-system: - - "ubuntu-22.04" + - "ubuntu-24.04" steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: "Install PHP" uses: "shivammathur/setup-php@v2" @@ -42,14 +49,14 @@ jobs: - name: Get composer cache directory id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Cache dependencies uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} @@ -65,4 +72,3 @@ jobs: - name: "Full CI" run: "composer ci" - diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 645603b0..3ed776d8 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -3,7 +3,7 @@ use PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer; $finder = PhpCsFixer\Finder::create() - ->exclude('/tests/scratchpad') + ->exclude('scratchpad') ->in(__DIR__ . '/src') ->in(__DIR__ . '/tests') ->in(__DIR__ . '/tools') diff --git a/Dockerfile b/Dockerfile index de632689..37660e3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,6 @@ fi EOF # Sort out git -RUN git config --global --add safe.directory /app +RUN git config --system --add safe.directory /app WORKDIR /app/ diff --git a/ci/cache/.gitignore b/ci/cache/.gitignore deleted file mode 100644 index d6b7ef32..00000000 --- a/ci/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/composer.json b/composer.json index 9c9dcb11..5a2ee486 100644 --- a/composer.json +++ b/composer.json @@ -61,19 +61,19 @@ "@phpstan" ], "composer-validate" : "@composer validate --no-check-all --strict", - "lint" : "parallel-lint src tests", + "lint" : "parallel-lint --exclude tests/scratchpad src tests", "var-dump-checker" : "var-dump-check --ladybug --no-colors src", "cs" : "php-cs-fixer fix -v --dry-run", "cs-fix" : "php-cs-fixer fix -v", "phpstan" : "phpstan -n --no-progress analyse", "test" : [ "@putenv XDEBUG_MODE=coverage", - "phpunit --coverage-clover=reports/phpunit.xml" + "phpunit --coverage-clover=reports/clover.xml" ], "test-with-coverage-check" : [ "@putenv XDEBUG_MODE=coverage", - "phpunit --coverage-clover=reports/phpunit.xml", - "coverage-check reports/phpunit.xml 100" + "phpunit --coverage-clover=reports/clover.xml", + "coverage-check reports/clover.xml 100" ] } diff --git a/docker-compose.yaml b/docker-compose.yaml index f362b678..5331a5db 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,14 @@ services: args: PHP_VERSION: "" tty: true + # Run as the host user so files written to the mounted volume (vendor, reports, test + # scratchpad, caches) are not owned by root on the host. + user: "${UID:-1000}:${GID:-1000}" + environment: + HOME: /tmp + COMPOSER_CACHE_DIR: /tmp/composer-cache + # Xdebug slows everything down; the composer test scripts enable it when needed. + XDEBUG_MODE: "${XDEBUG_MODE:-off}" volumes: - .:/app/:delegated php82: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7fbc9aa3..f2364578 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ - +