diff --git a/.gitattributes b/.gitattributes index 675a181..c0d34c8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,6 +9,15 @@ /LICENSE.md export-ignore /logo.png export-ignore /phpunit.xml export-ignore +/phpunit71.xml export-ignore +/phpunit72.xml export-ignore +/phpunit73.xml export-ignore +/phpunit74.xml export-ignore +/phpunit80.xml export-ignore +/phpunit81.xml export-ignore +/phpunit82.xml export-ignore +/phpunit83.xml export-ignore +/phpunit84.xml export-ignore /README.md export-ignore /SECURITY.md export-ignore /test.sh export-ignore \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef8f2bb..840021c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,29 +16,15 @@ jobs: strategy: matrix: - php-version: [php71, php72, php73, php74, php80, php81, php82, php83, php84] + php-version: [84, 83, 82, 81, 80, 74, 73, 72, 71] steps: - uses: actions/checkout@v4 - - name: Validate composer files - run: composer validate --strict - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ./vendor-${{ matrix.php-version }} - key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}- - - - name: Install dependencies (if needed) + - name: Install dependencies for PHP${{ matrix.php-version }} run: | - if [ ! -d ./vendor-${{ matrix.php-version }} ] || [ -z "$(ls -A ./vendor-${{ matrix.php-version }})" ]; then - echo "Dependencies not found or vendor directory is empty. Installing dependencies..." - docker compose run --rm -v ${{ github.workspace }}/vendor-${{ matrix.php-version }}:/app/vendor ${{ matrix.php-version }}composer composer install --prefer-dist - else - echo "Dependencies already installed for ${{ matrix.php-version }}. Skipping composer install." - fi + docker compose run --rm php${{ matrix.php-version }}composer composer update --no-cache - - name: Run tests - run: docker compose run --rm -v ${{ github.workspace }}/vendor-${{ matrix.php-version }}:/app/vendor ${{ matrix.php-version }} vendor/bin/phpunit \ No newline at end of file + - name: Run PHPUnit tests for PHP${{ matrix.php-version }} + run: | + docker compose run --rm php${{ matrix.php-version }} vendor/bin/phpunit --configuration phpunit${{ matrix.php-version }}.xml \ No newline at end of file diff --git a/composer.json b/composer.json index fd8d901..47ff4aa 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,33 @@ ], "docker": [ "docker compose run --rm " + ], + "test71": [ + "docker compose run --rm php71 ./vendor/bin/phpunit --configuration phpunit71.xml" + ], + "test72": [ + "docker compose run --rm php72 ./vendor/bin/phpunit --configuration phpunit72.xml" + ], + "test73": [ + "docker compose run --rm php73 ./vendor/bin/phpunit --configuration phpunit73.xml" + ], + "test74": [ + "docker compose run --rm php74 ./vendor/bin/phpunit --configuration phpunit74.xml" + ], + "test80": [ + "docker compose run --rm php80 ./vendor/bin/phpunit --configuration phpunit80.xml" + ], + "test81": [ + "docker compose run --rm php81 ./vendor/bin/phpunit --configuration phpunit81.xml" + ], + "test82": [ + "docker compose run --rm php82 ./vendor/bin/phpunit --configuration phpunit82.xml" + ], + "test83": [ + "docker compose run --rm php83 ./vendor/bin/phpunit --configuration phpunit83.xml" + ], + "test84": [ + "docker compose run --rm php84 ./vendor/bin/phpunit --configuration phpunit84.xml" ] }, "scripts-descriptions": { diff --git a/phpunit71.xml b/phpunit71.xml new file mode 100644 index 0000000..247c7f4 --- /dev/null +++ b/phpunit71.xml @@ -0,0 +1,21 @@ + + + + + tests + + + + + + src + + + diff --git a/phpunit72.xml b/phpunit72.xml new file mode 100644 index 0000000..247c7f4 --- /dev/null +++ b/phpunit72.xml @@ -0,0 +1,21 @@ + + + + + tests + + + + + + src + + + diff --git a/phpunit73.xml b/phpunit73.xml new file mode 100644 index 0000000..aae6309 --- /dev/null +++ b/phpunit73.xml @@ -0,0 +1,13 @@ + + + + + src + + + + + tests + + + diff --git a/phpunit74.xml b/phpunit74.xml new file mode 100644 index 0000000..aae6309 --- /dev/null +++ b/phpunit74.xml @@ -0,0 +1,13 @@ + + + + + src + + + + + tests + + + diff --git a/phpunit80.xml b/phpunit80.xml new file mode 100644 index 0000000..aae6309 --- /dev/null +++ b/phpunit80.xml @@ -0,0 +1,13 @@ + + + + + src + + + + + tests + + + diff --git a/phpunit81.xml b/phpunit81.xml new file mode 100644 index 0000000..5db2e31 --- /dev/null +++ b/phpunit81.xml @@ -0,0 +1,13 @@ + + + + + tests + + + + + src + + + diff --git a/phpunit82.xml b/phpunit82.xml new file mode 100644 index 0000000..5db2e31 --- /dev/null +++ b/phpunit82.xml @@ -0,0 +1,13 @@ + + + + + tests + + + + + src + + + diff --git a/phpunit83.xml b/phpunit83.xml new file mode 100644 index 0000000..5db2e31 --- /dev/null +++ b/phpunit83.xml @@ -0,0 +1,13 @@ + + + + + tests + + + + + src + + + diff --git a/phpunit84.xml b/phpunit84.xml new file mode 100644 index 0000000..5db2e31 --- /dev/null +++ b/phpunit84.xml @@ -0,0 +1,13 @@ + + + + + tests + + + + + src + + + diff --git a/test.sh b/test.sh index a7727f6..378e296 100755 --- a/test.sh +++ b/test.sh @@ -1,12 +1,12 @@ #!/bin/bash set -e -php_versions=("php84" "php83" "php82" "php81" "php80" "php74" "php73" "php72" "php71") +php_versions=("84" "83" "82" "81" "80" "74" "73" "72" "71") for version in "${php_versions[@]}"; do - docker compose run --rm "${version}composer" composer update --no-cache + docker compose run --rm php"${version}composer" composer update --no-cache - if ! docker compose run --rm "$version" vendor/bin/phpunit; then + if ! docker compose run --rm php"${version}" vendor/bin/phpunit --configuration phpunit"${version}".xml; then exit 1 fi done \ No newline at end of file