-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (38 loc) · 2.27 KB
/
unit-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Unit Tests
# This makes sure that the tests are run on every push. See this page for more options:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
on: push
jobs:
build:
strategy:
# This Matrix will run the tests on PHP 7.0, 7.1 and 7.2 and on Magento 2.2.11 and 2.3.5-p1.
# Magento 2.3.5-p1 requires PHP 7.1 and higher, so PHP 7.0 is disabled for this version.
# Magento 2.2.11 supports PHP up to version 7.1, so PHP 7.2 is disabled for this version.
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-p1
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.5-p1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Download the correct Docker image with the correct Magento & PHP version for this specific run.
- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}
# Create separate branch and remove version from `composer.json`.
- name: Create branch for Composer and remove version from composer.json
run: git checkout -b unit-test-branch && sed -i '/version/d' ./composer.json
# If your code is not in the root but in a subdirecty you need to change this command.
# Example: If your code is in the `src` folder then you need to do this:
# run: docker cp $(pwd)/src magento-project-community-edition:/data/extensions/
- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/
# Replace <VENDOR> and <MODULE> with the name in your `composer.json`.
- name: Install the extension in Magento
run: docker exec magento-project-community-edition composer require cmdotcom-plugins/magento2-payments:dev-unit-test-branch
# Only the tests in your repository will be run, the default Magento tests are not included in this.
- name: Run tests
run: docker exec magento-project-community-edition bash -c "vendor/bin/phpunit extensions/${{ github.event.repository.name }}/Test/Unit"