From bac75cc05659f6663b84571c166226fd726cce8f Mon Sep 17 00:00:00 2001 From: Tang Rufus Date: Sat, 18 Jan 2025 09:40:56 +0000 Subject: [PATCH] Update GitHub Actions: Use `typisttech/.github/tree/main/.github/workflows` v2.5.0 (#17) * GitHib Actions: Use `typisttech/.github/.github/workflows/php-matrix.yml@v2` * GitHib Actions: Use `typisttech/.github/.github/workflows/pint.yml@v2` * GitHib Actions: Use `typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v2` * GitHib Actions: Add `Composer Audit` workflow * GitHib Actions: Add `Composer Normalize` workflow * GitHib Actions: Add `Release Drafter` workflow --- .github/release-drafter.yml | 1 + .github/workflows/auto-commit.yml | 23 ---------------- .github/workflows/composer-audit.yml | 30 +++++++++++++++++++++ .github/workflows/composer-normalize.yml | 23 ++++++++++++++++ .github/workflows/dependabot-auto-merge.yml | 9 ++++--- .github/workflows/pint.yml | 27 +++++++++++++++++++ .github/workflows/release-drafter.yml | 20 ++++++++++++++ .github/workflows/test.yml | 29 ++++++++++---------- 8 files changed, 121 insertions(+), 41 deletions(-) create mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/auto-commit.yml create mode 100644 .github/workflows/composer-audit.yml create mode 100644 .github/workflows/composer-normalize.yml create mode 100644 .github/workflows/pint.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..0d0b1c9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1 @@ +_extends: .github diff --git a/.github/workflows/auto-commit.yml b/.github/workflows/auto-commit.yml deleted file mode 100644 index 215aae0..0000000 --- a/.github/workflows/auto-commit.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Auto Commit - -on: - workflow_dispatch: - push: - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -permissions: {} - -jobs: - pint: - uses: typisttech/.github/.github/workflows/auto-pint.yml@v1 - permissions: - contents: write - pull-requests: write - secrets: - pr-write-pat-token: ${{ secrets.PR_WRITE_PAT_TOKEN }} - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/composer-audit.yml b/.github/workflows/composer-audit.yml new file mode 100644 index 0000000..c8cc2fa --- /dev/null +++ b/.github/workflows/composer-audit.yml @@ -0,0 +1,30 @@ +name: Composer Audit + +on: + workflow_dispatch: + schedule: + - cron: '23 3 * * 1' # Weekly on Monday + pull_request: + branches: + - main + paths: + - .github/workflows/composer-audit.yml + - composer.* + push: + branches: + - main + paths: + - .github/workflows/composer-audit.yml + - composer.* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: {} + +jobs: + composer-audit: + uses: typisttech/.github/.github/workflows/composer-audit.yml@v2 + permissions: + contents: read diff --git a/.github/workflows/composer-normalize.yml b/.github/workflows/composer-normalize.yml new file mode 100644 index 0000000..cd04efa --- /dev/null +++ b/.github/workflows/composer-normalize.yml @@ -0,0 +1,23 @@ +name: Composer Normalize + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - .github/workflows/composer-normalize.yml + - composer.* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: {} + +jobs: + composer-normalize: + uses: typisttech/.github/.github/workflows/composer-normalize.yml@v2 + permissions: + contents: read + secrets: inherit diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 13382b7..d337c93 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -1,8 +1,9 @@ -# Taken from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions -# and https://github.com/dependabot/fetch-metadata/blob/06ea45a2e4582d87b11f03c7ce596ae3261f39f6/README.md?plain=1#L133-L160 name: Dependabot Auto-merge -on: pull_request +on: + pull_request: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} @@ -15,7 +16,7 @@ jobs: permissions: contents: write pull-requests: write - uses: typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v1 + uses: typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v2 with: minor: true patch: true diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml new file mode 100644 index 0000000..bfba64a --- /dev/null +++ b/.github/workflows/pint.yml @@ -0,0 +1,27 @@ +name: Pint + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - .github/workflows/pint.yml + - '**.php' + - composer.* + - pint.json + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: {} + +jobs: + pint: + uses: typisttech/.github/.github/workflows/pint.yml@v2 + permissions: + contents: read + with: + php-version: '8.4' + secrets: inherit diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..0a87ac5 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,20 @@ +name: Release Drafter + +on: + workflow_dispatch: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: {} + +jobs: + release-drafter: + uses: typisttech/.github/.github/workflows/release-drafter.yml@v2 + permissions: + contents: write + pull-requests: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66e6112..8c1d51a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,20 +16,26 @@ concurrency: permissions: {} jobs: + php-matrix: + uses: typisttech/.github/.github/workflows/php-matrix.yml@v2 + permissions: + contents: read + pest: runs-on: ubuntu-latest + needs: php-matrix strategy: matrix: - php: ['8.3', '8.4'] - prefer: [--prefer-lowest, --prefer-stable] + php: ${{ fromJSON(needs.php-matrix.outputs.versions) }} + dependency-versions: [lowest, highest] coverage: [none] exclude: - - php: '8.4' - prefer: --prefer-stable + - php: ${{ needs.php-matrix.outputs.highest }} + dependency-versions: highest coverage: none include: - - php: '8.4' - prefer: --prefer-stable + - php: ${{ needs.php-matrix.outputs.highest }} + dependency-versions: highest coverage: xdebug steps: - uses: actions/checkout@v4 @@ -41,15 +47,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 + - uses: ramsey/composer-install@v3 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.prefer }}-${{ hashFiles('**/composer.json') }}-${{ github.run_id }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.prefer }}- - - - run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ matrix.prefer }} + dependency-versions: ${{ matrix.dependency-versions }} + composer-options: --no-audit --optimize-autoloader - run: composer pest:unit -- --ci --coverage-clover coverage.xml if: ${{ matrix.coverage == 'xdebug' }}