Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Freoua-Alma committed Jan 5, 2024
2 parents 65d64f5 + d40d058 commit 4ad4d9f
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 9 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Aqua
on:
pull_request:
branches:
- main

jobs:
aqua:
name: Aqua scanner
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Aqua scanner
uses: docker://aquasec/aqua-scanner
with:
args: trivy fs --sast --reachability --scanners config,vuln,secret .
# To customize which severities add the following flag: --severity UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
# To enable SAST scanning, add: --sast
# To enable reachability scanning, add: --reachability
# To enable npm/dotnet non-lock file scanning, add: --package-json / --dotnet-proj
env:
AQUA_KEY: ${{ secrets.AQUA_KEY }}
AQUA_SECRET: ${{ secrets.AQUA_SECRET }}
GITHUB_TOKEN: ${{ github.token }}
AQUA_URL: https://api.eu-1.supply-chain.cloud.aquasec.com
CSPM_URL: https://eu-1.api.cloudsploit.com
TRIVY_RUN_AS_PLUGIN: "aqua"
# For http/https proxy configuration add env vars: HTTP_PROXY/HTTPS_PROXY, CA-CRET (path to CA certificate)
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
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
26 changes: 26 additions & 0 deletions Dockerfile
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"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ crowdin-download:
.PHONY: crowdin-upload
crowdin-upload:
crowdin upload sources

.PHONY: test
test:
docker compose build prestashop
docker compose run --rm prestashop ./vendor/bin/phpunit -c phpunit.ci.xml --coverage-text
12 changes: 7 additions & 5 deletions alma/phpunit.ci.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
</logging>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>./tests/Unit/Helper/</directory>
<whitelist includeUncoveredFilesFromWhitelist="true">
<directory>../alma</directory>
<exclude>
<directory>../alma/vendor</directory>
</exclude>
</whitelist>
</filter>

</phpunit>
25 changes: 23 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
mysql:
image: mysql:5.5
image: mysql:8.2
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=prestashop
Expand All @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions docker/php-customization.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ max_input_vars=5000

display_errors=1

;[xdebug]
[xdebug]
xdebug.mode=develop,coverage
;; comment out this line to disable xdebug
;zend_extension=xdebug.so
;xdebug.mode=develop
;xdebug.remote_enable=1
;xdebug.remote_autostart=1
;xdebug.log=/var/log/xdebug.log
Expand Down
12 changes: 12 additions & 0 deletions scripts/entrypoint.sh
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 "$@"

0 comments on commit 4ad4d9f

Please sign in to comment.