generated from integer-net/magento2-module-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from integer-net/phpunit-action
Refactor Github Actions
- Loading branch information
Showing
12 changed files
with
163 additions
and
152 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
phpstan: | ||
|
||
name: PHPStan Static Analysis | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer global config http-basic.repo.magento.com ${{ secrets.MAGENTO_MARKETPLACE_USERNAME }} ${{ secrets.MAGENTO_MARKETPLACE_PASSWORD }} && composer install --prefer-dist --no-progress | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan --no-progress | ||
|
||
unit-tests: | ||
|
||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl | ||
coverage: xdebug | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer global config http-basic.repo.magento.com ${{ secrets.MAGENTO_MARKETPLACE_USERNAME }} ${{ secrets.MAGENTO_MARKETPLACE_PASSWORD }} && composer install --prefer-dist --no-progress | ||
|
||
- name: Run test suite | ||
run: composer test | ||
|
||
- name: Upload Unit Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Unit Test Results | ||
path: var/test-results/unit.xml | ||
|
||
integration-tests: | ||
name: Magento 2 Integration Tests | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306:3306 | ||
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
es: | ||
image: docker.io/wardenenv/elasticsearch:7.8 | ||
ports: | ||
- 9200:9200 | ||
env: | ||
'discovery.type': single-node | ||
'xpack.security.enabled': false | ||
ES_JAVA_OPTS: "-Xms64m -Xmx512m" | ||
options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: M2 Integration Tests with Magento 2 (Php7.4) | ||
uses: extdn/github-actions-m2/magento-integration-tests/7.4@master | ||
with: | ||
module_name: IntegerNet_ShippingPreselection | ||
composer_name: integer-net/magento2-shippingpreselection | ||
ce_version: '2.4.3' | ||
phpunit_file: .github/phpunit9-integration.xml | ||
- name: Upload Integration Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Integration Test Results | ||
path: var/test-results/integration.xml | ||
|
||
phpmd: | ||
name: Magento 2 Mess Detector | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: extdn/github-actions-m2/magento-mess-detector@master | ||
|
||
publish-test-results: | ||
name: "Publish Tests Results" | ||
needs: | ||
- unit-tests | ||
- integration-tests | ||
runs-on: ubuntu-latest | ||
if: always() | ||
|
||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: artifacts | ||
|
||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v1 | ||
with: | ||
files: artifacts/**/*.xml | ||
|
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/composer.lock | ||
/tests/phpunit.xml | ||
.phpunit.result.cache | ||
/var |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
parameters: | ||
level: 6 | ||
level: 1 | ||
paths: | ||
- src | ||
- tests | ||
ignoreErrors: | ||
- '#(class|type) Magento\\TestFramework#i' | ||
- '#(class|type) Magento\\\S*Factory#i' | ||
- '#(method) Magento\\Framework\\Api\\ExtensionAttributesInterface#i' | ||
bootstrapFiles: | ||
- vendor/bitexpert/phpstan-magento/autoload.php | ||
magento: | ||
# usually not recommended to disable ;-) | ||
checkServiceContracts: false | ||
includes: | ||
- vendor/bitexpert/phpstan-magento/extension.neon |