-
-
Notifications
You must be signed in to change notification settings - Fork 97
122 lines (112 loc) · 3.91 KB
/
Copy pathdocker.yml
File metadata and controls
122 lines (112 loc) · 3.91 KB
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
name: Docker
permissions:
contents: read
pull-requests: read
on: [workflow_dispatch]
jobs:
docker:
name: PHP v${{ matrix.php.major }}.${{ matrix.php.minor }}, ${{ matrix.flags.name }}
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
php:
- major: 8
minor: 0
patch: 30
rc: ''
- major: 8
minor: 1
patch: 31
rc: ''
- major: 8
minor: 2
patch: 26
rc: ''
- major: 8
minor: 3
patch: 14
rc: ''
- major: 8
minor: 4
patch: 1
rc: ''
- major: 8
minor: 5
patch: 8
rc: ''
flags:
- name: asan
debug: disable
asan: enable
tsan: disable
gcov: disable
- name: dbg
debug: enable
asan: disable
tsan: disable
gcov: disable
- name: gcov
debug: disable
asan: disable
tsan: disable
gcov: enable
- name: release
debug: disable
asan: disable
tsan: disable
gcov: disable
exclude:
- php: {major: 8, minor: 0}
flags: {name: asan}
include:
- php: {major: 8, minor: 5, patch: 8, rc: ''}
flags: {name: tsan, debug: disable, asan: disable, tsan: enable, gcov: disable}
steps:
- name: Prepare build variables
id: build-vars
run: |
echo "repository=ghcr.io/${{ github.repository_owner }}/php-${{ matrix.flags.name }}-${{ matrix.php.major }}.${{ matrix.php.minor }}" >> $GITHUB_OUTPUT
echo "version=${{ matrix.php.major }}.${{ matrix.php.minor }}.${{ matrix.php.patch }}${{ matrix.php.rc }}" >> $GITHUB_OUTPUT
- name: Repository checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://docs.docker.com/build/ci/github-actions/cache/
- name: Build and export Docker Image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
load: true
build-args: |
"PHP_SRC_TYPE=dist"
"PHP_SRC_DEBUG=${{ matrix.flags.debug }}"
"PHP_SRC_ASAN=${{ matrix.flags.asan }}"
"PHP_SRC_TSAN=${{ matrix.flags.tsan }}"
"PHP_SRC_GCOV=${{ matrix.flags.gcov }}"
"PHP_VERSION_MAJOR=${{ matrix.php.major }}"
"PHP_VERSION_MINOR=${{ matrix.php.minor }}"
"PHP_VERSION_PATCH=${{ matrix.php.patch }}"
"PHP_VERSION_RC=${{ matrix.php.rc }}"
tags: |
${{ steps.build-vars.outputs.repository }}:latest
${{ steps.build-vars.outputs.repository }}:${{ steps.build-vars.outputs.version }}
file: ./docker/php.dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
# https://docs.docker.com/build/ci/github-actions/test-before-push/
- name: Test Docker Image
run: |
if [ "${{ matrix.flags.name }}" = tsan ]; then
docker run --rm --security-opt seccomp=unconfined ${{ steps.build-vars.outputs.repository }}:latest php --version
else
docker run --rm ${{ steps.build-vars.outputs.repository }}:latest php --version
fi
- name: Push Docker Image
run: docker push --all-tags ${{ steps.build-vars.outputs.repository }}