diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 02422c0..59d30ad 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -18,15 +18,15 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.3" + php-version: "8.4" extensions: json, dom, curl, libxml, mbstring coverage: none - - name: Install Pint - run: composer global require laravel/pint + - name: Install dependencies + run: composer install --no-interaction --prefer-dist - name: Run Pint - run: pint + run: vendor/bin/pint - name: Commit linted files uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fb465a3..9d757ca 100755 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ 8.1, 8.2, 8.3 ] + php: [ 8.1, 8.2, 8.3, 8.4 ] laravel: [ '10.*', '11.*', '12.*' ] dependency-version: [ prefer-lowest, prefer-stable ] @@ -29,19 +29,6 @@ jobs: name: P${{ matrix.php }} / L${{ matrix.laravel }} / ${{ matrix.dependency-version }} - services: - mysql: - image: mysql:8.0 - env: - MYSQL_DATABASE: fast_paginate - MYSQL_HOST: 127.0.0.1 - MYSQL_USER: test - MYSQL_PASSWORD: root - MYSQL_ROOT_PASSWORD: root - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index ce08912..d43edb1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ bootstrap/cache/services.php docs/*.blade.php docs/**/*.blade.php .phpunit.cache/test-results +.claude/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..7f3bd32 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,50 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Airdrop is a Laravel package that speeds up deployments by skipping asset compilation when possible. It calculates a hash of build inputs (packages, JS/CSS files, ENV vars, etc.) and reuses previously built assets if the configuration hasn't changed. + +Full docs: https://hammerstone.dev/airdrop/docs + +## Commands + +```bash +# Run tests +vendor/bin/phpunit + +# Run a single test +vendor/bin/phpunit --filter test_name + +# Code formatting +vendor/bin/pint + +# Check formatting without changes +vendor/bin/pint --test +``` + +## Architecture + +**Drivers** (`src/Drivers/`) - Handle storage/retrieval of built assets: +- `BaseDriver` - Abstract base with `download()` and `upload()` methods +- `FilesystemDriver` - Uses Laravel's filesystem (local, S3, etc.) +- `GithubActionsDriver` - Uses GitHub Actions cache + +**Triggers** (`src/Triggers/`) - Determine what affects the build hash: +- Implement `TriggerContract::triggerBuildWhenChanged($config)` +- `FileTrigger` - Hashes file contents +- `ConfigTrigger` - Hashes config values + +**Commands** (`src/Commands/`): +- `airdrop:download` - Pull cached assets if hash matches +- `airdrop:upload` - Store built assets with current hash +- `airdrop:hash` - Output current hash +- `airdrop:debug` - Debug trigger outputs +- `airdrop:install` - Publish config file + +## Code Style + +Uses Laravel Pint with the Laravel preset. Key customizations in `pint.json`: +- `concat_space`: one space around concatenation operator +- `trailing_comma_in_multiline`: false diff --git a/composer.json b/composer.json index 75fd76f..6682e73 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,10 @@ "illuminate/console": "^10.0|^11.0|^12.0" }, "require-dev": { - "orchestra/testbench": "^8.0|^9.0|^10.0", - "mockery/mockery": "^1.3.3", - "phpunit/phpunit": "^8.4|^9.5|^10.5|^11.5.3" + "laravel/pint": "^1.0", + "mockery/mockery": "^1.6", + "orchestra/testbench": "^8.21|^9.2|^10.0", + "phpunit/phpunit": "^10.5|^11.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a218fca..3880384 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ - + tests tests/BaseTest.php diff --git a/test b/test deleted file mode 100755 index a122dcf..0000000 --- a/test +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -declare -a laravel=("7.*" "8.*") -declare -a testbench=("5.*" "6.*") - -for i in "${!laravel[@]}" -do - echo "${laravel[i]}" - echo "${testbench[i]}" - - composer remove --quiet illuminate/support orchestra/testbench - composer require --no-update --no-interaction --quiet "illuminate/support:${laravel[i]}" "orchestra/testbench:${testbench[i]}" - composer update --prefer-dist --no-interaction --quiet --prefer-lowest - ./vendor/bin/phpunit -done - - -## composer remove --quiet illuminate/support orchestra/testbench \ -## && composer require --no-update --no-interaction --quiet "illuminate/support:7" "orchestra/testbench:5" \ -## && composer update --prefer-lowest --prefer-dist --no-interaction \ -## && ./vendor/bin/phpunit \ No newline at end of file