added local test env using docker
This commit is contained in:
parent
a548d1fe0f
commit
6f3b7427e0
4 changed files with 50 additions and 6 deletions
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
FROM php:7.4-alpine3.13
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Git, NPM & needed libraries
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add bash git nodejs npm gettext subversion mysql mysql-client zip \
|
||||||
|
&& rm -f /var/cache/apk/*
|
||||||
|
|
||||||
|
RUN docker-php-ext-install mysqli
|
||||||
|
|
||||||
|
# Install Composer
|
||||||
|
RUN EXPECTED_CHECKSUM=$(curl -s https://composer.github.io/installer.sig) \
|
||||||
|
&& curl https://getcomposer.org/installer -o composer-setup.php \
|
||||||
|
&& ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" \
|
||||||
|
&& if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then >&2 echo 'ERROR: Invalid installer checksum'; rm composer-setup.php; exit 1; fi \
|
||||||
|
&& php composer-setup.php --quiet \
|
||||||
|
&& php -r "unlink('composer-setup.php');" \
|
||||||
|
&& mv composer.phar /usr/local/bin/composer
|
||||||
|
|
||||||
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
||||||
|
chmod +x wp-cli.phar && \
|
||||||
|
mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
RUN chmod +x -R ./
|
|
@ -32,10 +32,10 @@
|
||||||
"installer-name": "activitypub"
|
"installer-name": "activitypub"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": [
|
"test": [
|
||||||
"composer install",
|
"composer install",
|
||||||
"bin/install-wp-tests.sh wordpress wordpress wordpress",
|
"bin/install-wp-tests.sh activitypub-test root activitypub-test test-db latest true",
|
||||||
"vendor/bin/phpunit"
|
"vendor/bin/phpunit"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
docker-compose-test.yml
Normal file
17
docker-compose-test.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
test-db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: activitypub-test
|
||||||
|
MYSQL_ROOT_PASSWORD: activitypub-test
|
||||||
|
|
||||||
|
test-php:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
links:
|
||||||
|
- test-db
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
command: ["composer", "run-script", "test"]
|
|
@ -7,7 +7,7 @@
|
||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite>
|
<testsuite name="ActivityPub">
|
||||||
<directory prefix="test-" suffix=".php">./tests/</directory>
|
<directory prefix="test-" suffix=".php">./tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
Loading…
Reference in a new issue