Skip to content

Commit

Permalink
OXDEV-7845 Run with light universal workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Apr 25, 2024
1 parent 1c2be6c commit 33bf26a
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 138 deletions.
69 changes: 69 additions & 0 deletions .github/oxid-esales/module-medialibrary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# {{ $ids := "ddoemedialibrary" }}ids: {{ $ids }}
# {{ $org := "oxid-esales" }}organisation: {{ $org }}
# {{ $name := "media-library-module" }}name: {{ $name }}
# {{ $repo := "OXID-eSales/media-library-module" }}repo: {{ $repo }}

install_shop_with_modules:
cache:
prepared_shop: false
composer:
transform: |
{
"require": {
"oxid-esales/oxideshop-ce": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/twig-admin-theme": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/apex-theme": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/developer-tools": "{{ .Data.global.composer.dev_ref }}",
"{{ $org }}/{{ $name }}": "dev-{{ .Github.RefName }}"
},
"repositories": {
"{{ $org }}/{{ $name }}": {
"type": "git",
"url": "https://github.com/{{ $repo }}.git"
},
"oxid-esales/developer-tools": {
"type": "git",
"url": "https://github.com/OXID-eSales/developer-tools.git"
}
}
}
custom_script_container: |
vendor/bin/oe-console oe:database:reset --db-host=mysql --db-port=3306 --db-name=example --db-user=root --db-password=root --force
vendor/bin/oe-console oe:module:activate "{{ $ids }}"
vendor/bin/oe-console oe:theme:activate apex
runscript: &runscript
matrix:
script: |
[
"medialibrary:tests-unit",
"medialibrary:tests-integration"
]
medialibrary:
path: 'vendor/{{ $org}}/{{ $name }}'

runslim:
<<: *runscript
matrix:
script: |
[
"medialibrary:phpstan",
"medialibrary:phpcs",
]
sonarcloud:
matrix:
testplan: '["-"]'
strip_path: '/var/www/vendor/{{ print $org }}/{{ print $name}}/'
project_key: 'OXID-eSales_{{ print $name }}'
project_name: '{{ $org}}/{{ $name }}'
parameters: |
-Dsonar.language=php
-Dsonar.scm.provider=git
-Dsonar.sources=src
-Dsonar.tests=tests
-Donar.php.phpstan.reportPaths=coverage-reports/phpstan.report.json
finish:
slack_title: '{{ print $name }} ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'
33 changes: 0 additions & 33 deletions .github/workflows/dispatch_dev_module.yml

This file was deleted.

59 changes: 40 additions & 19 deletions .github/workflows/dispatch_module.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
name: Manual stable trigger
# Matrix workflow using re-usable github actions
name: Manual trigger

on:
workflow_dispatch:
inputs:
testplan:
type: string
required: true
description: 'URL/PATH of the testplan to run'
default: 'tests/github_actions/defaults/7.1.x.yml,tests/github_actions/module-medialibrary.yml'
runs_on:
type: string
description: 'JSON string/array describing the runner'
required: true
default: '"ubuntu-latest"'
limit:
type: choice
options:
- 'no'
- 'PHP8.1/MySQL5.7'
- 'PHP8.1/MySQL8.0'
- 'PHP8.2/MySQL5.7'
- 'PHP8.2/MySQL8.0'
default: 'PHP8.1/MySQL8.0'
description: 'Limit to one PHP/MySQL combination'

jobs:
call_matrix:
uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yml@v3
build_testplan:
runs-on: ubuntu-latest
outputs:
testplan: '${{ steps.build_testplan.outputs.testplan }}'
steps:
- name: Build testplan construct
id: build_testplan
run: |
# shellcheck disable=SC2088
case "${{ inputs.limit }}" in
"no") LIMIT='';;
"PHP8.1/MySQL5.7") LIMIT='~/defaults/php8.1_mysql5.7_only.yml,' ;;
"PHP8.1/MySQL8.0") LIMIT='~/defaults/php8.1_mysql8.0_only.yml,' ;;
"PHP8.2/MySQL5.7") LIMIT='~/defaults/php8.2_mysql5.7_only.yml,' ;;
"PHP8.2/MySQL8.0") LIMIT='~/defaults/php8.2_mysql8.0_only.yml,' ;;
esac
# shellcheck disable=SC2088
TESTPLAN="~/defaults/7.1.x.yml,${LIMIT}~/module-medialibrary.yml,~/_custom.yml"
echo "testplan=${TESTPLAN}" | tee -a "${GITHUB_OUTPUT}"
dispatch_stable:
needs: build_testplan
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yml@v4
with:
testplan: ${{ inputs.testplan }}
runs_on: ${{ inputs.runs_on }}
defaults: 'v3'
testplan: ${{ needs.build_testplan.outputs.testplan }}
runs_on: '"ubuntu-latest"'
defaults: 'v4'
plan_folder: '.github/oxid-esales'
secrets:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
CACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }}
CACHE_ACCESS_KEY: ${{ secrets.CACHE_ACCESS_KEY }}
CACHE_SECRET_KEY: ${{ secrets.CACHE_SECRET_KEY }}
enterprise_github_token: ${{ secrets.enterprise_github_token }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Auto trigger on Push to 7.1.x*
name: Schedule for full matrix run

on:
push:
branches:
- 'b-7.1.x**'
schedule:
- cron: '0 0 */7 * *'

jobs:
push_module:
uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yml@v3
schedule_matrix:
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yml@v4
with:
testplan: 'tests/github_actions/defaults/7.1.x.yml,tests/github_actions/module-medialibrary.yml'
testplan: '~/defaults/7.1.x.yml,~/module-medialibrary.yml,~/_custom.yml'
runs_on: '"ubuntu-latest"'
defaults: 'v3'
defaults: 'v4'
plan_folder: '.github/oxid-esales'
custom_testplan_yaml: |
global:
title: 'php81_mysql80-{{ .Github.EventName }}-{{ .Github.RefName }}'
secrets:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto trigger on push or pull requests
# Matrix workflow using re-usable github actions

on:
pull_request: {}
push: {}

jobs:
php81_mysql80:
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yml@v4
with:
testplan: '~/defaults/7.1.x.yml,~/defaults/php8.1_mysql8.0_only.yml,~/module-medialibrary.yml,~/_custom.yml'
runs_on: '"ubuntu-latest"'
defaults: 'v4'
plan_folder: '.github/oxid-esales'
custom_testplan_yaml: |
global:
title: 'php81_mysql80-{{ .Github.EventName }}-{{ .Github.RefName }}'
secrets:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
CACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }}
CACHE_ACCESS_KEY: ${{ secrets.CACHE_ACCESS_KEY }}
CACHE_SECRET_KEY: ${{ secrets.CACHE_SECRET_KEY }}
enterprise_github_token: ${{ secrets.enterprise_github_token }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,15 @@
"phpstan-report": "phpstan -ctests/PhpStan/phpstan.neon analyse src/ --error-format=json >phpstan.report.json",

"phpmd": "phpmd src ansi tests/PhpMd/standard.xml --ignore-errors-on-exit --ignore-violations-on-exit",
"phpmd-excludestaticaccess": "phpmd src ansi tests/PhpMd/exclude-static-access-rule.xml",
"phpmd-report": "echo '{}' >phpmd.report.json",

"static": [
"@phpcs",
"@phpstan",
"@phpmd"
],

"tests-unit": "vendor/bin/phpunit --config=tests/ --testsuite=Unit",
"tests-integration": "vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/ --testsuite=Integration",
"tests-unit": "XDEBUG_MODE=coverage vendor/bin/phpunit --config=tests/ --testsuite=Unit --coverage-clover=tests/Reports/coverage_unit_module-medialibrary.xml",
"tests-integration": "XDEBUG_MODE=coverage vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/ --testsuite=Integration --coverage-clover=tests/Reports/coverage_integration_module-medialibrary.xml",
"tests-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --bootstrap=/var/www/source/bootstrap.php --config=tests/ --coverage-html=tests/result/coverage",

"tests-codeception": [
Expand Down
3 changes: 1 addition & 2 deletions src/Application/Controller/Admin/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public function upload(): void
$responseService = $this->getService(ResponseInterface::class);

$sId = null;
$sFileName = '';
$sThumb = '';

try {
Expand Down Expand Up @@ -121,7 +120,7 @@ public function upload(): void
$responseService->responseAsJson([
'success' => true,
'id' => $sId,
'file' => $sFileName,
'file' => $sFileName ?? '',
'filetype' => $sFileType ?? '',
'filesize' => $sFileSize ?? '',
'imagesize' => $sImageSize ?? '',
Expand Down
72 changes: 0 additions & 72 deletions tests/github_actions/module-medialibrary.yml

This file was deleted.

0 comments on commit 33bf26a

Please sign in to comment.