Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new testing solution #58

Merged
merged 21 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Lint code

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
lint:
runs-on: github-actions-runner-emarsys
permissions:
contents: "read"
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Checkout code
shell: bash
run: |
sudo apt-get update
sudo apt-get install git -y
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
- name: Login to GitLab
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.GITLAB_USER }}
password: ${{ secrets.GITLAB_TOKEN }}
- name: Run codesniffer
shell: bash
run: |
cd magento2-extension
sh dev/testv2/tools/scripts/run-code-style.sh
env:
VERSION: 2.4.0ce
# - name: Run eslint
# shell: bash
# run: |
# cd magento2-extension
# docker run --rm -v $(pwd)/dev/testv2:/test -e NPM_TOKEN=${NPM_TOKEN} "${{ vars.REGISTRY_URL }}/itg-commerce/emarsys-magento2-extension-test/mage_node" sh -c "npm i && ./node_modules/.bin/cypress install && ./node_modules/.bin/cypress verify && npm run code-style"
# env:
# NPM_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }}
28 changes: 0 additions & 28 deletions .github/workflows/run-test.yml

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
name: Test

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
unit-tests:
runs-on: github-actions-runner-emarsys
permissions:
contents: "read"
strategy:
max-parallel: 2
fail-fast: false
matrix:
magento-versions:
["2.3.3ce", "2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Checkout code
shell: bash
run: |
sudo apt-get update
sudo apt-get install git -y
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
- name: Login to GitLab
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.GITLAB_USER }}
password: ${{ secrets.GITLAB_TOKEN }}
- name: Install system tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-compose-plugin -y
- name: Run unittest
shell: bash
run: |
cd magento2-extension
bash dev/testv2/tools/scripts/run-unit.sh
env:
VERSION: ${{ matrix.magento-versions }}
e2e-tests:
runs-on: github-actions-runner-emarsys
permissions:
contents: "read"
strategy:
max-parallel: 2
fail-fast: false
matrix:
magento-versions:
["2.3.3ce", "2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Checkout code
shell: bash
run: |
sudo apt-get update
sudo apt-get install git -y
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
- name: Login to GitLab
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.GITLAB_USER }}
password: ${{ secrets.GITLAB_TOKEN }}
- name: Install system tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-compose-plugin -y
- name: Run e2stest
shell: bash
run: |
cd magento2-extension
bash dev/testv2/tools/scripts/run-e2e.sh
env:
VERSION: ${{ matrix.magento-versions }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
!dev/jenkins/.env
!dev/testv2/tools/setup/.env
dev/db-data/
dev/test/node_modules
codeship.aes
Expand Down
49 changes: 49 additions & 0 deletions dev/testv2/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"root": true,
"extends": [
"emarsys"
],
"plugins": [
"mocha"
],
"env": {
"es6": true,
"node": true,
"mocha": true,
"browser": true
},
"globals": {
"inject": true,
"onmessage": true,
"expect": true,
"describe": true
},
"parserOptions": {
"ecmaVersion": 9
},
"rules": {
"curly": [2, "multi-line"],
"new-cap": 0,
"no-unused-expressions": 0,
"operator-linebreak": "off",
"require-yield": 0,
"security/detect-child-process": 0,
"security/detect-non-literal-fs-filename": 0,
"security/detect-non-literal-require": 0,
"security/detect-object-injection": 0,
"space-before-function-paren": 0,
// TODO
"indent": "off",
"object-curly-spacing": 0,
"one-var": 0,
"dot-notation": 0,
"comma-dangle": 0,
"semi": 0,
"key-spacing": 0,
"max-len": 0,
"strict": 0,
"quotes": 0,
"no-unused-vars": 0,
"no-undef": 0
}
}
5 changes: 5 additions & 0 deletions dev/testv2/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "none"
}
Loading