CI/CD #88
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: | |
schedule: | |
- cron: '0 0 * * 0' | |
env: | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: ['8.0', '8.1', '8.2', '8.3'] | |
type: ['-swoole', '-nginx-swoole-prod'] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and export to Docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.version }}${{ matrix.type }} | |
load: true | |
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }} | |
- name: Tests (dev) | |
if: matrix.type == '-swoole' | |
run: | | |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -r "extension_loaded('swoole') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} node -v | |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} yarn -v | |
- name: Tests (prod) | |
if: matrix.type == '-nginx-swoole-prod' | |
run: | | |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -r "extension_loaded('swoole') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} nginx -v | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole' | |
with: | |
context: ${{ matrix.version }}${{ matrix.type }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }} | |
trigger-build-oci8: | |
name: Trigger OCI8 Build | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Trigger build on kool-dev/docker-php-oci8 | |
uses: benc-uk/[email protected] | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-swoole' | |
with: | |
workflow: CI/CD | |
repo: kool-dev/docker-php-oci8 | |
token: ${{ secrets.WORKFLOW_TOKEN }} |