feat!: remove unmaintained workflows

This commit is contained in:
Damien Retzinger
2025-03-25 09:32:43 -04:00
parent 404e77a0a1
commit 4c536e3d96
10 changed files with 6 additions and 1253 deletions
@@ -93,7 +93,7 @@ jobs:
mode: store
working-directory: ${{ env.magento_folder }}
- uses: mage-os/github-actions/cache-magento@main
- uses: graycoreio/github-actions-magento2/cache-magento@main
with:
mode: 'store'
composer_cache_key: '${{ matrix.magento }}'
@@ -116,7 +116,7 @@ jobs:
mode: extension
magento_version: magento/project-community-edition:2.4.5-p1
- uses: mage-os/github-actions/cache-magento@main
- uses: graycoreio/github-actions-magento2/cache-magento@main
with:
mode: 'extension'
composer_cache_key: 'magento/project-community-edition:2.4.5-p1'
@@ -1,288 +0,0 @@
## Workflow is only for Magento 2 Main repo - app/code and dev/tests/integration are supported only
## 3rd party modules are not supported yet
name: Integration Tests - Full Test Suite
run-name: ${{ github.actor }} is running Full Integration Test Suite
on:
workflow_call:
inputs:
repository:
type: string
description: "Repository"
required: true
head:
type: string
description: "head SHA"
required: true
test_directory:
type: string
description: "Test directory to run integration tests"
required: false
permissions:
contents: write
jobs:
matrix-calculator:
runs-on: ubuntu-latest
outputs:
php_versions: ${{ steps.set-matrix.outputs.php_versions }}
database_versions: ${{ steps.set-matrix.outputs.database_versions }}
search_versions: ${{ steps.set-matrix.outputs.search_versions }}
message_queue_versions: ${{ steps.set-matrix.outputs.message_queue_versions }}
cache_versions: ${{ steps.set-matrix.outputs.cache_versions }}
http_cache_versions: ${{ steps.set-matrix.outputs.http_cache_versions }}
testsuite_dirs: ${{ steps.set-matrix-testsuite.outputs.testsuite_dirs }}
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.head }}
fetch-depth: 1
- id: set-matrix
name: Calculate Matrix
run: |
echo "php_versions=$(jq -c .services.php supported-services.json)" >> "$GITHUB_OUTPUT"
echo "database_versions=$(jq -c .services.database supported-services.json)" >> "$GITHUB_OUTPUT"
echo "search_versions=$(jq -c .services.search supported-services.json)" >> "$GITHUB_OUTPUT"
echo "message_queue_versions=$(jq -c .services.message_queue supported-services.json)" >> "$GITHUB_OUTPUT"
echo "cache_versions=$(jq -c .services.cache supported-services.json)" >> "$GITHUB_OUTPUT"
echo "http_cache_versions=$(jq -c .services.http_cache supported-services.json)" >> "$GITHUB_OUTPUT"
- id: set-matrix-testsuite
name: Calculate Matrix for testsuite
working-directory: dev/tests/integration
run: |
### TODO: rebuild all that hell to node-js
if [ -n "${{ github.event.inputs.test_directory }}" ]; then
echo "testsuite_dirs=['${{ github.event.inputs.test_directory }}']" >> "$GITHUB_OUTPUT"
exit 0
fi
OUTPUT_FILE="integration-testsuites.json"
TESTSUITE_DIR="./testsuite/Magento"
CODE_DIR="../../../app/code"
MAX_DIRS_PER_LINE=1
## variable with array of exclusion list of directories - they will be handled separately and splitted on more batches
EXCLUSION_LIST=("./testsuite/Magento/Catalog" "./testsuite/Magento/Bundle" "./testsuite/Magento/AsynchronousOperations" "./testsuite/Magento/Sales")
## variable with array of exclusion list of files - separate run will be executed for each file (separate place in tests matrix)
STANDALONE_TESTS=("./testsuite/Magento/AsynchronousOperations/Model/MassScheduleTest.php" "./testsuite/Magento/Catalog/Observer/SwitchPriceAttributeScopeOnConfigChangeTest.php" "./testsuite/Magento/Catalog/Model/CategoryTest.php" "./testsuite/Magento/Bundle/Model/ProductTest.php" "./testsuite/Magento/Catalog/Block/Adminhtml/Category/Tab/ProductTest.php")
# Initialize variables
dir_count=0
json_content="{\n\t\"testsuites\": [\n\t\t\""
current_line=""
# Function to add a directory to the current line, handling comma and count
add_dir_to_line() {
local dir=$1
# Check if current_line is empty to avoid leading commas
if [ -z "$current_line" ]; then
current_line="$dir"
else
current_line="$current_line,$dir"
fi
dir_count=$((dir_count + 1))
if [ "$dir_count" -eq "$MAX_DIRS_PER_LINE" ]; then
json_content="$json_content$current_line"
json_content="$json_content\",\n\t\t\""
current_line=""
dir_count=0
fi
}
# Iterate over the directories and populate the JSON content
while IFS= read -r -d '' dir; do
# if dir is in EXCLUSION_LIST then skip it
if [[ " ${EXCLUSION_LIST[@]} " =~ " ${dir} " ]]; then
continue
fi
add_dir_to_line "${dir}"
done < <(find "$TESTSUITE_DIR" -mindepth 1 -maxdepth 1 -type d -print0)
# Add app/code integration test directories
while IFS= read -r -d '' dir; do
relative_dir="${dir}" # Convert absolute path to relative
add_dir_to_line "$relative_dir"
done < <(find "$CODE_DIR" -mindepth 4 -maxdepth 4 -type d -name 'Integration' -print0)
# Handle exclusion list
# run over EXCLUSION_LIST, find all "*Test.php" files, and put them in array. Exclude directories.
EXCLUSION_LIST_FILES=()
for dir in "${EXCLUSION_LIST[@]}"; do
while IFS= read -r -d '' file; do
# check if file is in STANDALONE_TESTS
if [[ " ${STANDALONE_TESTS[@]} " =~ " ${file} " ]]; then
continue
fi
EXCLUSION_LIST_FILES+=("$file")
done < <(find "$dir" -mindepth 1 -type f -name '*Test.php' -print0)
done
## run over EXCLUSION_LIST_FILES and call add_dir_to_line for each file
MAX_DIRS_PER_LINE=10
dir_count=MAX_DIRS_PER_LINE-1
add_dir_to_line ""
for file in "${EXCLUSION_LIST_FILES[@]}"; do
add_dir_to_line "$file"
done
## run over STANDALONE_TESTS and call add_dir_to_line for each file
MAX_DIRS_PER_LINE=1
dir_count=MAX_DIRS_PER_LINE-1
add_dir_to_line ""
for file in "${STANDALONE_TESTS[@]}"; do
add_dir_to_line "$file"
done
# Handle the last line if it's not empty
if [ -n "$current_line" ]; then
json_content="$json_content$current_line"
fi
# Close the JSON string
json_content="$json_content\"\n\t]\n}\n"
# Write to the output file
echo -e "$json_content" > "$OUTPUT_FILE"
#######
echo "testsuite_dirs=$(jq -c .testsuites integration-testsuites.json)" >> "$GITHUB_OUTPUT"
- name: Debug output
run: |
echo "PHP Versions: ${{ steps.set-matrix.outputs.php_versions }}"
echo "database Versions: ${{ steps.set-matrix.outputs.database_versions }}"
echo "search Versions: ${{ steps.set-matrix.outputs.search_versions }}"
echo "message_queue Versions: ${{ steps.set-matrix.outputs.message_queue_versions }}"
echo "cache Versions: ${{ steps.set-matrix.outputs.cache_versions }}"
echo "http_cache Versions: ${{ steps.set-matrix.outputs.http_cache_versions }}"
echo "testsuite_dirs: ${{ steps.set-matrix-testsuite.outputs.testsuite_dirs }}"
run-integration-tests:
needs: [matrix-calculator]
strategy:
fail-fast: false
matrix:
php_version: ${{ fromJSON(needs.matrix-calculator.outputs.php_versions) }}
database_version: ${{ fromJSON(needs.matrix-calculator.outputs.database_versions) }}
search_version: ${{ fromJSON(needs.matrix-calculator.outputs.search_versions) }}
message_queue_version: ${{ fromJSON(needs.matrix-calculator.outputs.message_queue_versions) }}
cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.cache_versions) }}
http_cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.http_cache_versions) }}
testsuite_dirs: ${{ fromJSON(needs.matrix-calculator.outputs.testsuite_dirs) }}
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.head }}
path: main
fetch-depth: 0
- name: Setup Warden Environment
uses: mage-os/github-actions/warden/setup-environment@main
with:
run_composer_install: 1
php_version: ${{ matrix.php_version }}
database: ${{ matrix.database_version }}
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
varnish: ${{ matrix.http_cache_version }}
base_directory: "./main"
- name: Setup configs for Integration Tests
uses: mage-os/github-actions/warden/integration-tests@main
with:
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
run_memory_test: 0
run_magento_integration_tests: 0
run_magento_integration_tests_real_suite: 0
base_directory: "./main"
- name: Create Mage-OS testsuite
working-directory: ./main/dev/tests/integration
run: |
FILE="phpunit.xml.dist"
# Remove Memory Usage Tests and Magento Integration Tests Real Suite test suites
sed -i '/<testsuite name="Memory Usage Tests">/,/<\/testsuite>/d' "$FILE"
sed -i '/<testsuite name="Magento Integration Tests Real Suite">/,/<\/testsuite>/d' "$FILE"
DIRS="${{ matrix.testsuite_dirs }}"
echo "Debug: $DIRS"
NEW_TESTSUITE_ENTRY=$(
echo "<testsuite name=\"Mage-OS Suite\">"
IFS=','; for dir in $DIRS; do echo " <directory>$dir</directory>"; done
echo " <exclude>testsuite/Magento/IntegrationTest.php</exclude>"
echo "</testsuite>"
)
echo "Debug: $NEW_TESTSUITE_ENTRY"
awk -v new_testsuite="$NEW_TESTSUITE_ENTRY" '/<\/testsuites>/ { print new_testsuite; found=1 } {print} END { if (!found) print new_testsuite }' "$FILE" > tmpfile && mv tmpfile "$FILE"
echo "\nMage-OS suite has been added to $FILE \n"
## TODO: I want to have a possibility to NOT ignore those test if I wish to - by adding additional input to github actions, for example
sed -i '/<testsuites>/i\<groups>\<exclude>\<group>integrationIgnore<\/group><\/exclude><\/groups>' "$FILE"
echo "\nIgnore group `integrationIgnore` has been added to $FILE \n"
cat $FILE;
- name: Run Integration Tests for Modules
working-directory: ./main
run: |
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
# Important: Run the custom "Magento Integration Tests" test suite, which runs all other test suites
${WARDEN} env exec -T --workdir /var/www/html/dev/tests/integration php-fpm ../../../vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite 'Magento Integration Tests' --log-junit=../../../phpunit-output/junit/res-log.xml --coverage-html=../../../phpunit-output/coverage-html/res.html
rum-memory-integration-tests:
needs: [ matrix-calculator ]
strategy:
fail-fast: false
matrix:
php_version: ${{ fromJSON(needs.matrix-calculator.outputs.php_versions) }}
database_version: ${{ fromJSON(needs.matrix-calculator.outputs.database_versions) }}
search_version: ${{ fromJSON(needs.matrix-calculator.outputs.search_versions) }}
message_queue_version: ${{ fromJSON(needs.matrix-calculator.outputs.message_queue_versions) }}
cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.cache_versions) }}
http_cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.http_cache_versions) }}
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.head }}
path: main
fetch-depth: 0
- name: Setup Warden Environment
uses: mage-os/github-actions/warden/setup-environment@main
with:
run_composer_install: 1
php_version: ${{ matrix.php_version }}
database: ${{ matrix.database_version }}
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
varnish: ${{ matrix.http_cache_version }}
base_directory: "./main"
- name: Run Integration tests
uses: mage-os/github-actions/warden/integration-tests@main
with:
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
run_memory_test: "true"
base_directory: "./main"
+3 -3
View File
@@ -24,7 +24,7 @@ See the [integration.yaml](./integration.yaml)
### Matrix Format
The Magento matrix format outlined by the [supported versions action.](https://github.com/mage-os/github-actions/tree/main/supported-version/supported.json)
The Magento matrix format outlined by the [supported versions action.](https://github.com/graycoreio/github-actions-magento2/tree/main/supported-version/supported.json)
## Usage
@@ -47,12 +47,12 @@ jobs:
matrix: ${{ steps.supported-version.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: mage-os/github-actions/supported-version@main
- uses: graycoreio/github-actions-magento2/supported-version@main
id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }}
integration-workflow:
needs: compute_matrix
uses: mage-os/github-actions/.github/workflows/integration.yaml@main
uses: graycoreio/github-actions-magento2/.github/workflows/integration.yaml@main
with:
package_name: my-vendor/package
matrix: ${{ needs.compute_matrix.outputs.matrix }}
+1 -1
View File
@@ -116,7 +116,7 @@ jobs:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
name: Create Magento ${{ matrix.magento }} Project
- uses: mage-os/github-actions/get-magento-version@main
- uses: graycoreio/github-actions-magento2/get-magento-version@main
id: magento-version
with:
working-directory: ${{ inputs.magento_directory }}
-156
View File
@@ -1,156 +0,0 @@
name: NX Integration Test
#description: Workflow to run NX assisted integration tests for Mage-OS projects.
on:
workflow_call:
inputs:
repository:
type: string
description: "Repository"
required: true
pr_head:
type: string
description: "head SHA"
required: true
pr_base:
type: string
description: "pr base SHA"
required: true
workflow_dispatch:
inputs:
repository:
type: string
description: "Repository"
required: true
pr_head:
type: string
description: "head SHA"
required: true
pr_base:
type: string
description: "pr base SHA"
required: true
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: debug
shell: bash
env:
repository: ${{ inputs.repository }}
pr_head: ${{ inputs.pr_head }}
pr_base: ${{ inputs.pr_base }}
run: |
echo "input was"
echo "repository: ${repository}"
echo "pr_head: ${pr_head}"
echo "pr_base: ${pr_base}"
matrix-calculator:
outputs:
php_versions: ${{ steps.calculate-matrix.outputs.php_versions }}
database_versions: ${{ steps.calculate-matrix.outputs.database_versions }}
search_versions: ${{ steps.calculate-matrix.outputs.search_versions }}
message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }}
cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }}
http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }}
runs-on: ubuntu-latest
steps:
- name: Run Matrix Calulator
id: calculate-matrix
uses: mage-os/github-actions/supported-services-matrix-calculator@main
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.pr_head }}
- name: Calculated Result
shell: bash
env:
php_versions: ${{ steps.calculate-matrix.outputs.php_versions }}
database_versions: ${{ steps.calculate-matrix.outputs.database_versions }}
search_versions: ${{ steps.calculate-matrix.outputs.search_versions }}
message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }}
cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }}
http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }}
run: |
echo "PHP Versions: $php_versions"
echo "database_versions: $database_versions"
echo "search_versions: $search_versions"
echo "message_queue_versions: $message_queue_versions"
echo "cache_versions: $cache_versions"
echo "http_cache_versions: $http_cache_versions"
nx-project-setup:
runs-on: ubuntu-latest
steps:
- name: Run Nx Project Setup
uses: mage-os/github-actions/nx-integration-tests-setup@main
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.pr_head }}
pr_base: ${{ inputs.pr_base }}
integration-tests:
needs:
- matrix-calculator
- nx-project-setup
strategy:
fail-fast: false
matrix:
php_version: ${{ fromJSON(needs.matrix-calculator.outputs.php_versions) }}
database_version: ${{ fromJSON(needs.matrix-calculator.outputs.database_versions) }}
search_version: ${{ fromJSON(needs.matrix-calculator.outputs.search_versions) }}
message_queue_version: ${{ fromJSON(needs.matrix-calculator.outputs.message_queue_versions) }}
cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.cache_versions) }}
http_cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.http_cache_versions) }}
runs-on: ubuntu-latest
steps:
- name: Project Cache
uses: actions/cache/restore@v4
with:
path: main
key: ${{ runner.os }}-project-${{ inputs.ref }}
# could probably swap this to a docker container in future
- name: Install NX
working-directory: ./main
run: |
npm install -g nx@^15.4
- name: Print Affected
working-directory: ./main
run: |
AFFECTED_OUTPUT=/tmp/affect.json
nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT}
cat ${AFFECTED_OUTPUT}
echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})"
- name: Setup Warden Environment
uses: mage-os/github-actions/warden/setup-environment@main
with:
php_version: ${{ matrix.php_version }}
database: ${{ matrix.database_version }}
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
varnish: ${{ matrix.http_cache_version }}
base_directory: "./main"
- name: Setup config for Integration tests
uses: mage-os/github-actions/warden/integration-tests@main
with:
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
run_memory_test: 0
run_magento_integration_tests: 0
run_magento_integration_tests_real_suite: 0
base_directory: "./main"
- name: Run Integration Tests (Real)
working-directory: ./main
run: |
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
nx affected --target=test:integration --head=HEAD --base=remotes/origin/${{ inputs.pr_base }}
-40
View File
@@ -1,40 +0,0 @@
name: Sansec eComscan Security Scan
on:
push:
pull_request_target:
workflow_dispatch:
jobs:
run-ecomscan:
# Skip if it's a push event on a PR (it can't access secrets)
if: github.event.pull_request == null || github.event_name != 'push'
name: Run Sansec eComscan
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Download eComscan
run: wget https://ecomscan.com/downloads/linux-amd64/ecomscan
- name: Fix permissions
run: chmod +x ecomscan
- name: Run eComscan
env:
ECOMSCAN_KEY: ${{ secrets.SANSEC_LICENSE_KEY }}
run: |
output=$(./ecomscan --no-auto-update --skip-database --deep --format=csv .)
if [ -n "$output" ]; then
echo "Security issues found:"
echo "$output"
exit 1
fi