Skip to content

Commit c6e7ac0

Browse files
author
Sanyi
committed
EMA-150 auto test memory optimizing
1 parent bf12617 commit c6e7ac0

File tree

1 file changed

+21
-90
lines changed

1 file changed

+21
-90
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,36 @@ on:
77
- "*"
88

99
jobs:
10-
build-image:
10+
build-and-run-test:
1111
runs-on: github-actions-runner-emarsys
1212
permissions:
1313
contents: "read"
14+
strategy:
15+
max-parallel: 1
16+
fail-fast: false
17+
matrix:
18+
magento-versions:
19+
["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
1420
steps:
21+
- name: Extract branch name
22+
shell: bash
23+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
24+
id: extract_branch
25+
1526
- name: Checkout code
1627
shell: bash
1728
run: |
1829
sudo apt-get update
1930
sudo apt-get install git -y
20-
git clone https://github.com/emartech/magento2-extension.git
31+
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
32+
2133
- name: Login to GitLab
2234
uses: docker/login-action@v3
2335
with:
2436
registry: ${{ vars.REGISTRY_URL }}
2537
username: ${{ secrets.GITLAB_USER }}
2638
password: ${{ secrets.GITLAB_TOKEN }}
39+
2740
- name: Install system tools
2841
shell: bash
2942
run: |
@@ -38,111 +51,29 @@ jobs:
3851
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
3952
sudo apt-get update
4053
sudo apt-get install docker-compose-plugin docker-buildx-plugin -y
54+
4155
- name: Build mage_node image
4256
shell: bash
4357
run: |
4458
cd magento2-extension/dev
45-
DOCKER_BUILDKIT=1 docker build -f testv2/tools/docker/Dockerfile-mage-node --build-arg NPM_TOKEN=$NPM_TOKEN -t "mage_node:latest" .
59+
DOCKER_BUILDKIT=1 docker build -f testv2/tools/docker/Dockerfile-mage-node --build-arg NPM_TOKEN=$NPM_TOKEN -t "mage_node" .
4660
env:
4761
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}
48-
- name: Save mage_node image
49-
shell: bash
50-
run: |
51-
docker save mage_node:latest | gzip > mage_node_latest.tar.gz
52-
- name: Upload mage_node image
53-
uses: actions/upload-artifact@v3
54-
with:
55-
name: mage_node_image
56-
path: mage_node_latest.tar.gz
5762

58-
unit-tests:
59-
runs-on: github-actions-runner-emarsys
60-
needs: build-image
61-
permissions:
62-
contents: "read"
63-
strategy:
64-
max-parallel: 1
65-
fail-fast: false
66-
matrix:
67-
magento-versions:
68-
["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
69-
steps:
70-
- name: Extract branch name
71-
shell: bash
72-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
73-
id: extract_branch
74-
- name: Checkout code
75-
shell: bash
76-
run: |
77-
sudo apt-get update
78-
sudo apt-get install git -y
79-
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
80-
- name: Login to GitLab
81-
uses: docker/login-action@v3
82-
with:
83-
registry: ${{ vars.REGISTRY_URL }}
84-
username: ${{ secrets.GITLAB_USER }}
85-
password: ${{ secrets.GITLAB_TOKEN }}
86-
- name: Download mage_node image
87-
uses: actions/download-artifact@v3
88-
with:
89-
name: mage_node_image
90-
path: .
91-
- name: Load mage_node image
92-
shell: bash
93-
run: |
94-
gunzip -c mage_node_latest.tar.gz | docker load
95-
- name: Run unittest
63+
- name: Run unit tests
9664
shell: bash
9765
run: |
9866
cd magento2-extension
99-
bash dev/testv2/tools/scripts/run-unit.sh
67+
docker run -e VERSION=${{ matrix.magento-versions }} -e NPM_TOKEN=${{ secrets.GITLAB_TOKEN }} mage_node bash dev/testv2/tools/scripts/run-unit-tests.sh
10068
env:
10169
VERSION: ${{ matrix.magento-versions }}
10270
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}
10371

104-
e2e-tests:
105-
runs-on: github-actions-runner-emarsys
106-
needs: [build-image, unit-tests]
107-
permissions:
108-
contents: "read"
109-
strategy:
110-
max-parallel: 1
111-
fail-fast: false
112-
matrix:
113-
magento-versions:
114-
["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
115-
steps:
116-
- name: Extract branch name
117-
shell: bash
118-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
119-
id: extract_branch
120-
- name: Checkout code
121-
shell: bash
122-
run: |
123-
sudo apt-get update
124-
sudo apt-get install git -y
125-
git clone --branch ${{ steps.extract_branch.outputs.branch }} https://github.com/emartech/magento2-extension.git
126-
- name: Login to GitLab
127-
uses: docker/login-action@v3
128-
with:
129-
registry: ${{ vars.REGISTRY_URL }}
130-
username: ${{ secrets.GITLAB_USER }}
131-
password: ${{ secrets.GITLAB_TOKEN }}
132-
- name: Download mage_node image
133-
uses: actions/download-artifact@v3
134-
with:
135-
name: mage_node_image
136-
path: .
137-
- name: Load mage_node image
138-
shell: bash
139-
run: |
140-
gunzip -c mage_node_latest.tar.gz | docker load
141-
- name: Run e2etest
72+
- name: Run e2e tests
14273
shell: bash
14374
run: |
14475
cd magento2-extension
145-
docker run --rm -e NPM_TOKEN=${{ secrets.GITLAB_TOKEN }} -e VERSION=${{ matrix.magento-versions }} -v $(pwd)/dev/testv2/tools/scripts:/scripts mage_node:latest bash /scripts/run-e2e.sh
76+
docker run -e VERSION=${{ matrix.magento-versions }} -e NPM_TOKEN=${{ secrets.GITLAB_TOKEN }} mage_node bash dev/testv2/tools/scripts/run-e2e.sh
14677
env:
14778
VERSION: ${{ matrix.magento-versions }}
14879
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}

0 commit comments

Comments
 (0)