Skip to content

Commit

Permalink
use compose
Browse files Browse the repository at this point in the history
  • Loading branch information
zeriyoshi committed Oct 2, 2023
1 parent 879fe9e commit dcda33d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 35 deletions.
16 changes: 4 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"name": "Pskel",
"build": {
"args": {
"IMAGE": "php",
"TAG": "8.2-cli"
}
},
"name": "colopl_timeshifter",
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -15,9 +9,7 @@
]
}
},
"context": "../",
"dockerFile": "../Dockerfile",
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
"workspaceFolder": "/usr/src/php/ext/extension",
"workspaceMount": "source=./ext,target=/usr/src/php/ext/extension,type=bind,consistency=cached"
"dockerComposeFile": "../compose.yaml",
"service": "dev",
"workspaceFolder": "/usr/src/php/ext/extension"
}
27 changes: 10 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,32 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
arch: ["amd64", "arm64v8", "s390x"]
version: ["8.0", "8.1", "8.2"]
arch: ["amd64", "arm64v8"]
version: ["8.1", "8.2"]
type: ["cli", "zts"]
distro: ["bullseye", "alpine"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: "arm64,s390x"
- name: Setup buildx
uses: docker/setup-buildx-action@v2
- name: Build container
uses: docker/build-push-action@v4
with:
build-args: |
IMAGE=${{ matrix.arch }}/php
TAG=${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}
PSKEL_SKIP_DEBUG=${{ matrix.arch != 'amd64' && '1' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
load: true
tags: "pskel-${{ matrix.arch }}-${{ matrix.type }}-${{ matrix.distro }}"
- name: Test extension
run: |
docker run --env TEST_EXTENSION=1 --rm -i pskel-${{ matrix.arch }}-${{ matrix.type }}-${{ matrix.distro }}
docker compose build --pull --no-cache --build-arg IMAGE=${{ matrix.arch }}/php --build-arg TAG=${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }} --build-arg PSKEL_SKIP_DEBUG=${{ matrix.arch != 'amd64' && '1' || '' }}
- name: Run tests
run: |
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION=1 dev
- name: Test extension with Valgrind
if: matrix.arch == 'amd64'
run: |
docker run --env TEST_EXTENSION_VALGRIND=1 --rm -i pskel-${{ matrix.arch }}-${{ matrix.type }}-${{ matrix.distro }}
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_VALGRIND=1 dev
- name: Test extension with MSAN
if: matrix.arch == 'amd64' && matrix.distro != 'alpine'
run: |
docker run --env TEST_EXTENSION_MSAN=1 --rm -i pskel-${{ matrix.arch }}-${{ matrix.type }}-${{ matrix.distro }}
docker compose run --rm --entrypoint=/usr/bin/ci --env TEST_EXTENSION_MSAN=1 dev
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ RUN if test -f "/etc/debian_version"; then \

WORKDIR "/usr/src/php"

COPY ./ci.sh /usr/bin/ci

ENTRYPOINT ["/usr/bin/ci"]

COPY ./ext /ext

COPY ./ci.sh /usr/bin/ci
9 changes: 7 additions & 2 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh -ex
#!/bin/sh -e

echo "[Pskel CI] BEGIN TEST"

if test "${TEST_EXTENSION}" != ""; then
cd "/ext"
Expand Down Expand Up @@ -29,10 +31,13 @@ if test "${TEST_EXTENSION_MSAN}" != ""; then
clang-debug-phpize
CC=clang CXX=clang++ CFLAGS="-fsanitize=memory -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=memory" ./configure --with-php-config=$(which clang-debug-php-config)
make clean
make -j$(nproc)
CFLAGS="-fsanitize=memory -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=memory" make -j$(nproc)
TEST_PHP_ARGS="--show-diff -q --msan" make test
else
echo "missing clang-debug-php"
exit 1
fi
fi

echo "[Pskel CI] END TEST"
exit 0
29 changes: 29 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.4'

services:
dev:
build:
context: ./
dockerfile: ./Dockerfile
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
privileged: true
volumes:
- ./ext:/usr/src/php/ext/extension:cached
tty: true
depends_on:
- mysql
command: ["sleep", "infinity"]
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: testing
MYSQL_DATABASE: testing
MYSQL_USER: testing
MYSQL_PASSWORD: testing
ports:
- "3306:3306"
volumes:
- ./docker/mysql/etc/mysql/conf.d/my.cnf:/etc/mysql/conf.d/my.cnf
2 changes: 2 additions & 0 deletions docker/mysql/etc/mysql/conf.d/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mysqld]
default-authentication-plugin=mysql_native_password

0 comments on commit dcda33d

Please sign in to comment.