Skip to content

Commit

Permalink
Update workflows to reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed May 7, 2024
1 parent ab5894b commit 64a0f7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 120 deletions.
45 changes: 7 additions & 38 deletions .github/workflows/codeception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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 }}
19 changes: 4 additions & 15 deletions .github/workflows/php-cs-fixer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
php-style:
uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-style.yaml@main
with:
head_ref: ${{ github.ref }}
12 changes: 4 additions & 8 deletions .github/workflows/poeditor-export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
php-style:
uses: pimcore/workflows-collection-public/.github/workflows/reusable-poeditor.yaml@main
secrets:
POEDITOR_ACTION_TRIGGER_TOKEN: ${{ secrets.POEDITOR_ACTION_TRIGGER_TOKEN }}
64 changes: 5 additions & 59 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 }}

0 comments on commit 64a0f7f

Please sign in to comment.