-
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.
Add support for unit tests, coverage, and CI
- Loading branch information
1 parent
f5d6d0e
commit 2897437
Showing
8 changed files
with
129 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,71 @@ | ||
--- | ||
name: E2E Test | ||
on: | ||
pull_request: | ||
branches: ["main", "develop"] | ||
types: ["opened", "synchronize", "reopened", "ready_for_review"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
launch: | ||
strategy: | ||
matrix: | ||
version: | ||
- 1.7.8.7 | ||
#- 1.7.7.5 | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- name: Get only last part of branch name in $SLUG_VERSION env var | ||
run: | | ||
VERSION=${{ matrix.version }} | ||
echo "SLUG_VERSION=${VERSION//./-}" >> $GITHUB_ENV | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/[email protected] | ||
continue-on-error: true | ||
with: | ||
app_id: ${{ secrets.ALMA_UPDATE_CHECKS_APP_ID }} | ||
private_key: ${{ secrets.ALMA_UPDATE_CHECKS_APP_PEM }} | ||
|
||
- uses: LouisBrunner/[email protected] | ||
id: e2e_status | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
name: E2E Test / result (${{ matrix.version }}) | ||
status: "in_progress" | ||
|
||
- name: Generate Github token for integration-infrastructure repo | ||
id: generate_github_token_integration_infrastructure | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{ secrets.ALMA_WF_TRIGGER_APP_ID }} | ||
private_key: ${{ secrets.ALMA_WF_TRIGGER_APP_PEM }} | ||
installation_id: ${{ secrets.ALMA_WF_TRIGGER_INSTALLATION_ID }} | ||
repository: alma/integration-infrastructure | ||
|
||
- name: Invoke e2e workflow with inputs | ||
uses: benc-uk/[email protected] | ||
with: | ||
workflow: Deploy CMS | ||
token: ${{ steps.generate_github_token_integration_infrastructure.outputs.token }} | ||
repo: alma/integration-infrastructure | ||
ref: main | ||
inputs: > | ||
{ | ||
"name": "e2e-${{ github.run_id }}", | ||
"alma_plugin_branch": "${{ github.head_ref || github.ref_name }}", | ||
"alma_plugin_test_branch" : "main", | ||
"cms": "prestashop-${{ matrix.version }}", | ||
"e2e": "true", | ||
"e2e_check_id": "${{ steps.e2e_status.outputs.check_id }}", | ||
"e2e_check_origin" : "${{ github.repository }}" | ||
} | ||
- uses: LouisBrunner/[email protected] | ||
if: failure() | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
check_id: ${{ steps.e2e_status.outputs.check_id }} | ||
conclusion: failure |
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
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 |
---|---|---|
|
@@ -14,7 +14,13 @@ services: | |
- "./tmp/db_data:/var/lib/mysql" | ||
|
||
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 +38,11 @@ services: | |
- PS_FOLDER_INSTALL=alminstall | ||
- [email protected] | ||
- ADMIN_PASSWD=test2test | ||
depends_on: | ||
- mysql | ||
ports: | ||
- "8080:80" | ||
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,5 @@ | ||
#!/bin/bash | ||
|
||
bash /tmp/docker_install.sh | ||
|
||
exec "$@" |