-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (40 loc) · 1.93 KB
/
unit-tests.yml
File metadata and controls
47 lines (40 loc) · 1.93 KB
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
46
name: Magento 2 Unit Tests
on: ['push', 'pull_request']
jobs:
unit-tests:
name: Magento 2 Unit Tests
runs-on: ubuntu-latest
container:
image: yireo/magento2installed:2.4.8-p3
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Detecting unit tests
run: |
test -d $GITHUB_WORKSPACE/Test/Unit || echo "SKIP_JOB=true" >> $GITHUB_ENV
- name: Setting up module variables
if: env.SKIP_JOB != 'true'
run: |
echo COMPOSER_NAME=`jq '.name' $GITHUB_WORKSPACE/composer.json -r` >> $GITHUB_ENV
echo MAGENTO_MODULE=`jq '.module_name' $GITHUB_WORKSPACE/MODULE.json -r` >> $GITHUB_ENV
- name: Configure GitLab
if: env.SKIP_JOB != 'true'
run: |
test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0
cd /tmp/magento
test -f $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh
test -f $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh
composer config --auth gitlab-token.gitlab.yireo.com ${{ secrets.GITLAB_TOKEN }}
composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
- name: Add module source
if: env.SKIP_JOB != 'true'
run: |
cp -R $GITHUB_WORKSPACE /tmp/magento/package-source
cd /tmp/magento
composer config repositories.local-source path package-source/
composer require --prefer-source -W -- $COMPOSER_NAME:@dev
- name: Run Magento 2 Unit Tests
if: env.SKIP_JOB != 'true'
run: |
cd /tmp/magento/dev/tests/unit/
php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml.dist ../../../vendor/$COMPOSER_NAME/Test/Unit