fix: Allow admin component to define acl_resource for added security
#150
This file contains hidden or 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
| 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: Cleanup PHP | |
| if: env.SKIP_JOB != 'true' | |
| run: | | |
| test -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini || true | |
| - 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 | |
| composer config --auth gitlab-token.gitlab.yireo.com "${{ secrets.GITLAB_TOKEN }}" | |
| composer config repositories.loki-third-party composer https://gitlab.yireo.com/api/v4/group/loki-third-party/-/packages/composer/packages.json | |
| composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json | |
| composer config repositories.loki-checkout-dev composer https://gitlab.yireo.com/api/v4/group/loki-checkout-dev/-/packages/composer/packages.json | |
| - name: Configure Magento Marketplace | |
| if: env.SKIP_JOB != 'true' | |
| run: | | |
| test -n "${{ secrets.MAGENTO_MARKETPLACE_PUBLIC_KEY }}" || exit 0 | |
| composer config --global --auth http-basic.repo.magento.com "${{ secrets.MAGENTO_MARKETPLACE_PUBLIC_KEY }}" "${{ secrets.MAGENTO_MARKETPLACE_PRIVATE_KEY }}" | |
| - name: Configure composer | |
| if: env.SKIP_JOB != 'true' | |
| run: | | |
| cd /tmp/magento | |
| composer config --global --auth github-oauth.github.com "${{ secrets.COMPOSER_GITHUB_TOKEN }}" | |
| test -f $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh || true | |
| test -f $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh || true | |
| - 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 -n --prefer-source -- $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=-1 ../../../vendor/bin/phpunit -c phpunit.xml.dist ../../../vendor/$COMPOSER_NAME/Test/Unit | |