-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'PrestaShop:main' into upgrade-auto-tests
- Loading branch information
Showing
3 changed files
with
361 additions
and
6 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,345 @@ | ||
name: Testing PrestaShop pull requests (without cache) | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr_number: | ||
description: Pull request Id | ||
required: true | ||
base_branch: | ||
type: choice | ||
description: Base branch to rebase the PR | ||
required: true | ||
options: | ||
- 'develop' | ||
- '8.1.x' | ||
- '8.0.x' | ||
- '1.7.8.x' | ||
default: 'develop' | ||
ps_mode_dev: | ||
type: choice | ||
description: Enable/Disable the developer mode | ||
required: true | ||
options: | ||
- 'true' | ||
- 'false' | ||
default: 'false' | ||
rebase_or_merge: | ||
type: choice | ||
required: true | ||
description: Rebase or merge the pull request | ||
options: | ||
- 'rebase' | ||
- 'merge' | ||
default: 'rebase' | ||
php_version: | ||
type: choice | ||
description: PHP version | ||
required: true | ||
options: | ||
- '7.3' | ||
- '7.4' | ||
- '8.0' | ||
- '8.1' | ||
- '8.2' | ||
default: '8.1' | ||
node_version: | ||
type: choice | ||
description: Node version | ||
required: true | ||
options: | ||
- '14.21.3' | ||
- '16.20.1' | ||
default: '14.21.3' | ||
backoffice_layout: | ||
type: choice | ||
description: Backoffice layout | ||
required: true | ||
options: | ||
- 'legacy' | ||
- 'symfony' | ||
default: 'legacy' | ||
|
||
jobs: | ||
testing-pr: | ||
runs-on: ubuntu-latest | ||
name: test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
TEST_COMMAND: | ||
- 'cldr' | ||
- 'functional:API' | ||
- 'functional:BO:login' | ||
- 'functional:BO:dashboard' | ||
- 'functional:BO:orders:01:0-1' | ||
- 'functional:BO:orders:01-create-orders' | ||
- 'functional:BO:orders:01-view-and-edit-order' | ||
- 'functional:BO:orders:02' | ||
- 'functional:BO:orders:03-05' | ||
- 'functional:BO:catalog:01-02' | ||
- 'functional:BO:catalog:03-04' | ||
- 'functional:BO:catalog:05-06' | ||
- 'functional:BO:catalog:07-08' | ||
- 'functional:BO:customer:01' | ||
- 'functional:BO:customer:02-03' | ||
- 'functional:BO:customer-service' | ||
- 'functional:BO:modules' | ||
- 'functional:BO:design' | ||
- 'functional:BO:shipping' | ||
- 'functional:BO:payment' | ||
- 'functional:BO:international:01' | ||
- 'functional:BO:international:02' | ||
- 'functional:BO:international:03-04' | ||
- 'functional:BO:shop-parameters:01-02' | ||
- 'functional:BO:shop-parameters:03-04' | ||
- 'functional:BO:shop-parameters:05-07' | ||
- 'functional:BO:advanced-parameters:01-06' | ||
- 'functional:BO:advanced-parameters:07-10' | ||
- 'functional:BO:advanced-parameters:11-12' | ||
- 'functional:BO:header' | ||
- 'functional:FO:01-03' | ||
- 'functional:FO:04-07' | ||
- 'functional:FO:08-12' | ||
- 'functional:FO:classic:01-03' | ||
- 'functional:FO:classic:04-07' | ||
- 'functional:FO:classic:08-12' | ||
- 'functional:FO:hummingbird:01-03' | ||
- 'functional:productV2' | ||
- 'functional:WS' | ||
- 'modules' | ||
- 'regression' | ||
- 'sanity' | ||
- 'sanity:productV2' | ||
BASE_BRANCH: | ||
- ${{ github.event.inputs.base_branch }} | ||
exclude: | ||
## 1.7.8.x | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'cldr' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:BO:advanced-parameters:11-12' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:BO:dashboard' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:productV2' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:API' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:FO:classic:01-03' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:FO:classic:04-07' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:FO:classic:08-12' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:FO:hummingbird:01-03' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'functional:WS' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'modules' | ||
- BASE_BRANCH: 1.7.8.x | ||
TEST_COMMAND: 'sanity:productV2' | ||
## 8.0.x | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'cldr' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:BO:advanced-parameters:11-12' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:BO:dashboard' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:productV2' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:API' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:FO:classic:01-03' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:FO:classic:04-07' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:FO:classic:08-12' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:FO:hummingbird:01-03' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'functional:WS' | ||
- BASE_BRANCH: 8.0.x | ||
TEST_COMMAND: 'modules' | ||
## 8.1.x | ||
- BASE_BRANCH: 8.1.x | ||
TEST_COMMAND: 'functional:BO:advanced-parameters:11-12' | ||
- BASE_BRANCH: 8.1.x | ||
TEST_COMMAND: 'functional:FO:01-03' | ||
- BASE_BRANCH: 8.1.x | ||
TEST_COMMAND: 'functional:FO:04-07' | ||
- BASE_BRANCH: 8.1.x | ||
TEST_COMMAND: 'functional:FO:08-12' | ||
## develop | ||
- BASE_BRANCH: develop | ||
TEST_COMMAND: 'functional:FO:01-03' | ||
- BASE_BRANCH: develop | ||
TEST_COMMAND: 'functional:FO:04-07' | ||
- BASE_BRANCH: develop | ||
TEST_COMMAND: 'functional:FO:08-12' | ||
- BASE_BRANCH: develop | ||
TEST_COMMAND: 'sanity:productV2' | ||
|
||
env: | ||
PR_NUMBER: ${{ github.event.inputs.pr_number }} | ||
BASE_BRANCH: ${{ github.event.inputs.base_branch }} | ||
PS_MODE_DEV: ${{ github.event.inputs.ps_mode_dev }} | ||
PHP_VERSION: ${{ github.event.inputs.php_version }} | ||
NODE_VERSION: ${{ github.event.inputs.node_version }} | ||
REBASE_OR_MERGE: ${{ github.event.inputs.rebase_or_merge }} | ||
PS_DIR: 'my_prestashop' | ||
## Install PrestaShop & UI Tests | ||
VERSION: ${{ github.event.inputs.php_version }}-apache | ||
PS_INSTALL_AUTO: 1 | ||
DB_PASSWD: prestashop | ||
DB_NAME: prestashop | ||
DB_SERVER: mysql | ||
DB_PREFIX: tst_ | ||
PS_DOMAIN: ${{ ((github.event.inputs.base_branch == '8.0.x') || (github.event.inputs.base_branch == '1.7.8.x')) && 'localhost:8001' || 'localhost:8002' }} | ||
PS_FOLDER_INSTALL: install-dev | ||
PS_FOLDER_ADMIN: admin-dev | ||
PS_COUNTRY: fr | ||
PS_LANGUAGE: en | ||
PS_DEV_MODE: ${{ github.event.inputs.ps_mode_dev == 'true' && '1' || '0' }} | ||
PS_ENABLE_SSL: ${{ ((github.event.inputs.base_branch == '8.0.x') || (github.event.inputs.base_branch == '1.7.8.x')) && '0' || '1' }} | ||
ADMIN_MAIL: '[email protected]' | ||
ADMIN_PASSWD: ${{ (github.event.inputs.base_branch == '1.7.8.x') && 'prestashop_demo' || 'Correct Horse Battery Staple' }} | ||
|
||
steps: | ||
- name: Print Inputs values | ||
shell: bash | ||
run: echo "${{ toJSON(github.event.inputs) }}" | ||
|
||
# Checkout the repository | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: main | ||
|
||
# Checkout PrestaShop | ||
- uses: actions/checkout@v3 | ||
name: Checkout PrestaShop repository | ||
with: | ||
fetch-depth: 0 | ||
repository: PrestaShop/PrestaShop | ||
path: ${{ env.PS_DIR }} | ||
|
||
- name: Config git | ||
run: | | ||
git config --local user.email "$(git log --format='%ae' HEAD^!)" | ||
git config --local user.name "$(git log --format='%an' HEAD^!)" | ||
working-directory: ${{ env.PS_DIR }} | ||
|
||
# Get the PR | ||
- name: Get pull request | ||
working-directory: ${{ env.PS_DIR }} | ||
run: | | ||
git fetch origin pull/${{ env.PR_NUMBER }}/head:pr${{ env.PR_NUMBER }} | ||
git checkout pr${{ env.PR_NUMBER }} | ||
- name: Rebase | ||
working-directory: ${{ env.PS_DIR }} | ||
if: ${{ env.REBASE_OR_MERGE == 'rebase' }} | ||
run: | | ||
git fetch origin ${{ env.BASE_BRANCH }}:${{ env.BASE_BRANCH }} | ||
git rebase origin/${{ env.BASE_BRANCH }} | ||
- name: Merge | ||
working-directory: ${{ env.PS_DIR }} | ||
if: ${{ env.REBASE_OR_MERGE == 'merge' }} | ||
run: | | ||
git fetch origin ${{ env.BASE_BRANCH }}:${{ env.BASE_BRANCH }} | ||
git merge origin/${{ env.BASE_BRANCH }} | ||
# Certificate | ||
- name: Generate a certificate | ||
if: (env.BASE_BRANCH == '8.1.x') || (env.BASE_BRANCH == 'develop') | ||
run: | | ||
## Install MkCert | ||
sudo apt install libnss3-tools | ||
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" | ||
chmod +x mkcert-v*-linux-amd64 | ||
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert | ||
## Generate certificate | ||
mkcert -key-file ./${{ env.PS_DIR }}/.docker/ssl.key -cert-file ./${{ env.PS_DIR }}/.docker/ssl.crt localhost | ||
## Link certificate to Chrome Trust Store | ||
mkdir -p $HOME/.pki/nssdb | ||
certutil -d $HOME/.pki/nssdb -N | ||
certutil -d sql:$HOME/.pki/nssdb -n localhost -A -t "TCu,Cu,Tu" -i ./${{ env.PS_DIR }}/.docker/ssl.crt | ||
## Add self-signed certificate to Chrome Trust Store | ||
mkcert -install | ||
# Workaround until https://github.com/PrestaShop/PrestaShop/issues/29813 is fixed | ||
- name: PrestaShop Configuration (Copy of Config API) | ||
if: (env.BASE_BRANCH == '8.1.x') || (env.BASE_BRANCH == 'develop') | ||
run: cp ./${{ env.PS_DIR }}/app/config/security_test.yml ./${{ env.PS_DIR }}/app/config/security_prod.yml | ||
|
||
- name: Adapt Back Office layout | ||
if: inputs.backoffice_layout == 'symfony' | ||
working-directory: ${{ env.PS_DIR }} | ||
shell: bash | ||
run: | | ||
echo PS_FF_SYMFONY_LAYOUT=true >> .env | ||
# Create shop with Docker | ||
- name: Build and run shop with docker | ||
working-directory: ${{ env.PS_DIR }} | ||
timeout-minutes: 15 | ||
env: | ||
DISABLE_MAKE: 0 | ||
URL_FO: ${{ ((github.event.inputs.base_branch == '8.0.x') || (github.event.inputs.base_branch == '1.7.8.x')) && 'http://localhost:8001/' || 'https://localhost:8002/' }} | ||
VERSION: ${{ (github.event.inputs.base_branch == '1.7.8.x') && github.event.inputs.php_version || env.VERSION }} | ||
run: | | ||
USER_ID=$(id -u) GROUP_ID=$(id -g) \ | ||
docker-compose -f docker-compose.yml up -d --build | ||
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} ${{ env.URL_FO }}en/)" != "200" ]]; do sleep 5; done' | ||
# UI Tests : Setup, Install & Execute | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Setup NPM | ||
run: npm install -g npm@7 | ||
|
||
- name: Install tests dependencies | ||
working-directory: '${{ env.PS_DIR }}/tests/UI' | ||
run: npm install | ||
|
||
# Playwright must be installed all the time, we only install chromium since it's the only browser used | ||
- name: Install browsers | ||
working-directory: ${{ env.PS_DIR }}/tests/UI | ||
if: ${{ env.BASE_BRANCH == '8.0.x' || env.BASE_BRANCH == '8.1.x' }} | ||
run: npx playwright install chromium | ||
|
||
- name: Install browsers | ||
if: (env.BASE_BRANCH == 'develop') | ||
working-directory: ${{ env.PS_DIR }}/tests/UI | ||
run: npx playwright install chrome-beta | ||
|
||
- name: Run tests | ||
id: runTests | ||
run: | | ||
export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" | ||
npm run test:${{ matrix.TEST_COMMAND }} | ||
working-directory: '${{ env.PS_DIR }}/tests/UI' | ||
env: | ||
URL_FO: ${{ ((github.event.inputs.base_branch == '8.0.x') || (github.event.inputs.base_branch == '1.7.8.x')) && 'http://localhost:8001/' || 'https://localhost:8002/' }} | ||
DB_NAME: prestashop | ||
DB_PASSWD: prestashop | ||
HEADLESS: true | ||
ENABLE_SSL: true | ||
TAKE_SCREENSHOT_AFTER_FAIL: true | ||
SMTP_SERVER: '172.17.0.1' | ||
|
||
# UI Tests : Upload screenshots | ||
- run: echo "SCREENSHOT_CAMPAIGN=$( echo -e '${{ matrix.TEST_COMMAND }}' | tr ':' '-' )" >> $GITHUB_ENV | ||
if: failure() && steps.runTests.outcome == 'failure' | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: failure() && steps.runTests.outcome == 'failure' | ||
with: | ||
name: campaign-${{ env.SCREENSHOT_CAMPAIGN }} | ||
path: | | ||
${{ env.PS_DIR }}/tests/UI/screenshots/ | ||
${{ env.PS_DIR }}/var/logs |
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