Skip to content

Commit d09287c

Browse files
rudi-augmentclaude
andcommitted
Add Docker and GitHub Actions CI for PHP 8.2-8.5 on Debian and Alpine
Separate Dockerfiles for Debian and Alpine with parameterized PHP version. CI matrix tests 8 combinations (4 PHP versions x 2 platforms). Added .dockerignore to prevent stale host build artifacts from corrupting cross-version Docker builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e88fdfb commit d09287c

5 files changed

Lines changed: 90 additions & 3 deletions

File tree

.dockerignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.git
2+
.github
3+
.idea
4+
.libs
5+
build
6+
modules
7+
autom4te.cache
8+
vendor
9+
**/*.o
10+
**/*.lo
11+
**/*.la
12+
**/*.dep
13+
*.tgz
14+
config.h
15+
config.h.in
16+
config.log
17+
config.nice
18+
config.status
19+
configure
20+
configure.in
21+
libtool
22+
ltmain.sh
23+
Makefile
24+
Makefile.*
25+
aclocal.m4
26+
acinclude.m4
27+
install-sh
28+
missing
29+
mkinstalldirs
30+
run-tests.php
31+
tmp-php.ini

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
name: PHP ${{ matrix.php }} (${{ matrix.platform }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- { php: '8.2', platform: debian, dockerfile: Dockerfile }
18+
- { php: '8.2', platform: alpine, dockerfile: Dockerfile.alpine }
19+
- { php: '8.3', platform: debian, dockerfile: Dockerfile }
20+
- { php: '8.3', platform: alpine, dockerfile: Dockerfile.alpine }
21+
- { php: '8.4', platform: debian, dockerfile: Dockerfile }
22+
- { php: '8.4', platform: alpine, dockerfile: Dockerfile.alpine }
23+
- { php: '8.5', platform: debian, dockerfile: Dockerfile, tag: '8.5-rc' }
24+
- { php: '8.5', platform: alpine, dockerfile: Dockerfile.alpine, tag: '8.5-rc' }
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Build
29+
run: docker build -f ${{ matrix.dockerfile }} --build-arg PHP_VERSION=${{ matrix.tag || matrix.php }} -t ext-decimal .
30+
31+
- name: Test
32+
run: docker run --rm ext-decimal

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*~
1414
.#*
1515
.deps
16+
*.dep
1617
.idea
1718
.libs
1819
/include

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM php:8.2-cli
1+
ARG PHP_VERSION=8.4
2+
FROM php:${PHP_VERSION}-cli
23

34
RUN apt-get update && apt-get install -y \
45
libmpdec-dev \
@@ -8,9 +9,10 @@ WORKDIR /ext-decimal
89

910
COPY . .
1011

11-
RUN phpize \
12+
RUN phpize --clean > /dev/null 2>&1 || true \
13+
&& phpize \
1214
&& ./configure \
1315
&& make -j$(nproc) \
1416
&& make install
1517

16-
CMD ["make", "test", "TESTS=tests", "NO_INTERACTION=1"]
18+
CMD ["make", "test", "TESTS=tests", "NO_INTERACTION=1", "REPORT_EXIT_STATUS=1"]

Dockerfile.alpine

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ARG PHP_VERSION=8.4
2+
FROM php:${PHP_VERSION}-cli-alpine
3+
4+
RUN apk add --no-cache \
5+
mpdecimal-dev \
6+
gcc \
7+
make \
8+
autoconf \
9+
libc-dev
10+
11+
WORKDIR /ext-decimal
12+
13+
COPY . .
14+
15+
RUN phpize --clean > /dev/null 2>&1 || true \
16+
&& phpize \
17+
&& ./configure \
18+
&& make -j$(nproc) \
19+
&& make install
20+
21+
CMD ["make", "test", "TESTS=tests", "NO_INTERACTION=1", "REPORT_EXIT_STATUS=1"]

0 commit comments

Comments
 (0)