Skip to content

Commit 162d443

Browse files
committed
add a CI
1 parent 87595d1 commit 162d443

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build Docker image
16+
run: docker build -t ci-image -f config/docker/php/Dockerfile --target ci .
17+
18+
- name: Run PHPUnit tests
19+
run: docker run --rm ci-image ./vendor/bin/phpunit

config/docker/php/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ COPY config/docker/php/conf.d/*.ini /usr/local/etc/php/conf.d/
88

99
RUN docker-php-ext-install zip
1010

11-
FROM php-installed
12-
1311
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
1412
ENV COMPOSER_ALLOW_SUPERUSER=1
1513

1614
RUN mkdir -p /app/var/cache
1715
WORKDIR /app
1816

17+
FROM php-installed AS ci
18+
COPY composer.json composer.lock ./
19+
RUN composer install --prefer-dist --no-progress
20+
COPY . .
21+
22+
FROM php-installed AS dev
23+
RUN pecl install xdebug && docker-php-ext-enable xdebug
1924

2025

2126
## install and cache composer dependencies

docker-compose.dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
services:
22
php:
3+
build:
4+
target: dev
35
volumes:
46
- ./:/app

0 commit comments

Comments
 (0)