Skip to content

Commit ec12d1d

Browse files
committed
Fix test stack
1 parent e356137 commit ec12d1d

7 files changed

Lines changed: 106 additions & 216 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
tests:
11-
name: PHP ${{ matrix.php }} Tests
11+
name: Tests (PHP ${{ matrix.php }})
1212
runs-on: ubuntu-latest
1313
strategy:
1414
fail-fast: false
@@ -19,28 +19,5 @@ jobs:
1919
- name: Checkout repository
2020
uses: actions/checkout@v4
2121

22-
- name: Setup PHP
23-
uses: shivammathur/setup-php@v2
24-
with:
25-
php-version: ${{ matrix.php }}
26-
extensions: swoole, sockets, protobuf, opentelemetry
27-
tools: composer:v2
28-
coverage: none
29-
30-
- name: Get Composer cache directory
31-
id: composer-cache
32-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
33-
34-
- name: Cache Composer dependencies
35-
uses: actions/cache@v4
36-
with:
37-
path: ${{ steps.composer-cache.outputs.dir }}
38-
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
39-
restore-keys: |
40-
${{ runner.os }}-php-${{ matrix.php }}-composer-
41-
42-
- name: Install dependencies
43-
run: composer update --prefer-dist --no-progress
44-
4522
- name: Run tests
46-
run: composer test
23+
run: PHP_VERSION=${{ matrix.php }} docker compose run --rm tests composer test

composer.lock

Lines changed: 21 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ services:
1212
networks:
1313
- telemetry
1414

15-
# PHP with Swoole for running tests
16-
# Usage: docker compose run --rm php composer test
17-
php:
15+
tests:
1816
build:
1917
context: .
2018
dockerfile: docker/Dockerfile
19+
args:
20+
PHP_VERSION: ${PHP_VERSION:-8.4}
2121
volumes:
2222
- .:/app
2323
- composer-cache:/root/.composer/cache

docker/Dockerfile

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
1-
FROM php:8.4-cli
1+
ARG PHP_VERSION=8.4
2+
FROM php:${PHP_VERSION}-cli-alpine
23

3-
# Install system dependencies
4-
RUN apt-get update && apt-get install -y \
4+
RUN apk add --no-cache \
55
git \
66
unzip \
7-
libssl-dev \
8-
libcurl4-openssl-dev \
9-
libprotobuf-dev \
10-
protobuf-compiler \
11-
&& rm -rf /var/lib/apt/lists/*
7+
openssl-dev \
8+
curl-dev \
9+
protobuf-dev \
10+
linux-headers \
11+
$PHPIZE_DEPS
1212

13-
# Install Swoole
14-
RUN pecl install swoole && docker-php-ext-enable swoole
13+
RUN pecl install opentelemetry protobuf swoole && \
14+
docker-php-ext-enable opentelemetry protobuf swoole
1515

16-
# Install protobuf extension
17-
RUN pecl install protobuf && docker-php-ext-enable protobuf
18-
19-
# Install OpenTelemetry extension
20-
RUN pecl install opentelemetry && docker-php-ext-enable opentelemetry
21-
22-
# Install sockets extension
2316
RUN docker-php-ext-install sockets
2417

25-
# Install Composer
2618
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
2719

28-
# Set working directory
2920
WORKDIR /app
3021

31-
# Copy composer files first for better caching
3222
COPY composer.json composer.lock ./
33-
34-
# Install dependencies
3523
RUN composer install --no-scripts --no-autoloader --prefer-dist
36-
37-
# Copy the rest of the application
3824
COPY . .
39-
40-
# Generate autoloader
41-
RUN composer dump-autoload --optimize
42-
43-
# Default command
44-
CMD ["php", "-v"]
25+
CMD ["tail", "-f", "/dev/null"]

0 commit comments

Comments
 (0)