From fa6b8d8216e268b4070516bf00954b1ec3ef2884 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Fri, 19 Jan 2024 12:30:40 +0100 Subject: [PATCH] Try dependency matrix --- .github/workflows/build.yml | 6 +-- .github/workflows/php.yml | 101 +++++++++++++++++++++++------------- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52e95ce00..5418859d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,5 @@ name: Build -on: - pull_request: - push: - branches: - - trunk + jobs: build: uses: shopware/github-actions/.github/workflows/build-zip.yml@main diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5a4a539ab..b19cb5986 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,44 +16,71 @@ on: env: SHOPWARE_TOOL_CACHE_PHPSTAN: ${{ github.workspace }}/var/phpstan + DEPENDENCIES_WITH_COMMERCIAL: |- + [ + {"name": "SwagCommercial", "repo": "https://shopware:$COMMERCIAL_TOKEN@gitlab.shopware.com/shopware/6/product/commercial.git"}, + {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} + ] + DEPENDENCIES_WITHOUT_COMMERCIAL: |- + [ + {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} + ] jobs: - cs: - if: github.event_name != 'schedule' - uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main - phpstan: - uses: shopware/github-actions/.github/workflows/phpstan.yml@main - with: - extensionName: SwagPayPal - shopwareVersion: trunk - dependencies: |- - [ - {"name": "SwagCommercial", "repo": "https://shopware:$COMMERCIAL_TOKEN@gitlab.shopware.com/shopware/6/product/commercial.git"}, - {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} - ] - secrets: - env: |- - CMS_TOKEN=${{ secrets.CMS_GITLAB_TOKEN }} - COMMERCIAL_TOKEN=${{ secrets.COMMERCIAL_GITLAB_TOKEN }} - phpunit: - uses: shopware/github-actions/.github/workflows/phpunit.yml@phpunit-matrix - strategy: - matrix: - phpVersion: [ 8.2, 8.3 ] - mysqlVersion: ["mysql:8.0", "mariadb:10.11"] - with: - uploadCoverage: true - extensionName: SwagPayPal - shopwareVersion: ${{ matrix.shopware-version }} - phpVersion: ${{ matrix.phpVersion }} - mysqlVersion: ${{ matrix.mysqlVersion }} - dependencies: |- - [ - {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} - ] - secrets: - env: |- - CMS_TOKEN=${{ secrets.CMS_GITLAB_TOKEN }} - codecovToken: ${{ secrets.CODECOV_TOKEN }} + compute: + runs-on: ubuntu-latest + outputs: + DEPS_WITH_COMMERCIAL: ${{ steps.compute.outputs.DEPS_WITH_COMMERCIAL }} + DEPS_WITHOUT_COMMERCIAL: ${{ steps.compute.outputs.DEPS_WITHOUT_COMMERCIAL }} + steps: + - name: Compute outputs + run: | + echo "DEPS_WITH_COMMERCIAL=$(echo "$DEPENDENCIES_WITH_COMMERCIAL" | jq -c '.' 2>&1)" >> $GITHUB_OUTPUT + echo "DEPS_WITHOUT_COMMERCIAL=$(echo "$DEPENDENCIES_WITHOUT_COMMERCIAL" | jq -c '.' 2>&1)" >> $GITHUB_OUTPUT + test-compute: + runs-on: ubuntu-latest + steps: + - name: Test outputs + env: + testEnv: ${{needs.compute.outputs.DEPS_WITH_COMMERCIAL}} + run: | + echo ${{needs.compute.outputs.DEPS_WITH_COMMERCIAL}} + echo $testEnv +# cs: +# if: github.event_name != 'schedule' +# uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main +# phpstan: +# uses: shopware/github-actions/.github/workflows/phpstan.yml@main +# with: +# extensionName: SwagPayPal +# shopwareVersion: trunk +# dependencies: |- +# [ +# {"name": "SwagCommercial", "repo": "https://shopware:$COMMERCIAL_TOKEN@gitlab.shopware.com/shopware/6/product/commercial.git"}, +# {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} +# ] +# secrets: +# env: |- +# CMS_TOKEN=${{ secrets.CMS_GITLAB_TOKEN }} +# COMMERCIAL_TOKEN=${{ secrets.COMMERCIAL_GITLAB_TOKEN }} +# phpunit: +# uses: shopware/github-actions/.github/workflows/phpunit.yml@main +# strategy: +# matrix: +# phpVersion: [ 8.2, 8.3 ] +## mysqlVersion: ["mysql:8.0", "mariadb:10.11"] +# dependencies: [ "${{needs.compute.outputs.DEPENDENCIES_WITH_COMMERCIAL}}", "${{needs.compute.outputs.DEPENDENCIES_WITHOUT_COMMERCIAL}}" ] +# with: +# uploadCoverage: true +# extensionName: SwagPayPal +# shopwareVersion: ${{ matrix.shopware-version }} +# phpVersion: ${{ matrix.phpVersion }} +## mysqlVersion: ${{ matrix.mysqlVersion }} +# dependencies: ${{ matrix.dependencies }} +# secrets: +# env: |- +# CMS_TOKEN=${{ secrets.CMS_GITLAB_TOKEN }} +# codecovToken: ${{ secrets.CODECOV_TOKEN }} +#