-
Notifications
You must be signed in to change notification settings - Fork 27
181 lines (140 loc) · 6.15 KB
/
github-container-registry.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
##########################################################################
#
# WARNING: This file was generated by update.php.
#
# You can find the relevant template in the `/templates` folder.
#
name: Build test images
on:
pull_request:
workflow_dispatch:
env:
REGISTRY_USERNAME: desrosj
REGISTRY_PASSWORD: ${{ secrets.GHCR_TOKEN }}
PACKAGE_REGISTRY_HOST: ghcr.io
PACKAGE_REGISTRY: ghcr.io/wordpress/wpdev-docker-images
PR_TAG: -${{ github.event.number }}
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
check-for-changes:
name: Check for uncommitted changes
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v.2.31.1
with:
php-version: 'latest'
- name: Build images
run: php update.php
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code
build-php-images:
name: PHP ${{ matrix.php }} Image
runs-on: ubuntu-latest
needs: [ check-for-changes ]
strategy:
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '8.2'
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to the package registry
run: |
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
- name: Build Docker image
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/php
- name: Log Docker images
run: docker images
- name: Push Docker image
run: docker push $PACKAGE_REGISTRY/php:$PHP_VERSION-fpm$PR_TAG
- name: Push image as latest
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
run: |
docker image tag $PACKAGE_REGISTRY/php:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/php:latest$PR_TAG
docker images
docker push $PACKAGE_REGISTRY/php:latest$PR_TAG
build-phpunit-images:
name: PHPUnit on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
needs: build-php-images
strategy:
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '8.2'
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to the package registry
run: |
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
- name: Build Docker image
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/phpunit
- name: Log Docker images
run: docker images
- name: Push Docker image
run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG
- name: Tag and push image as latest
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
run: |
docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
build-specific-phpunit-images:
name: PHPUnit ${{ matrix.phpunit }}
runs-on: ubuntu-latest
needs: build-php-images
strategy:
matrix:
phpunit: [ '8-php-7.2', '7-php-7.2', '6-php-7.2', '9-php-7.3', '8-php-7.3', '7-php-7.3', '6-php-7.3', '9-php-7.4', '8-php-7.4', '7-php-7.4', '9-php-8.0', '8-php-8.0', '9-php-8.1', '8-php-8.1', '9-php-8.2', '8-php-8.2', '9-php-8.3' ]
env:
PHPUNIT_VERSION: ${{ matrix.phpunit }}
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to the package registry
run: |
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
- name: Build Docker image
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG images/phpunit/$PHPUNIT_VERSION
- name: Log Docker images
run: docker images
- name: Push Docker image
run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG
build-cli-images:
name: CLI on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
needs: build-php-images
strategy:
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
env:
PHP_VERSION: ${{ matrix.php }}
PHP_LATEST: '8.2'
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to the package registry
run: |
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
- name: Build Docker image
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/cli
- name: Log Docker images
run: docker images
- name: Push Docker image
run: docker push $PACKAGE_REGISTRY/cli:$PHP_VERSION-fpm$PR_TAG
- name: Push image as latest
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
run: |
docker image tag $PACKAGE_REGISTRY/cli:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/cli:latest$PR_TAG
docker push $PACKAGE_REGISTRY/cli:latest$PR_TAG