CI/CD #138
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
name: CI/CD | |
on: [push, workflow_dispatch] | |
env: | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: ['7.4', '8.0', '8.1', '8.2', '8.3'] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-phpqa' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and export to Docker | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ matrix.version }} | |
load: true | |
tags: kooldev/phpqa:${{ matrix.version }} | |
- name: Tests | |
run: | | |
docker run kooldev/phpqa:${{ matrix.version }} phpunit --version | |
docker run kooldev/phpqa:${{ matrix.version }} composer -V | |
docker run kooldev/phpqa:${{ matrix.version }} phan --version | |
docker run kooldev/phpqa:${{ matrix.version }} phpmd --version | |
docker run kooldev/phpqa:${{ matrix.version }} phpcpd --version | |
docker run kooldev/phpqa:${{ matrix.version }} php-cs-fixer --version | |
docker run kooldev/phpqa:${{ matrix.version }} local-php-security-checker -help | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-phpqa' | |
with: | |
context: ${{ matrix.version }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: kooldev/phpqa:${{ matrix.version }} |