Skip to content

Shorten names and load variables dynamically for the install #2

Shorten names and load variables dynamically for the install

Shorten names and load variables dynamically for the install #2

name: universal_workflow_light
# This workflow loads a base testplan, creates cached shop instances and runs
# phpunit, codeception and runtest based tests as well as code scans
# and sonarcloud reports
#
# yamllint disable-line rule:truthy
on:
workflow_call:
inputs:
testplan:
type: string
description: 'Testplan to run'
required: true
runs_on:
type: string
description: 'JSON string/array describing the runner'
required: true
defaults:
type: string
description: 'Which ref do we want to use for the plan defaults'
required: false
default: 'v3'
plan_folder:
type: string
description: 'Folder containing the test plans'
required: false
default: 'tests/github_actions'
default_plan_folder:
type: string
description: 'Folder containing the test plan templates'
required: false
default: '.github/oxid-esales/defaults'
debug:
type: boolean
description: 'Enable debugging'
default: true
required: false
custom_testplan_yaml:
type: string
description: 'Content of ~/oxid-esales/_custom.yml'
default: ''
required: false
secrets:
DOCKER_HUB_USER:
# description: 'user for the docker login'
required: false
DOCKER_HUB_TOKEN:
# description: 'Token for the docker login'
required: false
CACHE_ENDPOINT:
# description: 'Endpoint for tespkg/actions-cache@v1'
required: false # only for ee
CACHE_ACCESS_KEY:
# description: 'Access key for tespkg/actions-cache@v1'
required: false # only for ee
CACHE_SECRET_KEY:
# description: 'Secret key for tespkg/actions-cache@v1'
required: false # only for ee
enterprise_github_token:
# description: 'OAuth token to access enterprise repos'
required: false
SONAR_TOKEN:
# description: Token for sonarcloud access
required: false
SLACK_WEBHOOK_URL:
required: false
# description: Webhook for posting to SLACK
jobs:
init:
runs-on: ${{ fromJSON(inputs.runs_on) }}
steps:
- name: 'Checkout testplan defaults'
uses: actions/checkout@v4
with:
repository: 'OXID-eSales/github-actions'
ref: '${{ inputs.defaults }}'
path: 'defaults'
sparse-checkout: '${{ inputs.default_plan_folder }}'
- name: 'Checkout testplans'
uses: actions/checkout@v4
with:
sparse-checkout: |
${{ inputs.plan_folder}}
composer.json
path: workflow
- name: 'Consolidate plans'
id: consolidate_plans
run: |
mkdir -p '${{ inputs.plan_folder }}/defaults'
if [ -d workflow/${{ inputs.plan_folder }} ]; then
mv workflow/${{ inputs.plan_folder }}/* '${{ inputs.plan_folder }}/'
/bin/rm -r 'workflow/${{ inputs.plan_folder }}'
fi
if [ -f workflow/composer.json ]; then
mv workflow/composer.json '${{ inputs.plan_folder }}/'
fi
mv defaults/${{ inputs.default_plan_folder}}/* '${{ inputs.plan_folder }}/defaults/'
cat >'${{ inputs.plan_folder }}/_custom.yml' <<'EOF'
# Generated from workflow input custom_testplan_yaml
${{ inputs.custom_testplan_yaml }}
EOF
TESTPLAN=$(echo "${{ inputs.testplan }}"|sed -e 's|~|${{ inputs.plan_folder }}|g')
echo "testplan=${{ inputs.plan_folder }}/defaults/defaults_light.yml,${TESTPLAN}" >>"${GITHUB_OUTPUT}"
- name: 'Load Testplan'
id: ltp
uses: 'joernott/load_testplan@v1'
with:
files: '${{ steps.consolidate_plans.outputs.testplan }}'
set_output: true
set_env: true
set_print: true
# loglevel: trace
# logfile: load_testplan.log
yaml: generated_testplan.yaml
- name: 'Prepare artifact and generate safe title'
id: post_ltp
if: always()
run: |
cp "${GITHUB_OUTPUT}" generated_output.txt
cp "${GITHUB_ENV}" generated_env.txt
echo 'title=${{steps.ltp.outputs.global_title}}'|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}"
- name: 'Create first testplan archive'
if: always()
id: begin_report
uses: OXID-eSales/github-actions/begin_report@v4
with:
title: ${{ steps.ltp.outputs.finish_slack_title }}
prefix: '${{ steps.post_ltp.outputs.title }}'
repository: '${{ github.server_url }}/${{ github.repository }}'
job: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
testplan: '${{ inputs.testplan }}'
files: |
${{ inputs.plan_folder}}/*
generated_testplan.yaml
generated_output.txt
generated_env.txt
load_testplan.log
debug: ${{ inputs.debug }}
- name: 'Write Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ steps.post_ltp.outputs.title }}'
header: true
phase: install
priority: '001'
cached_object: ${{ steps.ltp.outputs.init_cache_name }}
debug: false
- name: Cache testplan on S3
if: ${{ inputs.runs_on != '"ubuntu-latest"'}}
uses: tespkg/actions-cache/save@v1
with:
path: |
${{ inputs.plan_folder }}/*
key: '${{ steps.ltp.outputs.init_cache_name }}'
endpoint: ${{ secrets.CACHE_ENDPOINT }}
accessKey: ${{ secrets.CACHE_ACCESS_KEY }}
secretKey: ${{ secrets.CACHE_SECRET_KEY }}
bucket: ${{ steps.ltp.outputs.init_cache_bucket }}
- name: Cache testplan on Github
if: ${{ inputs.runs_on == '"ubuntu-latest"'}}
uses: actions/cache/save@v4
with:
path: |
${{ inputs.plan_folder }}/*
key: '${{ steps.ltp.outputs.init_cache_name }}'
outputs:
debug: ${{ steps.begin_report.outputs.debug }}
use_private_cache: ${{ inputs.runs_on != '"ubuntu-latest"'}}
global_title: ${{ steps.post_ltp.outputs.title }}
# init variables
testplan: ${{ steps.consolidate_plans.outputs.testplan }}
init_cache_bucket: ${{ steps.ltp.outputs.init_cache_bucket }}
init_cache_name: ${{ steps.ltp.outputs.init_cache_name }}
# install_shop_with_modules variables
install_shop_with_modules_matrix_mysql: ${{ steps.ltp.outputs.install_shop_with_modules_matrix_mysql }}
install_shop_with_modules_matrix_php: ${{ steps.ltp.outputs.install_shop_with_modules_matrix_php }}
# runscript variables
runscript_matrix_mysql: ${{ steps.ltp.outputs.runscript_matrix_mysql }}
runscript_matrix_php: ${{ steps.ltp.outputs.runscript_matrix_php }}
runscript_matrix_script: ${{ steps.ltp.outputs.runscript_matrix_script }}
runscript_max_parallel: ${{ steps.ltp.outputs.runscript_max_parallel }}
# sonarcloud variables
sonarcloud_matrix_mysql: ${{ steps.ltp.outputs.sonarcloud_matrix_mysql }}
sonarcloud_matrix_php: ${{ steps.ltp.outputs.sonarcloud_matrix_php }}
sonarcloud_matrix_testplan: ${{ steps.ltp.outputs.sonarcloud_matrix_testplan }}
sonarcloud_max_parallel: ${{ steps.ltp.outputs.sonarcloud_max_parallel }}
# yamllint variables
yamllint_skip: ${{ steps.ltp.outputs.yamllint_skip }}
yamllint_file_or_dir: ${{ steps.ltp.outputs.yamllint_file_or_dir }}
yamllint_rules: ${{ steps.ltp.outputs.yamllint_rules }}
# actionlint variables
actionlint_skip: ${{ steps.ltp.outputs.actionlint_skip }}
# finish variables
finish_matrix_mysql: ${{ steps.ltp.outputs.finish_matrix_mysql }}
finish_matrix_php: ${{ steps.ltp.outputs.finish_matrix_php }}
finish_skip: ${{ steps.ltp.outputs.finish_skip }}
finish_slack_title: ${{ steps.ltp.outputs.finish_slack_title }}
install_shop_with_modules:
needs: init
strategy:
matrix:
php: ${{ fromJSON(needs.init.outputs.install_shop_with_modules_matrix_php) }}
mysql: ${{ fromJSON(needs.init.outputs.install_shop_with_modules_matrix_mysql) }}
fail-fast: false
max-parallel: ${{ fromJSON(needs.init.outputs.install_shop_with_modules_max_parallel) }}
runs-on: ${{ fromJSON(inputs.runs_on) }}
steps:
- name: Load cached testplan
id: istn
uses: OXID-eSales/github-actions/load_cached_testplan@v0
with:
php: ${{ matrix.php }}
mysql: ${{ matrix.mysql }}
prefix: '${{ needs.init.outputs.global_title }}'
root_testplan: ${{ needs.init.outputs.testplan }}
matrix_testplan: ''
plan_folder: ${{ inputs.plan_folder }}
cache_name: ${{ needs.init.outputs.init_cache_name }}
cache_endpoint: ${{ secrets.CACHE_ENDPOINT }}
cache_access_key: ${{ secrets.CACHE_ACCESS_KEY }}
cache_secret_key: ${{ secrets.CACHE_SECRET_KEY }}
cache_bucket: ${{ needs.init.outputs.init_cache_bucket }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Load Testplan'
id: isltp
uses: 'joernott/load_testplan@v1'
with:
files: '${{steps.istn.outputs.testplan}}'
set_output: true
set_print: true
set_env: true
yaml: generated_testplan.yaml
token: ${{ secrets.enterprise_github_token }}
- name: 'Prepare Shop'
id: prepare_shop
uses: 'OXID-eSales/github-actions/prepare_shop@v0'
with:
container_name: ${{ steps.isltp.outputs.install_shop_with_modules_container_name }}
container_options: ${{ steps.isltp.outputs.install_shop_with_modules_container_options }}
container_method: ${{ steps.isltp.outputs.install_shop_with_modules_container_method }}
docker_login: ${{ steps.isltp.outputs.install_shop_with_modules_docker_login }}
docker_user: ${{ secrets.DOCKER_HUB_USER }}
docker_token: ${{ secrets.DOCKER_HUB_TOKEN }}
git_sdk_url: ${{ steps.isltp.outputs.install_shop_with_modules_git_sdk_url }}
git_sdk_ref: ${{ steps.isltp.outputs.install_shop_with_modules_git_sdk_ref }}
compilation_url: ${{ steps.isltp.outputs.install_shop_with_modules_composer_root_url }}
github_ref_name: ${{ github.ref_name }}
php: ${{ matrix.php }}
mysql: ${{ matrix.mysql }}
custom_ini_error_reporting: ${{ steps.isltp.outputs.install_shop_with_modules_custom_ini_error_reporting }}
custom_ini_xdebug: ${{ steps.isltp.outputs.install_shop_with_modules_custom_ini_xdebug }}
add_services: ${{ steps.isltp.outputs.install_shop_with_modules_add_services }}
composer_file: ${{ steps.isltp.outputs.install_shop_with_modules_composer_file }}
composer_transform: ${{ steps.isltp.outputs.install_shop_with_modules_composer_transform}}
composer_backup: ${{ steps.isltp.outputs.install_shop_with_modules_composer_backup}}
composer_update: ${{ steps.isltp.outputs.install_shop_with_modules_composer_update}}
composer_update_options: ${{ steps.isltp.outputs.install_shop_with_modules_composer_update_options}}
composer_dev_ref: ${{ steps.isltp.outputs.install_shop_with_modules_composer_dev_ref}}
enterprise_github_token: ${{ secrets.enterprise_github_token || github.token }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Stop shop for preparedShop cache'
if: ${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop == 'true' }}
uses: 'OXID-eSales/github-actions/stop_shop@v4'
with:
debug: ${{ needs.init.outputs.debug }}
- name: Cache preparedShop on s3
if: ${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop == 'true' && steps.isltp.outputs.use_private_cache == 'true' }}
uses: tespkg/actions-cache/save@v1
with:
path: |
./*
key: '${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop_prefix }}_${{steps.istn.outputs.matrix_suffix}}'
endpoint: ${{ secrets.CACHE_ENDPOINT }}
accessKey: ${{ secrets.CACHE_ACCESS_KEY }}
secretKey: ${{ secrets.CACHE_SECRET_KEY }}
bucket: ${{ steps.isltp.outputs.install_shop_with_modules_cache_bucket }}
- name: Cache preparedShop on github
if: ${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop == 'true' && steps.isltp.outputs.use_private_cache != 'true'}}
uses: actions/cache/save@v4
with:
path: |
./*
key: '${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop_prefix }}_${{steps.istn.outputs.matrix_suffix}}'
- name: Debug cache preparedShop
if: ${{ inputs.debug == true && steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop == true }}
shell: bash
run: |
# install_shop_with_modules: Debug cache current installation
# we need to add the dot folders here explicitly because bash works differently than the action
MATRIX='PHP${{matrix.php}}-MYSQL${{matrix.mysql}}'
CACHE_NAME="${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop_prefix}}_${{steps.isltp.outputs.global_title}}-${MATRIX}"
echo "write_cache '${CACHE_NAME}' ./* .env .env.dist .gitignore .git" >>debug/debug.sh
- name: 'Start shop after caching preparedShop'
if: ${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop == 'true' }}
shell: bash
run: |
# install_shop_with_modules: Start containers
${{ needs.init.outputs.debug }}
echo -e "\033[0;35m### Starting containers\033[0m"
make up
- name: 'Install shop'
id: install_shop
uses: 'OXID-eSales/github-actions/install_shop@v4'
with:
container_name: ${{ steps.isltp.outputs.install_shop_with_modules_container_name }}
container_options: ${{ steps.isltp.outputs.install_shop_with_modules_container_options }}
container_method: ${{ steps.isltp.outputs.install_shop_with_modules_container_method }}
is_enterprise: ${{ steps.isltp.outputs.install_shop_with_modules_is_enterprise }}
config_idebug: ${{ steps.isltp.outputs.install_shop_with_modules_config_idebug }}
output_files: ${{ steps.isltp.outputs.install_shop_with_modules_output_files }}
output_artifact: '${{ steps.isltp.outputs.install_shop_with_modules_output_artifact_prefix }}-${{steps.istn.outputs.matrix_suffix}}'
debug: ${{ needs.init.outputs.debug }}
- name: Run custom scripts
# yamllint disable-line rule:line-length
if: ${{ steps.isltp.outputs.install_shop_with_modules_custom_script != '' || steps.isltp.outputs.install_shop_with_modules_custom_script_container != '' }} uses: 'OXID-eSales/github-actions/run_custom_scripts@v4'

Check failure on line 338 in .github/workflows/universal_workflow_light.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/universal_workflow_light.yml

Invalid workflow file

You have an error in your yaml syntax on line 338
with:
container_name: ${{ steps.isltp.outputs.install_shop_with_modules_container_name }}
container_options: ${{ steps.isltp.outputs.install_shop_with_modules_container_options }}
container_method: ${{ steps.isltp.outputs.install_shop_with_modules_container_method }}
custom_script: ${{ steps.isltp.outputs.install_shop_with_modules_custom_script }}
custom_script_container: ${{ steps.isltp.outputs.install_shop_with_modules_custom_script_container }}
debug: ${{ needs.init.outputs.debug }}
- name: Run composer for each module
shell: bash
run: |
${{ needs.init.outputs.debug }}
PREFIXES=$(echo '${{steps.isltp.outputs.runscript_matrix_script}}'|tr ',' '\n'|tr -d '[]"'|sed -e 's|-|_|g' -e 's|:.*||'|sort|uniq)
for PREFIX in ${PREFIXES}; do
VAR="runtest_${PREFIX}_path"
COMPOSER_PATH="${!VAR}"
echo -e "\033[0;35mRuning composer install for ${PREFIX} in ${COMPOSER_PATH} using 'runtest_${PREFIX}_path'\033[0m"
docker compose ${{ steps.isltp.outputs.install_shop_with_modules_container_method }} -T \
${{ steps.isltp.outputs.install_shop_with_modules_container_options }} \
--workdir "/var/www/${COMPOSER_PATH}" \
${{ steps.isltp.outputs.install_shop_with_modules_container_name }} \
composer update ${{ steps.isltp.outputs.install_shop_with_modules_composer_update_options}}
done
- name: 'Stop shop'
if: ${{ always() }}
uses: 'OXID-eSales/github-actions/stop_shop@v4'
with:
debug: ${{ needs.init.outputs.debug }}
- name: Debug cache current installation
if: ${{ inputs.debug }}
shell: bash
run: |
# install_shop_with_modules: Debug cache current installation
# we need to add the dot folders here explicitly because bash works differently than the action
MATRIX='PHP${{matrix.php}}-MYSQL${{matrix.mysql}}'
CACHE_NAME="${{ steps.isltp.outputs.install_shop_with_modules_cache_prefix}}_${{steps.isltp.outputs.global_title}}-${MATRIX}"
echo "write_cache '${CACHE_NAME}' ./* .env .env.dist .gitignore .git" >>debug/debug.sh
- name: Cache current installation on s3
if: ${{ needs.init.outputs.use_private_cache == 'true' }}
uses: tespkg/actions-cache/save@v1
with:
path: |
./*
key: '${{ steps.isltp.outputs.install_shop_with_modules_cache_prefix}}_${{steps.istn.outputs.matrix_suffix}}'
endpoint: ${{ secrets.CACHE_ENDPOINT }}
accessKey: ${{ secrets.CACHE_ACCESS_KEY }}
secretKey: ${{ secrets.CACHE_SECRET_KEY }}
bucket: ${{ steps.isltp.outputs.install_shop_with_modules_cache_bucket }}
- name: Cache current installation on github
if: ${{ needs.init.outputs.use_private_cache != 'true' }}
uses: actions/cache/save@v4
with:
path: |
./*
key: '${{ steps.isltp.outputs.install_shop_with_modules_cache_prefix}}_${{steps.istn.outputs.matrix_suffix}}'
- name: 'Write Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ needs.init.outputs.global_title }}'
priority: '020'
phase: install
job: install_shop_with_modules
php: ${{matrix.php}}
mysql: ${{matrix.mysql}}
status: ${{job.status}}
# yamllint disable rule:line-length
cached_object: |
${{ steps.isltp.outputs.install_shop_with_modules_cache_prepared_shop_prefix}}_${{steps.isltp.outputs.global_title}}-PHP${{matrix.php}}-MYSQL${{matrix.mysql}}
${{ steps.isltp.outputs.install_shop_with_modules_cache_prefix}}_${{steps.isltp.outputs.global_title}}-PHP${{matrix.php}}-MYSQL${{matrix.mysql}}
# yamllint enable rule:line-length
debug: ${{ inputs.debug }}
runscript:
needs: ['init', 'install_shop_with_modules']
if: ${{ needs.init.outputs.runscript_matrix_script != 'skip' }}
strategy:
matrix:
php: ${{ fromJSON(needs.init.outputs.runscript_matrix_php) }}
mysql: ${{ fromJSON(needs.init.outputs.runscript_matrix_mysql) }}
script: ${{ fromJSON(needs.init.outputs.runscript_matrix_script) }}
fail-fast: false
max-parallel: ${{ fromJSON(needs.init.outputs.runscript_max_parallel) }}
runs-on: ${{ fromJSON(inputs.runs_on) }}
env:
MATRIX_PHP: ${{ matrix.php }}
MATRIX_MYSQL: ${{ matrix.mysql }}
steps:
- name: Load cached testplan
id: rstn
uses: OXID-eSales/github-actions/load_cached_testplan@v0
with:
php: ${{ matrix.php }}
mysql: ${{ matrix.mysql }}
prefix: '${{ needs.init.outputs.global_title }}'
root_testplan: ${{ needs.init.outputs.testplan }}
matrix_testplan: ''
plan_folder: ${{ inputs.plan_folder }}
cache_name: ${{ needs.init.outputs.init_cache_name }}
cache_endpoint: ${{ secrets.CACHE_ENDPOINT }}
cache_access_key: ${{ secrets.CACHE_ACCESS_KEY }}
cache_secret_key: ${{ secrets.CACHE_SECRET_KEY }}
cache_bucket: ${{ needs.init.outputs.init_cache_bucket }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Load Testplan'
id: rsltp
uses: 'joernott/load_testplan@v1'
with:
files: '${{steps.rstn.outputs.testplan}}'
set_output: true
set_print: true
set_env: true
yaml: generated_testplan.yaml
token: ${{ secrets.enterprise_github_token }}
- name: Convert variables
id: rt
shell: bash
run: |
${{ needs.init.outputs.debug }}
set +x
E=$(env|grep -e "^runscript_")
MATRIX_SCRIPT='${{ matrix.script }}'
if [[ ${MATRIX_SCRIPT} != *":"* ]]; then
echo -e "\033[0;31m ${X} does not contain a ':'. You need to specify scripts as '<prefix>:<script_name>'"
exit 1
fi
IFS=':' read -r -a S <<< "${MATRIX_SCRIPT}"
PREFIX="${S[0]}//-/_"
SCRIPT="${S[1]}"
echo "runscript_script=${SCRIPT}"|tee -a "${GITHUB_OUTPUT}"
for KEY in title docker_login load_shop \
container_name container_options container_method \
cache_bucket \
composer_file composer_backup composer_transform composer_update composer_update_options \
custom_script custom_script_container \
path install_options \
output_files output_prefix ; do
VAR="runscript_${PREFIX}_${KEY}"
if [[ "${E}" != *"${VAR}"* ]]; then
VAR="runscript_${KEY}"
fi
cat >>"${GITHUB_OUTPUT}" <<EOF
runscript_${KEY}<<runscript_${KEY}_delimeter
${!VAR}
runscript_${KEY}_delimeter
EOF
done
SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}"
echo "runscript_suffix=${SUFFIX}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}"
- name: 'Start shop'
uses: 'OXID-eSales/github-actions/start_shop@v4'
with:
cached_shop: '${{ steps.rt.outputs.runscript_load_shop}}_${{ steps.rstn.outputs.matrix_suffix }}'
cache_bucket: ${{ steps.rt.outputs.runscript_cache_bucket }}
cache_endpoint: ${{ secrets.CACHE_ENDPOINT }}
cache_access_key: ${{ secrets.CACHE_ACCESS_KEY }}
cache_secret_key: ${{ secrets.CACHE_SECRET_KEY }}
docker_login: ${{ steps.rt.outputs.runscript_docker_login }}
docker_user: ${{ secrets.DOCKER_HUB_USER }}
docker_token: ${{ secrets.DOCKER_HUB_TOKEN }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Modify composer.json'
if: ${{ steps.rt.outputs.runscript_composer_transform != '' }}
uses: 'OXID-eSales/github-actions/composer_merge@v0'
with:
file: 'source/${{ steps.rt.outputs.runscript_path }}/composer.json'
backup: true
transform: |
${{ steps.rt.outputs.runscript_composer_transform }}
update: ${{ steps.rt.outputs.runscript_composer_update }}
update_options: ${{ steps.rt.outputs.runscript_composer_update_options }}
container_name: ${{ steps.rt.outputs.runscript_container_name }}
container_options: ${{ steps.rt.outputs.runscript_container_options }}
container_method: 'exec'
debug: ${{ needs.init.outputs.debug }}
github_token: ${{ secrets.enterprise_github_token || github.token }}
- name: Run custom scripts
if: ${{ steps.rt.outputs.runscript_custom_script != '' || steps.rt.outputs.runscript_custom_script_container != '' }}
uses: 'OXID-eSales/github-actions/run_custom_scripts@v4'
with:
container_name: ${{ steps.rt.outputs.runscript_container_name }}
container_options: ${{ steps.rt.outputs.runscript_container_options }}
container_method: ${{ steps.rt.outputs.runscript_container_method }}
custom_script: ${{ steps.rt.outputs.runscript_custom_script }}
custom_script_container: ${{ steps.rt.outputs.runscript_custom_script_container }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Run runscript check'
uses: 'OXID-eSales/github-actions/run_composer_script@v0'
with:
script: ${{ steps.rt.outputs.runscript_script }}
path: ${{ steps.rt.outputs.runscript_path }}
run_composer_install: ${{ steps.rt.outputs.runscript_run_composer_install }}
install_options: ${{ steps.rt.outputs.runscript_install_options }}
container_name: ${{ steps.rt.outputs.runscript_container_name }}
container_options: ${{ steps.rt.outputs.runscript_container_options }}
container_method: ${{ steps.rt.outputs.runscript_container_method }}
output_artifact: ${{ steps.rt.outputs.runscript_output_prefix}}-${{steps.rt.outputs.runscript_suffic }}
debug: ${{ needs.init.outputs.debug }}
github_token: ${{ secrets.enterprise_github_token || github.token }}
- name: Upload coverage report
if: ${{ always() && steps.rt.outputs.runscript_coverage_prefix != '' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.rt.outputs.runscript_coverage_prefix}}-${{steps.rt.outputs.runscript_suffic }}
path: source/${{ steps.rt.outputs.runscript_path }}/tests/Reports/*.xml
- name: 'Stop shop'
if: ${{ always() }}
uses: 'OXID-eSales/github-actions/stop_shop@v4'
with:
debug: ${{ needs.init.outputs.debug }}
- name: 'Write Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ needs.init.outputs.global_title }}'
priority: '100'
phase: test
job: runscript
title: '${{ matrix.script }}'
php: ${{matrix.php}}
mysql: ${{matrix.mysql}}
status: ${{job.status}}
debug: ${{ inputs.debug }}
sonarcloud:
needs: ['init', 'install_shop_with_modules', 'runscript']
# yamllint disable-line rule:line-length
if: ${{ always() && needs.init.outputs.sonarcloud_matrix_testplan != '' && needs.init.outputs.sonarcloud_matrix_testplan != 'none' && needs.init.outputs.sonarcloud_matrix_testplan != 'skip' }}
strategy:
matrix:
php: ${{ fromJSON(needs.init.outputs.sonarcloud_matrix_php) }}
mysql: ${{ fromJSON(needs.init.outputs.sonarcloud_matrix_mysql) }}
testplan: ${{ fromJSON(needs.init.outputs.sonarcloud_matrix_testplan) }}
fail-fast: false
max-parallel: ${{ fromJSON(needs.init.outputs.sonarcloud_max_parallel) }}
runs-on: ${{ fromJSON(inputs.runs_on) }}
env:
MATRIX_PHP: ${{ matrix.php }}
MATRIX_MYSQL: ${{ matrix.mysql }}
MATRIX_TESTPLAN: ${{ matrix.testplan }}
steps:
- name: Load cached testplan
id: sonarcloud_testplan_name
uses: OXID-eSales/github-actions/load_cached_testplan@v4
with:
php: ${{ matrix.php }}
mysql: ${{ matrix.mysql }}
prefix: '${{ needs.init.outputs.global_title }}'
root_testplan: ${{ needs.init.outputs.testplan }}
matrix_testplan: ${{ matrix.testplan }}
plan_folder: ${{ inputs.plan_folder }}
cache_name: ${{ needs.init.outputs.init_cache_name }}
cache_endpoint: ${{ secrets.CACHE_ENDPOINT }}
cache_access_key: ${{ secrets.CACHE_ACCESS_KEY }}
cache_secret_key: ${{ secrets.CACHE_SECRET_KEY }}
cache_bucket: ${{ needs.init.outputs.init_cache_bucket }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Load Testplan'
id: sonarcloud_testplan
uses: 'joernott/load_testplan@v1'
with:
files: '${{steps.sonarcloud_testplan_name.outputs.testplan}}'
set_output: true
set_print: true
yaml: generated_testplan.yaml
token: ${{ secrets.enterprise_github_token }}
- name: Checkout shop
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'SonarCloud Scan'
uses: 'OXID-eSales/github-actions/sonarcloud@v4'
with:
coverage_artifact: 'coverage-reports-*-${{ steps.sonarcloud_testplan_name.outputs.matrix_suffix }}'
output_artifact: 'coverage-reports-${{ needs.init.outputs.global_title }}'
target_branch: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_target_branch }}
strip_path: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_strip_path }}
github_ref_name: ${{ github.ref_name }}
sonarcloud_organization: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_organization }}
sonarcloud_project_key: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_project_key }}
sonarcloud_project_name: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_project_name }}
sonarcloud_parameters: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_parameters }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
github_token: ${{ github.token }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Write Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ needs.init.outputs.global_title }}'
priority: '240'
phase: report
job: sonarcloud
title: ${{ steps.sonarcloud_testplan.outputs.sonarcloud_title }}
php: ${{matrix.php}}
mysql: ${{matrix.mysql}}
testplan: ${{matrix.testplan}}
status: ${{job.status}}
debug: ${{ inputs.debug }}
yamllint:
needs: ['init', 'install_shop_with_modules']
if: ${{ always() && needs.init.outputs.yamllint_skip != 'true' }}
runs-on: ${{ fromJSON(inputs.runs_on) }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Lint yaml files
id: yamllint
uses: OXID-eSales/github-actions/yamllint@v4
with:
file_or_dir: ${{ needs.init.outputs.yamllint_file_or_dir }}
config_data: ${{ needs.init.outputs.yamllint_rules }}
debug: ${{ needs.init.outputs.debug }}
- name: 'Write yamllint Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ needs.init.outputs.global_title }}'
priority: '240'
phase: report
title: ''
job: 'yamllint'
php: ''
mysql: ''
testplan: ''
status: ${{job.status}}
debug: false
actionlint:
needs: ['init', 'install_shop_with_modules']
if: ${{ always() && needs.init.outputs.actionlint_skip != 'true' }}
runs-on: ${{ fromJSON(inputs.runs_on) }}
steps:
- name: Install npm on private runner
if: ${{ inputs.runs_on != '"ubuntu-latest"'}}
run: |
NPM=$(type -p 'npm'||true)
if [ -z "${NPM}" ]; then
echo -e "\033[0;35m### Installing npm ###\033[0m"
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq update
sudo apt-get -qq install npm
fi
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Run actionlint
id: actionlint
uses: raven-actions/actionlint@v1
- name: actionlint Summary
if: always()
run: |
echo "Used actionlint version ${{ steps.actionlint.outputs.version-semver }}"
echo "Used actionlint release ${{ steps.actionlint.outputs.version-tag }}"
echo "actionlint ended with ${{ steps.actionlint.outputs.exit-code }} exit code"
echo "actionlint ended because '${{ steps.actionlint.outputs.exit-message }}'"
echo "actionlint found ${{ steps.actionlint.outputs.total-errors }} errors"
echo "actionlint checked ${{ steps.actionlint.outputs.total-files }} files"
echo "actionlint cache used: ${{ steps.actionlint.outputs.cache-hit }}"
- name: 'Write actionlint Report'
if: always()
uses: OXID-eSales/github-actions/append_report@v4
with:
prefix: '${{ needs.init.outputs.global_title }}'
priority: '250'
phase: report
job: 'actionlint'
title: ''
php: ''
mysql: ''
testplan: ''
status: ${{job.status}}
debug: false
finish:
if: ${{ always() && needs.init.outputs.finish_skip != 'true' }}
needs:
- init
- install_shop_with_modules
- runscript
- sonarcloud
- yamllint
- actionlint
runs-on: ${{ fromJSON(inputs.runs_on) }}
env:
SLACK_WEBHOOK: "${{ secrets.SLACK_WEBHOOK_URL }}"
steps:
- name: 'Generate report'
id: generate_report
uses: 'OXID-eSales/github-actions/generate_report@v4'
with:
prefix: '${{ needs.init.outputs.global_title }}'
slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
title: '${{ needs.init.outputs.finish_slack_title }}'
debug: ${{ inputs.debug }}
- name: 'Clean Cache'
# if: ${{ steps.generate_report.outputs.overall_status == 'success' }}
uses: 'OXID-eSales/github-actions/clean_cache@v4'
env:
GH_TOKEN: ${{ github.token }}
with:
runs_on: ${{ inputs.runs_on }}
cache_endpoint: ${{ secrets.CACHE_ENDPOINT }}
cache_access_key: ${{ secrets.CACHE_ACCESS_KEY }}
cache_secret_key: ${{ secrets.CACHE_SECRET_KEY }}
cache_objects: |
${{ steps.generate_report.outputs.cache_objects }}
debug: ${{ needs.init.outputs.debug }}