Skip to content

chore: Update phpstan to version 1.11.2 #227

chore: Update phpstan to version 1.11.2

chore: Update phpstan to version 1.11.2 #227

name: Build Docker images
on:
push:
env:
PHPSTAN_VERSION: 1.11.2
DOCKER_REPOSITORY: aragon999/phpstan-shopware
CACHE_KEY: 2020-09-22
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- shopware-version: v6.4.0.0
php-version: "7.4"
- shopware-version: v6.4.1.2
php-version: "7.4"
- shopware-version: v6.4.2.1
php-version: "7.4"
- shopware-version: v6.4.3.1
php-version: "7.4"
- shopware-version: v6.4.4.1
php-version: "7.4"
- shopware-version: v6.4.5.1
php-version: "7.4"
- shopware-version: v6.4.6.1
php-version: "7.4"
- shopware-version: v6.4.7.0
php-version: "7.4"
- shopware-version: v6.4.8.2
php-version: "7.4"
- shopware-version: v6.4.9.0
php-version: "7.4"
- shopware-version: v6.4.10.1
php-version: "7.4"
- shopware-version: v6.4.11.1
php-version: "7.4"
- shopware-version: v6.4.12.0
php-version: "7.4"
- shopware-version: v6.4.13.0
php-version: "7.4"
- shopware-version: v6.4.14.0
php-version: "7.4"
- shopware-version: v6.4.15.2
php-version: "7.4"
- shopware-version: v6.4.16.1
php-version: "7.4"
- shopware-version: v6.4.17.2
php-version: "7.4"
- shopware-version: v6.4.18.1
php-version: "7.4"
- shopware-version: v6.4.19.0
php-version: "7.4"
- shopware-version: v6.4.20.2
php-version: "7.4"
- shopware-version: v6.5.0.0
php-version: "8.1"
- shopware-version: v6.5.1.1
php-version: "8.1"
- shopware-version: v6.5.2.1
php-version: "8.1"
- shopware-version: v6.5.3.3
php-version: "8.1"
- shopware-version: v6.5.4.1
php-version: "8.1"
- shopware-version: v6.5.5.2
php-version: "8.1"
- shopware-version: v6.5.6.1
php-version: "8.1"
- shopware-version: v6.5.7.4
php-version: "8.1"
- shopware-version: v6.5.8.10
php-version: "8.1"
- shopware-version: v6.6.0.3
php-version: "8.2"
- shopware-version: v6.6.1.2
php-version: "8.2"
- shopware-version: v6.6.2.0
php-version: "8.2"
steps:
- name: Clone
uses: actions/checkout@v4
- name: Get Tag
id: get-docker-tag
run: |
shopware_version_tag=$(echo "${{ matrix.shopware-version }}" | grep -m1 -E '(v[0-9]+\.[0-9]+\.[0-9]+)' -o)
[ "${shopware_version_tag}" == "" ] && exit 1
tag="${{ env.DOCKER_REPOSITORY }}:${shopware_version_tag}"
echo "Shopware version ${{ matrix.shopware-version }}"
echo "Image Tag: ${tag}"
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.CACHE_KEY }}-${{ env.PHPSTAN_VERSION }}-${{ matrix.shopware-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ env.CACHE_KEY }}-${{ env.PHPSTAN_VERSION }}-${{ matrix.shopware-version }}-
- name: Build docker image
uses: docker/build-push-action@v5
with:
build-args: |
PHPSTAN_VERSION=${{ env.PHPSTAN_VERSION }}
SHOPWARE_VERSION=${{ matrix.shopware-version }}
PHP_VERSION=${{ matrix.php-version }}
tags: ${{ steps.get-docker-tag.outputs.tag }}
push: false
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Run basic checks
run: |
# Check phpstan version of the image
docker run --rm ${{ steps.get-docker-tag.outputs.tag }} \
| grep "${PHPSTAN_VERSION}" || exit_code=$?
[[ "$exit_code" -ne "0" ]] \
&& docker run --rm ${{ steps.get-docker-tag.outputs.tag }} \
&& echo "Did not find expected phpstan version" \
&& exit ${exit_code}
# Check that phpstan has access to the shopware classes
docker run --rm ${{ steps.get-docker-tag.outputs.tag }} \
analyze --level 5 \
/composer/vendor/shopware/core/Content/Sitemap
- name: Check for push
id: check-push
run: |
if [ "${{ secrets.DOCKER_USERNAME }}" == "" ] || [ "${{ secrets.DOCKER_PASSWORD }}" == "" ]; then
echo "No Docker credentials found, skipping push."
exit 0
fi
if [ "${{ github.event_name == 'pull_request' }}" == "true" ]; then
echo "Pull request, skipping push."
exit 0
fi
if [ "${{ github.ref }}" != "refs/heads/master" ]; then
echo "Not on master branch, skipping push."
exit 0
fi
echo "push=true" >> $GITHUB_OUTPUT
- name: Login to Docker Hub Registry
uses: docker/login-action@v3
if: ${{ steps.check-push.outputs.push }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push docker image
if: ${{ steps.check-push.outputs.push }}
run: |
docker push ${{ steps.get-docker-tag.outputs.tag }}