Skip to content

Commit 9001a32

Browse files
add workflows according to light workflow
1 parent 7a40538 commit 9001a32

File tree

4 files changed

+152
-10
lines changed

4 files changed

+152
-10
lines changed
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This plan should be used before ~/defaults/component.yml. That template uses
2+
# the variables below to fill all the settings for the installation into
3+
# /var/www directly without installing a shop.
4+
5+
global:
6+
# The organisation part of the composer package name <org>/<name>
7+
org: 'oxid-esales'
8+
# The name part of the composer package, also used in other places
9+
name: 'twig-component'
10+
# The repository organisation/name to check out
11+
repo: 'OXID-eSales/twig-component'
12+
13+
# These tests are run for all PHP/MySQL combinations specified when calling
14+
# the workflow
15+
runscript:
16+
matrix:
17+
# A string containing a valid json array of scripts to execute
18+
# The scripts follow the pattern "<prefix>:<composer_alias>" for scripts
19+
# defined in composer.json and "<prefix>:~/<shell_script>" for shell
20+
# scripts located in tests/Scripts
21+
# If you want to see the tests output, make sure to generate it in tests/Output
22+
script: '["component:~/unit.sh","component:~/integration.sh"]'
23+
24+
sonarcloud:
25+
# Remove the next two lines if you want to feed the results of your tests
26+
# to sonarcloud. You need to make sure that your scripts generate an xml
27+
# coverage file in tests/Reports, e.g. by adding
28+
# --coverage-clover=tests/Reports/coverage_phpunit_integration.xml to them.
29+
matrix:
30+
testplan: 'skip'
31+
# If you want to enable sonarcloud, you need to fill out the
32+
# settings for project_key and project_name. You can get them from
33+
# https://sonarcloud.io/organizations/oxid-esales/projects. The defaults for
34+
# organization and parameters should be OK for most cases, so you don't need
35+
# to overwrite them here.
36+
project_key: '???'
37+
project_name: '???'

.github/workflows/dispatch_dev_component.yml

+101-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,117 @@
1-
name: Manual trigger for testing github actions development
1+
name: Manual run
22
# Matrix workflow using re-usable github actions
33

44
on:
55
workflow_dispatch:
66
inputs:
7-
testplan:
7+
scenario:
8+
type: choice
9+
options:
10+
- 7.0.x
11+
- 7.1.x
12+
- 7.2.x
13+
- 8.0.x
14+
- use custom testplan
15+
default: '8.0.x'
16+
description: 'Choose test scenario'
17+
limit:
18+
type: choice
19+
options:
20+
- 'no'
21+
- 'PHP8.0/MySQL5.7'
22+
- 'PHP8.0/MySQL8.0'
23+
- 'PHP8.1/MySQL5.7'
24+
- 'PHP8.1/MySQL8.0'
25+
- 'PHP8.2/MySQL5.7'
26+
- 'PHP8.2/MySQL8.0'
27+
- 'PHP8.3/MySQL5.7'
28+
- 'PHP8.3/MySQL8.0'
29+
description:
30+
default: 'PHP8.1/MySQL5.7'
31+
custom_testplan:
832
type: string
9-
required: true
10-
description: 'URL/PATH of the testplan to run'
11-
default: 'tests/github_actions/defaults/defaults.yml,tests/github_actions/twig-component.yml'
33+
description: 'Custom testplan'
34+
default: '~/defaults/php8.2_mysql5.7_only.yaml,~/twig-component.yaml,~/defaults/component.yaml'
1235
runs_on:
36+
type: string
1337
description: 'JSON string/array describing the runner'
14-
required: true
1538
default: '["self-hosted", "x64"]'
39+
use_dev_version:
40+
type: choice
41+
options: ['no', 'v0']
42+
description: 'Use the dev version of github actions'
43+
default: 'no'
1644

1745
jobs:
18-
call_matrix:
19-
uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yml@v0
46+
build_testplan:
47+
runs-on: ${{ fromJson(inputs.runs_on) }}
48+
outputs:
49+
testplan: '${{ steps.build.outputs.testplan }}'
50+
steps:
51+
- name: 'Build testplan'
52+
id: build
53+
run: |
54+
# Build testplan
55+
# shellcheck disable=SC2088
56+
PLAN="~/twig-component-ee.yaml,~/defaults/component.yaml"
57+
# shellcheck disable=SC2088
58+
case "${{ inputs.limit }}" in
59+
"no") LIMIT='';;
60+
"PHP8.0/MySQL5.7") LIMIT='~/defaults/php8.0_mysql5.7_only.yaml,' ;;
61+
"PHP8.0/MySQL8.0") LIMIT='~/defaults/php8.0_mysql8.0_only.yaml,' ;;
62+
"PHP8.1/MySQL5.7") LIMIT='~/defaults/php8.1_mysql5.7_only.yaml,' ;;
63+
"PHP8.1/MySQL8.0") LIMIT='~/defaults/php8.1_mysql8.0_only.yaml,' ;;
64+
"PHP8.2/MySQL5.7") LIMIT='~/defaults/php8.2_mysql5.7_only.yaml,' ;;
65+
"PHP8.2/MySQL8.0") LIMIT='~/defaults/php8.2_mysql8.0_only.yaml,' ;;
66+
"PHP8.3/MySQL5.7") LIMIT='~/defaults/php8.3_mysql5.7_only.yaml,' ;;
67+
"PHP8.3/MySQL8.0") LIMIT='~/defaults/php8.3_mysql8.0_only.yaml,' ;;
68+
*) echo "Illegal choice, fix the workflow"
69+
exit 1
70+
;;
71+
esac
72+
# shellcheck disable=SC2088
73+
case '${{ inputs.scenario}}' in
74+
"7.0.x") TESTPLAN="~/defaults/7.0.x.yaml,${LIMIT}${PLAN}" ;;
75+
"7.1.x") TESTPLAN="~/defaults/7.1.x.yaml,${LIMIT}${PLAN}" ;;
76+
"7.2.x") TESTPLAN="~/defaults/7.2.x.yaml,${LIMIT}${PLAN}" ;;
77+
"8.0.x") TESTPLAN="${LIMIT}${PLAN}" ;;
78+
"smarty 7.0.x") TESTPLAN="~/defaults/7.0.x.yaml,${LIMIT}~/smarty_7.0.x.yaml" ;;
79+
"use custom testplan") TESTPLAN="${{ inputs.custom_testplan }}" ;;
80+
*)
81+
echo "Illegal choice, fix the workflow"
82+
exit 1
83+
;;
84+
esac
85+
echo "testplan=${TESTPLAN}" | tee -a "${GITHUB_OUTPUT}"
86+
87+
dispatch_stable:
88+
if: ${{ inputs.use_dev_version == 'no' }}
89+
needs: build_testplan
90+
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4
91+
with:
92+
testplan: ${{ needs.build_testplan.outputs.testplan }}
93+
runs_on: ${{ inputs.runs_on }}
94+
defaults: 'v0'
95+
plan_folder: '.github/oxid-esales'
96+
secrets:
97+
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
98+
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
99+
CACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }}
100+
CACHE_ACCESS_KEY: ${{ secrets.CACHE_ACCESS_KEY }}
101+
CACHE_SECRET_KEY: ${{ secrets.CACHE_SECRET_KEY }}
102+
enterprise_github_token: ${{ secrets.enterprise_github_token }}
103+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
104+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
105+
106+
dispatch_v0:
107+
if: ${{ inputs.use_dev_version == 'v0' }}
108+
needs: build_testplan
109+
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v0
20110
with:
21-
testplan: ${{ inputs.testplan }}
111+
testplan: ${{ needs.build_testplan.outputs.testplan }}
22112
runs_on: ${{ inputs.runs_on }}
23-
defaults: 'v3'
113+
defaults: 'v0'
114+
plan_folder: '.github/oxid-esales'
24115
secrets:
25116
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
26117
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}

tests/scripts/integration.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
vendor/bin/phpunit \
4+
-c phpunit.xml \
5+
--coverage-clover=tests/Reports/coverage_phpunit_integration.xml \
6+
tests/Integration 2>&1 \
7+
| tee tests/Output/integration_tests.txt

tests/scripts/unit.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
vendor/bin/phpunit \
4+
-c phpunit.xml \
5+
--coverage-clover=tests/Reports/coverage_phpunit_unit.xml \
6+
tests/Unit 2>&1 \
7+
| tee tests/Output/unit_tests.txt

0 commit comments

Comments
 (0)