From f4c5be7801d1354b15ee4605e3b973373354930a Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 9 Sep 2026 11:54:05 +0200 Subject: [PATCH] [CI] Adapted CI to latest standards --- .github/labels.yml | 48 ++++++++++++++++++++++++ .github/workflows/backend-ci.yaml | 60 +++++++++++++++++------------- .github/workflows/frontend-ci.yaml | 26 +++++++++---- .github/workflows/pr-check.yaml | 18 +++++---- .github/workflows/rector.yaml | 4 +- .github/workflows/release.yaml | 53 +++++--------------------- .github/workflows/reviewers.yaml | 20 +++++----- .gitignore | 3 ++ composer.json | 8 +++- deptrac.baseline.yaml | 10 +++++ deptrac.yaml | 3 ++ 11 files changed, 156 insertions(+), 97 deletions(-) create mode 100644 .github/labels.yml create mode 100644 deptrac.baseline.yaml diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..6c714c5 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,48 @@ +- color: d73a4a + description: Something isn't working + name: Bug +- color: 0075ca + description: The changes require some documentation + name: Doc needed +- color: cfd3d7 + description: This issue or pull request already exists + name: Duplicate +- color: "000000" + description: "" + name: DX +- color: 6f00ff + description: PR should be merged in a fast-forward way + name: Fast-forward merge +- color: b6e1fc + description: New feature request + name: Feature +- color: 00bfff + description: "" + name: Improvement +- color: e6e6e6 + description: This doesn't seem right + name: Invalid +- color: 00ff7f + description: "" + name: QA approved +- color: 9370db + description: Further information is requested + name: Question +- color: adff2f + description: "" + name: Ready for MERGE +- color: ff66cc + description: "" + name: Ready for QA +- color: fff505 + description: "" + name: Ready for review +- color: ffd700 + description: "" + name: Rebase required +- color: ffffff + description: This will not be worked on + name: wontfix +- color: fcc67b + description: "" + name: Work in progress diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 239ba1c..05ae8fe 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -1,8 +1,9 @@ -name: CI +name: Backend build on: push: branches: + - main - '[0-9]+.[0-9]+' pull_request: ~ @@ -28,9 +29,9 @@ jobs: run: composer run-script check-cs -- --format=checkstyle | cs2pr tests: - name: Unit tests & SQLite integration tests + name: Tests runs-on: "ubuntu-26.04" - timeout-minutes: 15 + timeout-minutes: 10 strategy: fail-fast: false @@ -38,7 +39,6 @@ jobs: php: - '8.3' - '8.4' - steps: - uses: actions/checkout@v7 @@ -55,18 +55,15 @@ jobs: - name: Run PHPStan analysis run: composer run-script phpstan - - name: Run unit test suite - run: composer run-script test - - - name: Run integration test suite - run: composer run-script test-integration + - name: Run test suite + run: composer run-script --timeout=600 test integration-tests-postgres: name: PostgreSQL integration tests needs: tests services: postgres: - image: ${{ matrix.image }} + image: postgres:14 ports: - 5432 env: @@ -77,9 +74,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - --tmpfs /var/lib/postgresql + --tmpfs /var/lib/postgres runs-on: "ubuntu-26.04" - timeout-minutes: 20 + timeout-minutes: 10 strategy: fail-fast: false @@ -87,10 +84,6 @@ jobs: php: - '8.3' - '8.4' - image: - - 'postgres:14' - - 'postgres:18' - steps: - uses: actions/checkout@v7 @@ -105,16 +98,16 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run integration test suite vs Postgresql - run: composer run-script test-integration + run: composer run-script --timeout=600 test-integration env: - DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?server_version=10" + DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?serverVersion=14" integration-tests-mysql: name: MySQL integration tests needs: tests services: mysql: - image: ${{ matrix.image }} + image: ghcr.io/ibexa/core/mysql ports: - 3306/tcp env: @@ -129,7 +122,7 @@ jobs: --health-retries=5 --tmpfs=/var/lib/mysql runs-on: "ubuntu-26.04" - timeout-minutes: 20 + timeout-minutes: 10 strategy: fail-fast: false @@ -137,10 +130,6 @@ jobs: php: - '8.3' - '8.4' - image: - - 'mysql:8.0' - - 'mysql:8.4' - steps: - uses: actions/checkout@v7 @@ -155,6 +144,27 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run integration test suite vs MySQL - run: composer run-script test-integration + run: composer run-script --timeout=600 test-integration env: DATABASE_URL: "mysql://mysql:mysql@127.0.0.1:${{ job.services.mysql.ports[3306] }}/testdb" + + deptrac: + name: Deptrac + runs-on: "ubuntu-26.04" + strategy: + fail-fast: false + matrix: + php: + - '8.3' + steps: + - uses: actions/checkout@v7 + + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} + + - name: Run deptrac + run: composer run-script deptrac diff --git a/.github/workflows/frontend-ci.yaml b/.github/workflows/frontend-ci.yaml index cdfc5c9..cc65baa 100644 --- a/.github/workflows/frontend-ci.yaml +++ b/.github/workflows/frontend-ci.yaml @@ -3,24 +3,36 @@ name: Frontend build on: push: paths: + - "**.cjs" + - "**.mjs" - "**.js" + - "**.jsx" + - "**.ts" + - "**.tsx" + - "**.scss" branches: - main - '[0-9]+.[0-9]+' pull_request: paths: + - "**.cjs" + - "**.mjs" - "**.js" + - "**.jsx" + - "**.ts" + - "**.tsx" + - "**.scss" jobs: frontend-test: name: Frontend build test - runs-on: "ubuntu-24.04" + runs-on: 'ubuntu-26.04' timeout-minutes: 5 steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v4 - with: - node-version: '18' - - run: yarn install - - run: yarn test + - uses: actions/checkout@v7 + - uses: actions/setup-node@v4 + with: + node-version: '24' + - run: yarn install + - run: yarn test diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index d3413dc..b8ae375 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -1,12 +1,14 @@ + name: PR check on: - pull_request: - types: - - opened - - synchronize - - reopened - - edited + pull_request: + types: + - opened + - synchronize + - reopened + - edited jobs: - test-base-branch: - uses: ibexa/gh-workflows/.github/workflows/pr-check.yml@main + test-base-branch: + if: github.event.repository.name != 'bundle-template-internal' + uses: ibexa/gh-workflows/.github/workflows/pr-check.yml@main diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index dd5ea18..7aad656 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -10,13 +10,13 @@ on: jobs: rector: name: Run rector - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-26.04" strategy: matrix: php: - '8.3' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - uses: ibexa/gh-workflows/actions/composer-install@main with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1503cbe..bda8dc2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,46 +1,13 @@ -name: Automatic Changelog Generator for tag +name: Call Automatic Changelog Generator for tag Workflow -on: - push: - tags: - - 'v*' - - '!v*-alpha*' +on: + push: + tags: + - 'v*' + - '!v*-alpha*' jobs: - release: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@master - - name: Set Environment - run: | - echo "BUILD_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Get previous release tag based on type - id: prevrelease - uses: ibexa/version-logic-action@master - with: - currentTag: ${{ env.BUILD_TAG }} - - - name: Generate changelog - id: changelog - uses: ibexa/changelog-generator-action@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - jira_token: ${{ secrets.JIRA_TOKEN }} - currentTag: ${{ env.BUILD_TAG }} - previousTag: ${{ steps.prevrelease.outputs.previousTag }} - - - name: Print the changelog - run: echo "$CHANGELOG" - env: - CHANGELOG: ${{ steps.changelog.outputs.changelog }} - - - name: Create Release - id: create_release - uses: zendesk/action-create-release@v1 - with: - tag_name: ${{ env.BUILD_TAG }} - body: | - ${{ steps.changelog.outputs.changelog }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + create_release_for_tag: + uses: ibexa/gh-workflows/.github/workflows/release_bundle.yml@main + secrets: + JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} diff --git a/.github/workflows/reviewers.yaml b/.github/workflows/reviewers.yaml index 5b11620..294c26f 100644 --- a/.github/workflows/reviewers.yaml +++ b/.github/workflows/reviewers.yaml @@ -1,15 +1,15 @@ name: On PR Review Requested on: - pull_request: - types: [review_requested] + pull_request: + types: [ review_requested ] jobs: - call-expand-team-reviewers: - if: ${{ github.event.requested_team }} - uses: ibexa/gh-workflows/.github/workflows/expand-team-reviewers.yml@main - with: - requested_team: ${{ github.event.requested_team.slug }} - pull_request_number: ${{ github.event.pull_request.number }} - repository: ${{ github.repository }} - secrets: inherit + call-expand-team-reviewers: + if: ${{ github.event.requested_team }} + uses: ibexa/gh-workflows/.github/workflows/expand-team-reviewers.yml@main + with: + requested_team: ${{ github.event.requested_team.slug }} + pull_request_number: ${{ github.event.pull_request.number }} + repository: ${{ github.repository }} + secrets: inherit diff --git a/.gitignore b/.gitignore index 4d90817..05ce754 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ +/.deptrac.cache /.php-cs-fixer.cache +/.phpunit.cache /.phpunit.result.cache /composer.lock /node_modules/ /vendor /yarn.lock +/var diff --git a/composer.json b/composer.json index a6d6876..1b1c8d8 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "ibexa/core-persistence", + "description": "Ibexa core persistence bundle.", "license": "(GPL-2.0-only or proprietary)", "type": "ibexa-bundle", "keywords": [ @@ -18,6 +19,7 @@ }, "require-dev": { "dama/doctrine-test-bundle": "^8.2", + "deptrac/deptrac": "^4.7", "ibexa/code-style": "~2.0.0", "ibexa/rector": "~5.0.x-dev", "ibexa/test-core": "5.0.x-dev", @@ -45,13 +47,15 @@ "check-cs": "@fix-cs --dry-run", "test": "phpunit -c phpunit.xml.dist", "test-integration": "phpunit -c phpunit.integration.xml", - "phpstan": "phpstan analyse -c phpstan.neon" + "phpstan": "phpstan analyse -c phpstan.neon", + "deptrac": "php vendor/bin/deptrac analyse" }, "scripts-descriptions": { "fix-cs": "Automatically fixes code style in all files", "check-cs": "Run code style checker for all files", "test": "Run automatic tests", - "phpstan": "Run static code analysis" + "phpstan": "Run static code analysis", + "deptrac": "Run Deptrac architecture testing" }, "extra": { "branch-alias": { diff --git a/deptrac.baseline.yaml b/deptrac.baseline.yaml new file mode 100644 index 0000000..577f653 --- /dev/null +++ b/deptrac.baseline.yaml @@ -0,0 +1,10 @@ +deptrac: + skip_violations: + Ibexa\Contracts\CorePersistence\Gateway\AbstractDoctrineDatabase: + - Ibexa\CorePersistence\Gateway\ExpressionVisitor + - Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry + Ibexa\Contracts\CorePersistence\Gateway\AbstractTranslationGateway: + - Ibexa\CorePersistence\Gateway\ExpressionVisitor + - Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry + Ibexa\CorePersistence\Gateway\DoctrineSchemaMetadataRegistry: + - Ibexa\Bundle\CorePersistence\DependencyInjection\IbexaCorePersistenceExtension diff --git a/deptrac.yaml b/deptrac.yaml index 174c771..7279018 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -1,3 +1,6 @@ +imports: + - deptrac.baseline.yaml + deptrac: paths: - ./src