-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #523 from pimcore/Switch-to-reusable-workflows-for…
…-codeception,-php-style,-poeditor-export-and-static-analysis Switch to reusable workflows for codeception, php-style, poedit…
- Loading branch information
Showing
7 changed files
with
220 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: "Codeception Tests centralised" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "[0-9]+.[0-9]+" | ||
- "[0-9]+.x" | ||
- "feature-*" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
env: | ||
PIMCORE_PROJECT_ROOT: ${{ github.workspace }} | ||
PRIVATE_REPO: ${{ github.event.repository.private }} | ||
|
||
jobs: | ||
setup-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
php_versions: ${{ steps.parse-php-versions.outputs.php_versions }} | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
private_repo: ${{ env.PRIVATE_REPO }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout reusable workflow repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: pimcore/workflows-collection-public | ||
ref: main | ||
path: reusable-workflows | ||
|
||
- name: Parse PHP versions from composer.json | ||
id: parse-php-versions | ||
run: | | ||
if [ -f composer.json ]; then | ||
php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//') | ||
if [ -z "$php_versions" ]; then | ||
echo "No PHP versions found in composer.json" | ||
echo "Setting default PHP value" | ||
echo "php_versions=default" >> $GITHUB_OUTPUT | ||
else | ||
echo "php_versions=$php_versions" >> $GITHUB_OUTPUT | ||
echo "#### php versions #### : $php_versions" | ||
fi | ||
else | ||
echo "composer.json not found" | ||
exit 1 | ||
fi | ||
- name: Set up matrix | ||
id: set-matrix | ||
run: | | ||
php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" | ||
MATRIX_JSON=$(cat reusable-workflows/codeception-tests-configuration/matrix-config.json) | ||
IFS=',' read -ra VERSIONS_ARRAY <<< "$php_versions" | ||
FILTERED_MATRIX_JSON=$(echo $MATRIX_JSON | jq --arg php_versions "$php_versions" ' | ||
{ | ||
matrix: [ | ||
.configs[] | | ||
select(.php_version == $php_versions) | | ||
.matrix[] | ||
] | ||
}') | ||
ENCODED_MATRIX_JSON=$(echo $FILTERED_MATRIX_JSON | jq -c .) | ||
echo "matrix=${ENCODED_MATRIX_JSON}" >> $GITHUB_OUTPUT | ||
codeception-tests: | ||
needs: setup-matrix | ||
strategy: | ||
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | ||
uses: pimcore/workflows-collection-public/.github/workflows/reusable-codeception-tests-centralized.yaml@main | ||
with: | ||
APP_ENV: test | ||
PIMCORE_TEST: 1 | ||
PRIVATE_REPO: ${{ needs.setup-matrix.outputs.private_repo}} | ||
PHP_VERSION: ${{ matrix.matrix.php-version }} | ||
DATABASE: ${{ matrix.matrix.database }} | ||
SERVER_VERSION: ${{ matrix.matrix.server_version }} | ||
DEPENDENCIES: ${{ matrix.matrix.dependencies }} | ||
EXPERIMENTAL: ${{ matrix.matrix.experimental }} | ||
PIMCORE_VERSION: ${{ matrix.matrix.pimcore_version }} | ||
secrets: | ||
SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} | ||
COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,24 @@ | ||
name: "PHP-CS-Fixer" | ||
|
||
on: | ||
pull_request_target: | ||
branches: | ||
- "[0-9]+.[0-9]+" | ||
- "[0-9]+.x" | ||
- "feature-*" | ||
push: | ||
branches: | ||
- "[0-9]+.[0-9]+" | ||
- "[0-9]+.x" | ||
- "*_actions" | ||
- "feature-*" | ||
pull_request_target: | ||
types: [ opened,closed,synchronize ] | ||
|
||
permissions: | ||
contents: read | ||
contents: write | ||
|
||
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@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
||
- name: PHP-CS-Fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga:latest | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Apply php-cs-fixer changes | ||
php-style: | ||
uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-cs-fixer.yaml@main | ||
secrets: | ||
PHP_CS_FIXER_GITHUB_TOKEN: ${{ secrets.PHP_CS_FIXER_GITHUB_TOKEN }} | ||
with: | ||
head_ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
config_file: .php-cs-fixer.dist.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- 1.x | ||
- 1.5 | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
Oops, something went wrong.