From 64a0f7fc9fa5306f8b1f971ed5609e761c836001 Mon Sep 17 00:00:00 2001 From: mattamon Date: Tue, 7 May 2024 10:12:14 +0200 Subject: [PATCH] Update workflows to reusable workflows --- .github/workflows/codeception.yaml | 45 +++--------------- .github/workflows/php-cs-fixer.yaml | 19 ++------ .github/workflows/poeditor-export.yaml | 12 ++--- .github/workflows/static-analysis.yaml | 64 ++------------------------ 4 files changed, 20 insertions(+), 120 deletions(-) diff --git a/.github/workflows/codeception.yaml b/.github/workflows/codeception.yaml index 0fe6f24ee..d0f9b6db4 100644 --- a/.github/workflows/codeception.yaml +++ b/.github/workflows/codeception.yaml @@ -21,41 +21,10 @@ env: jobs: codeception-tests: - name: "Codeception tests" - runs-on: "ubuntu-20.04" - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - include: - - { php-version: 8.2, dependencies: lowest, pimcore_version: "", experimental: false } - - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: xdebug - ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767 - php-version: "${{ matrix.php-version }}" - - - name: Install SSH Key # this is necessary for Composer to be able to clone source from pimcore/ee-pimcore - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} - known_hosts: 'TBD' - - - name: "Add authentication for private pimcore packages" - run: | - composer config repositories.private-packagist composer https://repo.pimcore.com/github-actions/ - composer config --global --auth http-basic.repo.pimcore.com github-actions ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} - - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run Codeception" - run: "vendor/bin/codecept run -c . -vvv --xml --coverage-xml" \ No newline at end of file + uses: pimcore/workflows-collection-public/.github/workflows/reusable-codeception-tests.yaml@main + with: + APP_ENV: test + PIMCORE_TEST: 1 + secrets: + COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} + SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} \ No newline at end of file diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml index 3d939199a..bdb5ce6aa 100644 --- a/.github/workflows/php-cs-fixer.yaml +++ b/.github/workflows/php-cs-fixer.yaml @@ -15,18 +15,7 @@ permissions: contents: read jobs: - php-cs-fixer: - permissions: - contents: write # for stefanzweifel/git-auto-commit-action to push code in repo - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:latest - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Apply php-cs-fixer changes \ No newline at end of file + php-style: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-style.yaml@main + with: + head_ref: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/poeditor-export.yaml b/.github/workflows/poeditor-export.yaml index ecf9cb0a6..197581209 100644 --- a/.github/workflows/poeditor-export.yaml +++ b/.github/workflows/poeditor-export.yaml @@ -12,11 +12,7 @@ permissions: contents: read jobs: - poeditor: - runs-on: ubuntu-latest - steps: - - name: Trigger workflow in pimcore/poeditor-export-action - env: - GH_TOKEN: ${{ secrets.POEDITOR_ACTION_TRIGGER_TOKEN }} - run: | - gh workflow run -R pimcore/poeditor-export-action poeditor-export.yaml \ No newline at end of file + php-style: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-poeditor.yaml@main + secrets: + POEDITOR_ACTION_TRIGGER_TOKEN: ${{ secrets.POEDITOR_ACTION_TRIGGER_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 99f69f7e6..fe1173ecc 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -18,62 +18,8 @@ on: - "*_actions" jobs: - static-analysis-phpstan: - name: "Static Analysis with PHPStan" - runs-on: "ubuntu-20.04" - strategy: - matrix: - include: - - { php-version: "8.2", dependencies: "highest", experimental: false } - - { php-version: "8.2", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true } - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "${{ matrix.php-version }}" - - - name: Install SSH Key # this is necessary for Composer to be able to clone source from pimcore/ee-pimcore - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} - known_hosts: 'TBD' - - - name: "Add authentication for private pimcore packages" - run: | - composer config repositories.private-packagist composer https://repo.pimcore.com/github-actions/ - composer config --global --auth http-basic.repo.pimcore.com github-actions ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} - - - name: "Setup Pimcore environment" - run: | - .github/ci/scripts/setup-pimcore-environment.sh - - - name: "Update Pimcore version" - env: - PIMCORE_VERSION: "${{ matrix.pimcore_version }}" - run: | - if [ ! -z "$PIMCORE_VERSION" ]; then - composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}" - fi - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run a static analysis with phpstan/phpstan" - run: "vendor/bin/phpstan analyse --memory-limit=-1" - - - name: "Generate baseline file" - if: ${{ failure() }} - run: "vendor/bin/phpstan analyse --memory-limit=-1 --generate-baseline" - - - name: "Upload baseline file" - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: phpstan-baseline.neon - path: phpstan-baseline.neon \ No newline at end of file + static-analysis: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-static-analysis.yaml@main + secrets: + COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} + SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} \ No newline at end of file