From d0aba4c0cdfc439caa481d868df052741d6e7de0 Mon Sep 17 00:00:00 2001 From: "Ben Scholzen (DASPRiD)" Date: Tue, 19 Mar 2024 01:36:13 +0100 Subject: [PATCH] ci: integrate release-please --- .github/workflows/ci.yml | 15 +++++--- .github/workflows/pull-request.yml | 61 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92377cb..56f47eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,9 @@ -name: PHP CI +name: CI on: push: branches: - - master - pull_request: - branches: - - master + - main jobs: lint: @@ -61,3 +58,11 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./clover.xml + + release: + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + with: + release-type: php diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..0f6acf2 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,61 @@ +name: Pull Request + +on: + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: phpcs + + - name: Lint + run: phpcs + + test: + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ['8.1', '8.2', '8.3'] + runs-on: ${{ matrix.operating-system }} + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: iconv, imagick + coverage: xdebug + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Test with phpunit + run: vendor/bin/phpunit --coverage-clover clover.xml + + - name: Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./clover.xml +