diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..b4b31c2 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - "master" + +env: + PHP_EXTENSIONS: "zip" + PHP_VERSION: "8.3" + +jobs: + release: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + if: github.ref == 'refs/heads/master' + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ env.PHP_VERSION }}" + extensions: "${{ env.PHP_EXTENSIONS }}" + tools: humbug/box + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - uses: google-github-actions/release-please-action@v4 + id: create_release + with: + target-branch: master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dd9f724 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Tests + +on: + push: + branches: ["master"] + pull_request: + branches: ["*"] + +permissions: + contents: read + +jobs: + tests: + + strategy: + matrix: + php_version: ["7.4", "8.0", "8.1", "8.2", "8.3"] + + runs-on: ubuntu-latest + container: + image: "lephare/php:${{ matrix.php_version }}" + env: + XDEBUG_MODE: coverage + + steps: + - uses: actions/checkout@v4 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Install dependencies (PHP ${{ matrix.php_version }}) + run: | + composer config --global cache-dir .composer + composer install --prefer-dist --no-interaction --no-progress + + - name: Coding Style (PHP ${{ matrix.php_version }}) + run: | + composer run-script lint:ci + composer run-script analyse + + - name: Unit Tests (PHP ${{ matrix.php_version }}) + run: composer run-script test:ci diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..ba67087 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.1.0" +} diff --git a/composer.json b/composer.json index cfa16a3..d9b4363 100644 --- a/composer.json +++ b/composer.json @@ -47,11 +47,20 @@ "php-mock/php-mock-prophecy": "^0.1.1", "phpoffice/phpspreadsheet": "^1.19", "phpspec/prophecy": "^1.10", + "phpspec/prophecy-phpunit": "^2.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.4", "phpunit/phpunit": "^9.6", "symfony/phpunit-bridge": "^5.4|^6.0|^7.0" }, + "scripts": { + "analyse": "./vendor/bin/phpstan analyse --no-progress", + "lint": "./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run", + "lint:ci": "@lint:fix --using-cache=no --dry-run", + "lint:fix": "./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php", + "test:ci": "@test --colors=never --coverage-text", + "test": "./vendor/bin/phpunit" + }, "suggest": { "phpoffice/phpspreadsheet": "Import XLS files" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4bc1b0b..fd7b1bd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,19 @@ - - - - - ./Tests/ - - - - - - ./ - - ./ - ./Resources - ./Tests - ./vendor - - - + + + + ./ + + + ./ + ./Resources + ./Tests + ./vendor + + + + + ./Tests/ + + diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..6c048d2 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "php", + "include-component-in-tag": false, + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "draft": true, + "package-name": "release-please-action", + "release-type": "php" + } + } +}