-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from alma/devx/setup_unit_tests
[DEX-420] Add support for unit tests, coverage, and CI
- Loading branch information
Showing
7 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run unit tests | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ARG COMPOSER_VERSION=2 | ||
ARG PLATFORM_VERSION=8.1.0 | ||
|
||
FROM composer:${COMPOSER_VERSION} AS composer | ||
FROM prestashop/prestashop:${PLATFORM_VERSION} | ||
|
||
ENV PS_ENABLE_SSL=1 | ||
|
||
# Change root password | ||
RUN echo 'root:alma' | chpasswd | ||
|
||
RUN pecl install xdebug-3.1.5 \ | ||
&& docker-php-ext-enable xdebug | ||
|
||
WORKDIR /var/www/html/modules/alma/ | ||
|
||
RUN head -n -1 /tmp/docker_run.sh > /tmp/docker_install.sh | ||
COPY ./scripts/entrypoint.sh /entrypoint.sh | ||
|
||
# Composer install | ||
COPY --from=composer /usr/bin/composer /usr/bin/composer | ||
COPY alma/composer.json . | ||
|
||
RUN composer install | ||
|
||
ENTRYPOINT ["bash", "/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ version: '3' | |
|
||
services: | ||
mysql: | ||
image: mysql:5.5 | ||
image: mysql:8.2 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=admin | ||
- MYSQL_DATABASE=prestashop | ||
|
@@ -12,9 +12,25 @@ services: | |
- 3307:3306 | ||
volumes: | ||
- "./tmp/db_data:/var/lib/mysql" | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD", | ||
"mysqladmin", | ||
"ping", | ||
"-p$$MYSQL_ROOT_PASSWORD" | ||
] | ||
timeout: 10s | ||
retries: 10 | ||
|
||
prestashop: | ||
image: prestashop/prestashop:1.6.1.23 | ||
build: | ||
context: . | ||
args: | ||
# We are not using version 8.x for now, as this will install with PHP 8.x. | ||
# This will then require a PHPUnit version that will be too high, requiring | ||
# updating prestashop/autoindex. | ||
PLATFORM_VERSION: 1.7.8.7 | ||
environment: | ||
- DB_SERVER=mysql | ||
- DB_NAME=prestashop | ||
|
@@ -32,8 +48,13 @@ services: | |
- PS_FOLDER_INSTALL=alminstall | ||
- [email protected] | ||
- ADMIN_PASSWD=test2test | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
ports: | ||
- "8080:80" | ||
# platform: linux/x86_64 | ||
volumes: | ||
- ./alma:/var/www/html/modules/alma | ||
- /var/www/html/modules/alma/vendor # do not mount vendor inside container | ||
- ./docker/php-customization.ini:/usr/local/etc/php/conf.d/php-customization.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
######################################## | ||
# Exit as soon as any line in the bash script fails. | ||
set -o errexit | ||
|
||
# pipefail: the return value of a pipeline is the status of the last command to exit with a non-zero status, or zero if no command exited with a non-zero status | ||
set -o pipefail | ||
|
||
bash /tmp/docker_install.sh | ||
|
||
exec "$@" |