Add pull request to ci-cd #128
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: [pull_request, push, workflow_dispatch] | |
env: | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: ['7.4', '8.0', '8.1'] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Build | |
run: | | |
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-oci8 ${{ matrix.version }}-nginx-oci8 | |
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-oci8-prod ${{ matrix.version }}-nginx-oci8-prod | |
- name: Build Swoole | |
if: matrix.version != '7.4' | |
run: | | |
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-swoole-oci8 ${{ matrix.version }}-nginx-swoole-oci8 | |
docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-swoole-oci8-prod ${{ matrix.version }}-nginx-swoole-oci8-prod | |
- name: Tests | |
run: | | |
docker run kooldev/php:${{ matrix.version }}-nginx-oci8 php -r "extension_loaded('oci8') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}-nginx-oci8-prod php -r "extension_loaded('oci8') or die(1);" | |
- name: Tests Swoole | |
if: matrix.version != '7.4' | |
run: | | |
docker run kooldev/php:${{ matrix.version }}-nginx-oci8 php -r "extension_loaded('oci8') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}-nginx-oci8-prod php -r "extension_loaded('oci8') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}-nginx-swoole-oci8 php -r "extension_loaded('oci8') or die(1);" | |
docker run kooldev/php:${{ matrix.version }}-nginx-swoole-oci8-prod php -r "extension_loaded('oci8') or die(1);" | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push to DockerHub | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' | |
run: | | |
docker push kooldev/php:${{ matrix.version }}-nginx-oci8 | |
docker push kooldev/php:${{ matrix.version }}-nginx-oci8-prod | |
- name: Push to DockerHub Swoole | |
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' && matrix.version != '7.4' | |
run: | | |
docker push kooldev/php:${{ matrix.version }}-nginx-swoole-oci8 | |
docker push kooldev/php:${{ matrix.version }}-nginx-swoole-oci8-prod |