-
-
Notifications
You must be signed in to change notification settings - Fork 200
131 lines (127 loc) · 4.91 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Docker Image CI
on:
workflow_dispatch:
push:
pull_request:
schedule:
- cron: '0 3 * * 0'
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
# Example
#
# php-base-image-version: "x.y-type"
# dockerfile-flavour: "debian"
# legacy-gd-lib: ""
# pecl-xdebug-suffix: ""
# pecl-mongodb-suffix: ""
# compose-file: "docker-compose.yml:..."
include:
- php-base-image-version: "8.1-fpm"
dockerfile-flavour: "debian"
compose-file: "docker-compose.yml,docker-compose.fpm-nginx.yml"
experimental: false
- php-base-image-version: "8.2-fpm"
dockerfile-flavour: "debian"
compose-file: "docker-compose.yml,docker-compose.fpm-nginx.yml"
experimental: false
- php-base-image-version: "8.3-fpm"
dockerfile-flavour: "debian"
compose-file: "docker-compose.yml,docker-compose.fpm-nginx.yml"
pecl-xdebug-suffix: "-beta"
pecl-imagick-suffix: "/imagick@master"
experimental: false
- php-base-image-version: "8.1-apache"
dockerfile-flavour: "debian"
experimental: false
- php-base-image-version: "8.2-apache"
dockerfile-flavour: "debian"
experimental: false
- php-base-image-version: "8.3-apache"
dockerfile-flavour: "debian"
pecl-xdebug-suffix: "-beta"
pecl-imagick-suffix: "/imagick@master"
experimental: false
fail-fast: false
env:
COMPOSE_FILE: ${{ matrix.compose-file }}
COMPOSE_PATH_SEPARATOR: ","
PHP_IMAGE_NAME: "yiisoftware/yii2-php"
PHP_BASE_IMAGE_VERSION: ${{ matrix.php-base-image-version }}
DOCKERFILE_FLAVOUR: ${{ matrix.dockerfile-flavour }}
X_LEGACY_GD_LIB: ${{ matrix.legacy-gd-lib }}
PECL_XDEBUG_INSTALL_SUFFIX: ${{ matrix.pecl-xdebug-suffix }}
PECL_MONGODB_INSTALL_SUFFIX: ${{ matrix.pecl-mongodb-suffix }}
PECL_IMAGICK_INSTALL_SUFFIX: ${{ matrix.pecl-imagick-suffix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'amd64,arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set version suffix (tags)
if: startsWith(github.ref, 'refs/tags/')
run: echo "PHP_IMAGE_VERSION_SUFFIX=-${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Set version suffix (master/latest)
if: (github.ref == 'refs/heads/master' && (github.event_name != 'workflow_dispatch' && github.event_name != 'schedule'))
run: echo "PHP_IMAGE_VERSION_SUFFIX=-latest" >> $GITHUB_ENV
- name: Install
env:
TEST_YII_VERSION: "d43341a73ab9ab711c42b74c117e076275d9b8c0"
run: |
git clone https://github.com/yiisoft/yii2 _host-volumes/yii2
pushd _host-volumes/yii2 && git checkout ${TEST_YII_VERSION} && popd
cp .env-dist .env
- name: Print Info
run: |
pwd
docker version
docker info
docker-compose version
- name: Build Image
uses: docker/bake-action@v2
with:
files: ${{ matrix.compose-file }}
load: true
set: |
*.platform=linux/amd64
*.args.X_LEGACY_GD_LIB=${{ matrix.legacy-gd-lib }}
- name: Test
run: |
docker-compose run --rm php-min php -v | grep "Xdebug" && exit 1
docker-compose run --rm php-min php /tests/requirements.php
docker-compose run --rm php-dev php /tests/requirements.php
docker-compose run --rm -w /yii2 php-dev composer update --prefer-dist
docker-compose run --rm -w /yii2 php-dev php -d error_reporting="E_ALL ^ E_DEPRECATED" vendor/bin/phpunit tests/framework/ --exclude db
docker-compose run --rm -e PHP_ENABLE_XDEBUG=1 php-dev php -v | grep "Xdebug" || exit 1
docker images
- name: Login to Docker
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Build and push docker image (amd64 master/latest)
if: (github.ref == 'refs/heads/master' && (github.event_name != 'workflow_dispatch' && github.event_name != 'schedule'))
uses: docker/bake-action@v2
with:
files: ${{ matrix.compose-file }}
push: true
set: |
*.platform=linux/amd64
- name: Build and push docker image (amd64,arm64)
if: |
startsWith(github.ref, 'refs/tags/') ||
(github.ref == 'refs/heads/master' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'))
uses: docker/bake-action@v2
with:
files: ${{ matrix.compose-file }}
push: true
set: |
*.platform=linux/amd64,linux/arm64