mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
feat!: remove unmaintained workflows
This commit is contained in:
@@ -93,7 +93,7 @@ jobs:
|
|||||||
mode: store
|
mode: store
|
||||||
working-directory: ${{ env.magento_folder }}
|
working-directory: ${{ env.magento_folder }}
|
||||||
|
|
||||||
- uses: mage-os/github-actions/cache-magento@main
|
- uses: graycoreio/github-actions-magento2/cache-magento@main
|
||||||
with:
|
with:
|
||||||
mode: 'store'
|
mode: 'store'
|
||||||
composer_cache_key: '${{ matrix.magento }}'
|
composer_cache_key: '${{ matrix.magento }}'
|
||||||
@@ -116,7 +116,7 @@ jobs:
|
|||||||
mode: extension
|
mode: extension
|
||||||
magento_version: magento/project-community-edition:2.4.5-p1
|
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:
|
with:
|
||||||
mode: 'extension'
|
mode: 'extension'
|
||||||
composer_cache_key: 'magento/project-community-edition:2.4.5-p1'
|
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"
|
|
||||||
@@ -24,7 +24,7 @@ See the [integration.yaml](./integration.yaml)
|
|||||||
|
|
||||||
### Matrix Format
|
### 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
|
## Usage
|
||||||
@@ -47,12 +47,12 @@ jobs:
|
|||||||
matrix: ${{ steps.supported-version.outputs.matrix }}
|
matrix: ${{ steps.supported-version.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: mage-os/github-actions/supported-version@main
|
- uses: graycoreio/github-actions-magento2/supported-version@main
|
||||||
id: supported-version
|
id: supported-version
|
||||||
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
||||||
integration-workflow:
|
integration-workflow:
|
||||||
needs: compute_matrix
|
needs: compute_matrix
|
||||||
uses: mage-os/github-actions/.github/workflows/integration.yaml@main
|
uses: graycoreio/github-actions-magento2/.github/workflows/integration.yaml@main
|
||||||
with:
|
with:
|
||||||
package_name: my-vendor/package
|
package_name: my-vendor/package
|
||||||
matrix: ${{ needs.compute_matrix.outputs.matrix }}
|
matrix: ${{ needs.compute_matrix.outputs.matrix }}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ jobs:
|
|||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
name: Create Magento ${{ matrix.magento }} Project
|
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
|
id: magento-version
|
||||||
with:
|
with:
|
||||||
working-directory: ${{ inputs.magento_directory }}
|
working-directory: ${{ inputs.magento_directory }}
|
||||||
|
|||||||
@@ -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 }}
|
|
||||||
@@ -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
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
name: "Nx Integration Tests Setup"
|
|
||||||
author: "Mage-OS"
|
|
||||||
description: "Setup and cache Nx project, this can then be reused with all service combinations."
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
repository:
|
|
||||||
type: string
|
|
||||||
description: "Repository"
|
|
||||||
required: true
|
|
||||||
ref:
|
|
||||||
type: string
|
|
||||||
description: "head SHA"
|
|
||||||
required: true
|
|
||||||
pr_base:
|
|
||||||
type: string
|
|
||||||
description: "pr base SHA"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Checkout PR commit
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.repository }}
|
|
||||||
ref: ${{ inputs.ref }}
|
|
||||||
path: main
|
|
||||||
# Need to do this otherwise Nx cant determine diff
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Fetch base
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: git fetch origin ${{ inputs.pr_base }}
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /tmp/composer-cache
|
|
||||||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
|
|
||||||
|
|
||||||
- id: get-composer-and-php-version
|
|
||||||
name: Get Composer & PHP Version
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "php_version=$(jq -c .services.php[0] supported-services.json)" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "composer_version=$(jq -rc .services.composer[0] supported-services.json)" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Composer Install
|
|
||||||
uses: php-actions/composer@v6
|
|
||||||
with:
|
|
||||||
version: ${{ steps.get-composer-and-php-version.outputs.composer_version }}
|
|
||||||
php_version: ${{ steps.get-composer-and-php-version.outputs.php_version }}
|
|
||||||
args: "--ignore-platform-reqs --optimize-autoloader"
|
|
||||||
working_dir: main
|
|
||||||
|
|
||||||
# could probably swap this to a docker container in future
|
|
||||||
- name: Install NX
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
npm install -g nx@^15.4
|
|
||||||
|
|
||||||
# should be able to cache this in future also
|
|
||||||
- name: Checkout Nx Repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: adamzero1/nx-for-php
|
|
||||||
ref: docker-wrapper-2
|
|
||||||
path: nx
|
|
||||||
|
|
||||||
- name: Copy in NX files
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
NXDIR="../nx"
|
|
||||||
cp -r ${NXDIR}/nx ./
|
|
||||||
cp ${NXDIR}/nx.json ./
|
|
||||||
cp ${NXDIR}/package.json ./
|
|
||||||
cp ${NXDIR}/package-lock.json ./
|
|
||||||
|
|
||||||
- name: Install NPM Deps
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Generate Nx Workspace
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
npm run generate-workspace -- --commands=test:unit,test:integration \
|
|
||||||
--test:unit='if [ -d {{ MODULE_PATH }}Test/Unit ]; then ${WARDEN} env exec -T php-fpm ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml {{ MODULE_PATH }}Test/Unit; else echo "{{ MODULE_NAME }} has no unit test; fi' \
|
|
||||||
--test:integration='${WARDEN} env exec -T --workdir /var/www/html/dev/tests/integration php-fpm ../../../vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite '"'"'Magento Integration Tests Real Suite'"'"' --filter='"'"'/Magento/{{ MODULE_DIRECTORY }}/|Magento\\{{ MODULE_DIRECTORY }}'"'"' --log-junit=../../../phpunit-output/junit/{{ MODULE_DIRECTORY }}.xml --coverage-html=../../../phpunit-output/coverage-html/{{ MODULE_DIRECTORY }}'
|
|
||||||
|
|
||||||
- name: Print Affected
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
AFFECTED_OUTPUT=/tmp/affect.json
|
|
||||||
nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT}
|
|
||||||
echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})"
|
|
||||||
|
|
||||||
# just to get some timings
|
|
||||||
- name: Print Affected2
|
|
||||||
working-directory: ./main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
AFFECTED_OUTPUT=/tmp/affect.json
|
|
||||||
nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT}
|
|
||||||
echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})"
|
|
||||||
|
|
||||||
- name: Project Cache
|
|
||||||
uses: actions/cache/save@v3
|
|
||||||
with:
|
|
||||||
path: main
|
|
||||||
key: ${{ runner.os }}-project-${{ inputs.ref }}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
name: "Supported Services Matrix Calculator"
|
|
||||||
author: "Mage-OS"
|
|
||||||
description: "Calulate a matrix of all supported services (based off supported-services.json)"
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
repository:
|
|
||||||
type: string
|
|
||||||
description: "Repository"
|
|
||||||
required: true
|
|
||||||
ref:
|
|
||||||
type: string
|
|
||||||
description: "head SHA"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
php_versions:
|
|
||||||
description: The applicable PHP versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.php_versions }}
|
|
||||||
database_versions:
|
|
||||||
description: The applicable DB versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.database_versions }}
|
|
||||||
search_versions:
|
|
||||||
description: The applicable Search versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.search_versions }}
|
|
||||||
message_queue_versions:
|
|
||||||
description: The applicable Message Queue versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.message_queue_versions }}
|
|
||||||
cache_versions:
|
|
||||||
description: The applicable Cache versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.cache_versions }}
|
|
||||||
http_cache_versions:
|
|
||||||
description: The applicable HTTP Cache versions
|
|
||||||
value: ${{ steps.set-matrix.outputs.http_cache_versions }}
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Checkout PR commit
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.repository }}
|
|
||||||
ref: ${{ inputs.ref }}
|
|
||||||
|
|
||||||
- id: set-matrix
|
|
||||||
name: Calculate Matrix
|
|
||||||
shell: bash
|
|
||||||
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"
|
|
||||||
|
|
||||||
- name: Debug output
|
|
||||||
shell: bash
|
|
||||||
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 }}"
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
name: "Integration Tests Mage-OS in Warden"
|
|
||||||
author: "Mage-OS"
|
|
||||||
description: "A Github Action that run Integration Tests of Mage-OS in Warden."
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
search:
|
|
||||||
required: true
|
|
||||||
default: "opensearch:2.5"
|
|
||||||
description: "The search engine to use."
|
|
||||||
|
|
||||||
rabbitmq:
|
|
||||||
required: true
|
|
||||||
default: "rabbitmq:3.11"
|
|
||||||
description: "Rabbit MQ version to use."
|
|
||||||
|
|
||||||
redis:
|
|
||||||
required: true
|
|
||||||
default: "redis:7.0"
|
|
||||||
description: "Redis version to use."
|
|
||||||
|
|
||||||
run_memory_test:
|
|
||||||
type: 'boolean'
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
description: "Run Memory Test."
|
|
||||||
|
|
||||||
run_magento_integration_tests:
|
|
||||||
type: 'boolean'
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
description: "Run Magento Integration Tests."
|
|
||||||
|
|
||||||
run_magento_integration_tests_real_suite:
|
|
||||||
type: 'boolean'
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
description: "Run Magento Integration Tests Real Suite."
|
|
||||||
|
|
||||||
base_directory:
|
|
||||||
required: true
|
|
||||||
default: "./"
|
|
||||||
description: "Base directory for the Mage-OS codebase."
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Prepare config for Integration tests
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
SEARCH: ${{ inputs.search }}
|
|
||||||
RABBITMQ: ${{ inputs.rabbitmq }}
|
|
||||||
REDIS: ${{ inputs.redis }}
|
|
||||||
run: |
|
|
||||||
CONFIG_FILE=dev/tests/integration/etc/install-config-mysql.php
|
|
||||||
|
|
||||||
SEARCH_ENGINE_TYPE=${SEARCH%%:*}
|
|
||||||
SEARCH_ENGINE_VERSION=${SEARCH##:*}
|
|
||||||
|
|
||||||
case "$SEARCH" in
|
|
||||||
elasticsearch:*)
|
|
||||||
SEARCH_HOST="elasticsearch"
|
|
||||||
;;&
|
|
||||||
elasticsearch:5*)
|
|
||||||
SEARCH_ENGINE="elasticsearch5"
|
|
||||||
SEARCH_PARAMS="'search-engine' => '$SEARCH_ENGINE', 'elasticsearch-host' => '$SEARCH_HOST', 'elasticsearch-port' => 9200,"
|
|
||||||
;;
|
|
||||||
elasticsearch:6*)
|
|
||||||
SEARCH_ENGINE="elasticsearch6"
|
|
||||||
SEARCH_PARAMS="'search-engine' => '$SEARCH_ENGINE', 'elasticsearch-host' => '$SEARCH_HOST', 'elasticsearch-port' => 9200,"
|
|
||||||
;;
|
|
||||||
elasticsearch:7* | elasticsearch:8*)
|
|
||||||
SEARCH_ENGINE="elasticsearch7"
|
|
||||||
SEARCH_PARAMS="'search-engine' => '$SEARCH_ENGINE', 'elasticsearch-host' => '$SEARCH_HOST', 'elasticsearch-port' => 9200,"
|
|
||||||
;;
|
|
||||||
opensearch:*)
|
|
||||||
SEARCH_ENGINE="opensearch"
|
|
||||||
SEARCH_HOST="opensearch"
|
|
||||||
SEARCH_PARAMS="'search-engine' => '$SEARCH_ENGINE', 'opensearch-host' => '$SEARCH_HOST', 'opensearch-port' => 9200, 'opensearch-index-prefix' => 'magento2', 'opensearch-enable-auth' => 0, 'opensearch-timeout' => 15,"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
SEARCH_ENGINE="elasticsearch7"
|
|
||||||
SEARCH_HOST="UKNOWN"
|
|
||||||
SEARCH_PARAMS="'search-engine' => '$SEARCH_ENGINE', 'elasticsearch-host' => '$SEARCH_HOST', 'elasticsearch-port' => 9200,"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cat << EOL > ${CONFIG_FILE}
|
|
||||||
<?php
|
|
||||||
return [
|
|
||||||
'db-host' => 'tmp-mysql',
|
|
||||||
'db-user' => 'root',
|
|
||||||
'db-password' => 'magento',
|
|
||||||
'db-name' => 'magento_integration_tests',
|
|
||||||
'backend-frontname' => 'backend',
|
|
||||||
$SEARCH_PARAMS
|
|
||||||
'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME,
|
|
||||||
'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
|
|
||||||
'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL,
|
|
||||||
'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME,
|
|
||||||
'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME,
|
|
||||||
EOL
|
|
||||||
|
|
||||||
if [[ -n $RABBITMQ ]]; then
|
|
||||||
cat << EOL >> ${CONFIG_FILE}
|
|
||||||
'amqp-host' => 'rabbitmq',
|
|
||||||
'amqp-port' => '5672',
|
|
||||||
'amqp-user' => 'guest',
|
|
||||||
'amqp-password' => 'guest',
|
|
||||||
EOL
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $REDIS ]]; then
|
|
||||||
cat << EOL >> ${CONFIG_FILE}
|
|
||||||
'session-save' => 'redis',
|
|
||||||
'session-save-redis-host' => 'redis',
|
|
||||||
'session-save-redis-port' => 6379,
|
|
||||||
'session-save-redis-db' => 2,
|
|
||||||
'session-save-redis-max-concurrency' => 20,
|
|
||||||
'cache-backend' => 'redis',
|
|
||||||
'cache-backend-redis-server' => 'redis',
|
|
||||||
'cache-backend-redis-db' => 0,
|
|
||||||
'cache-backend-redis-port' => 6379,
|
|
||||||
'page-cache' => 'redis',
|
|
||||||
'page-cache-redis-server' => 'redis',
|
|
||||||
'page-cache-redis-db' => 1,
|
|
||||||
'page-cache-redis-port' => 6379,
|
|
||||||
EOL
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat << EOL >> ${CONFIG_FILE}
|
|
||||||
];
|
|
||||||
EOL
|
|
||||||
|
|
||||||
echo "configuration"
|
|
||||||
cat ${CONFIG_FILE}
|
|
||||||
|
|
||||||
- name: Run Memory Test
|
|
||||||
if: ${{ inputs.run_memory_test == 'true' }}
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
|
||||||
echo -e '\033[32mRun Memory Tests\033[0m'
|
|
||||||
php ../../../vendor/bin/phpunit \
|
|
||||||
--configuration phpunit.xml.dist \
|
|
||||||
--coverage-clover=coverage.xml \
|
|
||||||
--log-junit=test-results.xml \
|
|
||||||
--coverage-html=coverage \
|
|
||||||
--testsuite 'Memory Usage Tests'
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Run Magento Integration Tests
|
|
||||||
if: ${{ inputs.run_magento_integration_tests == 'true' }}
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
|
||||||
echo -e '\033[32mRun Magento Integration Tests\033[0m'
|
|
||||||
php ../../../vendor/bin/phpunit \
|
|
||||||
--configuration phpunit.xml.dist \
|
|
||||||
--coverage-clover=coverage.xml \
|
|
||||||
--log-junit=test-results.xml \
|
|
||||||
--coverage-html=coverage \
|
|
||||||
--testsuite 'Magento Integration Tests'
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Run Magento Integration Tests Real Suite
|
|
||||||
if: ${{ inputs.run_magento_integration_tests_real_suite == 'true' }}
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
|
||||||
echo -e '\033[32mRun Magento Integration Tests Real Suite\033[0m'
|
|
||||||
php ../../../vendor/bin/phpunit \
|
|
||||||
--configuration phpunit.xml.dist \
|
|
||||||
--coverage-clover=coverage.xml \
|
|
||||||
--log-junit=test-results.xml \
|
|
||||||
--coverage-html=coverage \
|
|
||||||
--testsuite 'Magento Integration Tests Real Suite'
|
|
||||||
"
|
|
||||||
@@ -1,397 +0,0 @@
|
|||||||
name: "Setup Mage-OS in Warden"
|
|
||||||
author: "Mage-OS"
|
|
||||||
description: "A Github Action that pull and set-up Mage-OS in Warden env."
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
warden_version:
|
|
||||||
required: true
|
|
||||||
default: "0.14.2"
|
|
||||||
description: "The version of Warden to use."
|
|
||||||
|
|
||||||
php_version:
|
|
||||||
required: true
|
|
||||||
default: "8.2"
|
|
||||||
description: "PHP version used in Warden container."
|
|
||||||
|
|
||||||
composer_version:
|
|
||||||
required: true
|
|
||||||
default: "2.2.22"
|
|
||||||
description: "The version of Composer to use."
|
|
||||||
|
|
||||||
database:
|
|
||||||
required: true
|
|
||||||
default: "mariadb:10.6"
|
|
||||||
description: "The distribution : version of the database to use."
|
|
||||||
|
|
||||||
search:
|
|
||||||
required: true
|
|
||||||
default: "opensearch:2.5"
|
|
||||||
description: "The search engine to use."
|
|
||||||
|
|
||||||
varnish:
|
|
||||||
required: true
|
|
||||||
default: "varnish:7.3"
|
|
||||||
description: "Varnish version to use."
|
|
||||||
|
|
||||||
rabbitmq:
|
|
||||||
required: true
|
|
||||||
default: "rabbitmq:3.11"
|
|
||||||
description: "Rabbit MQ version to use."
|
|
||||||
|
|
||||||
redis:
|
|
||||||
required: true
|
|
||||||
default: "redis:7.0"
|
|
||||||
description: "Redis version to use."
|
|
||||||
|
|
||||||
run_composer_install:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run composer install or not."
|
|
||||||
|
|
||||||
run_setup_install:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run setup:install or not."
|
|
||||||
|
|
||||||
run_setup_upgrade:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run setup:upgrade or not."
|
|
||||||
|
|
||||||
run_reindex:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run indexer:reindex or not."
|
|
||||||
|
|
||||||
run_production_deploy_mode:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run deploy:mode:set production or not."
|
|
||||||
|
|
||||||
run_magento_config_preset:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run magento config preset or not."
|
|
||||||
|
|
||||||
run_admin_user_creation:
|
|
||||||
required: true
|
|
||||||
default: "0"
|
|
||||||
description: "Whether to run admin user creation or not."
|
|
||||||
|
|
||||||
base_directory:
|
|
||||||
required: true
|
|
||||||
default: "./"
|
|
||||||
description: "Base directory for the Mage-OS codebase."
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Checkout Warden Repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: wardenenv/warden
|
|
||||||
path: warden
|
|
||||||
ref: refs/tags/${{ inputs.warden_version }}
|
|
||||||
|
|
||||||
- name: Init / Configure Warden
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
PHP_VERSION: ${{ inputs.php_version }}
|
|
||||||
COMPOSER_VERSION: ${{ inputs.composer_version }}
|
|
||||||
DATABASE: ${{ inputs.database }}
|
|
||||||
SEARCH: ${{ inputs.search }}
|
|
||||||
VARNISH: ${{ inputs.varnish }}
|
|
||||||
RABBITMQ: ${{ inputs.rabbitmq }}
|
|
||||||
REDIS: ${{ inputs.redis }}
|
|
||||||
run: |
|
|
||||||
# Splitting database input to distribution and version
|
|
||||||
DB_DISTRIBUTION=${DATABASE%%:*}
|
|
||||||
DB_DISTRIBUTION_VERSION=${DATABASE##*:}
|
|
||||||
|
|
||||||
# Splitting search input and setting corresponding flags and versions
|
|
||||||
if [[ $SEARCH == elasticsearch* ]]; then
|
|
||||||
WARDEN_ELASTICSEARCH=1
|
|
||||||
WARDEN_OPENSEARCH=0
|
|
||||||
ELASTICSEARCH_VERSION=${SEARCH##*:}
|
|
||||||
OPENSEARCH_VERSION=""
|
|
||||||
else
|
|
||||||
WARDEN_ELASTICSEARCH=0
|
|
||||||
WARDEN_OPENSEARCH=1
|
|
||||||
ELASTICSEARCH_VERSION=""
|
|
||||||
OPENSEARCH_VERSION=${SEARCH##*:}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setting version variables based on the usage flags
|
|
||||||
RABBITMQ_VERSION=""
|
|
||||||
if [[ $RABBITMQ != null ]]; then
|
|
||||||
RABBITMQ_VERSION=${RABBITMQ##*:}
|
|
||||||
RABBITMQ=1
|
|
||||||
else
|
|
||||||
RABBITMQ=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
REDIS_VERSION=""
|
|
||||||
if [[ $REDIS != null ]]; then
|
|
||||||
REDIS_VERSION=${REDIS##*:}
|
|
||||||
REDIS=1
|
|
||||||
else
|
|
||||||
REDIS=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
VARNISH_VERSION=""
|
|
||||||
if [[ $VARNISH != null ]]; then
|
|
||||||
VARNISH_VERSION=${VARNISH##*:}
|
|
||||||
VARNISH=1
|
|
||||||
else
|
|
||||||
VARNISH=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Creating .env file by substituting variables directly in the template
|
|
||||||
cat << EOF > .env
|
|
||||||
WARDEN_ENV_NAME=mageos
|
|
||||||
WARDEN_ENV_TYPE=magento2
|
|
||||||
WARDEN_WEB_ROOT=/
|
|
||||||
|
|
||||||
TRAEFIK_DOMAIN=mageos.test
|
|
||||||
TRAEFIK_SUBDOMAIN=app
|
|
||||||
|
|
||||||
WARDEN_DB=1
|
|
||||||
WARDEN_ELASTICSEARCH=${WARDEN_ELASTICSEARCH}
|
|
||||||
WARDEN_OPENSEARCH=${WARDEN_OPENSEARCH}
|
|
||||||
WARDEN_ELASTICHQ=0
|
|
||||||
WARDEN_VARNISH=${VARNISH}
|
|
||||||
WARDEN_RABBITMQ=${RABBITMQ}
|
|
||||||
WARDEN_REDIS=${REDIS}
|
|
||||||
|
|
||||||
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION}
|
|
||||||
OPENSEARCH_VERSION=${OPENSEARCH_VERSION}
|
|
||||||
DB_DISTRIBUTION=${DB_DISTRIBUTION}
|
|
||||||
DB_DISTRIBUTION_VERSION=${DB_DISTRIBUTION_VERSION}
|
|
||||||
NODE_VERSION=12
|
|
||||||
COMPOSER_VERSION=${COMPOSER_VERSION}
|
|
||||||
PHP_VERSION=${PHP_VERSION}
|
|
||||||
PHP_XDEBUG_3=1
|
|
||||||
RABBITMQ_VERSION=${RABBITMQ_VERSION}
|
|
||||||
REDIS_VERSION=${REDIS_VERSION}
|
|
||||||
VARNISH_VERSION=${VARNISH_VERSION}
|
|
||||||
|
|
||||||
WARDEN_SYNC_IGNORE=
|
|
||||||
|
|
||||||
WARDEN_ALLURE=0
|
|
||||||
WARDEN_SELENIUM=0
|
|
||||||
WARDEN_SELENIUM_DEBUG=0
|
|
||||||
WARDEN_BLACKFIRE=0
|
|
||||||
WARDEN_SPLIT_SALES=0
|
|
||||||
WARDEN_SPLIT_CHECKOUT=0
|
|
||||||
WARDEN_TEST_DB=1
|
|
||||||
WARDEN_MAGEPACK=0
|
|
||||||
|
|
||||||
BLACKFIRE_CLIENT_ID=
|
|
||||||
BLACKFIRE_CLIENT_TOKEN=
|
|
||||||
BLACKFIRE_SERVER_ID=
|
|
||||||
BLACKFIRE_SERVER_TOKEN=
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo ".env created"
|
|
||||||
cat .env
|
|
||||||
|
|
||||||
- name: Warden svc up && Warden env up
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} svc up
|
|
||||||
${WARDEN} env up
|
|
||||||
|
|
||||||
- name: Change Directory Permissions
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm sudo chmod -R 777 .
|
|
||||||
|
|
||||||
- name: Wait for environment to be ready
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
SEARCH: ${{ inputs.search }}
|
|
||||||
run: |
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
case "${SEARCH}" in
|
|
||||||
elasticsearch:*)
|
|
||||||
SEARCH_HOST="elasticsearch"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
SEARCH_HOST="opensearch"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
HEALTHY=1
|
|
||||||
for ((i=1; i<=24; i++)); do
|
|
||||||
SEARCH_STATUS=$(${WARDEN} env exec -T php-fpm bash -c "curl --write-out %{http_code} --silent --output /dev/null http://${SEARCH_HOST}:9200/_cat/health?h=st; exit 0")
|
|
||||||
echo "search status: ${SEARCH_STATUS}"
|
|
||||||
if [ ${SEARCH_STATUS} -eq "200" ]; then
|
|
||||||
HEALTHY=0
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
echo "HEALTHY: ${HEALTHY}"
|
|
||||||
exit ${HEALTHY}
|
|
||||||
|
|
||||||
- name: composer install run
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
RUN_INSTALL: ${{ inputs.run_composer_install }}
|
|
||||||
run: |
|
|
||||||
if [ $RUN_INSTALL == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
wget https://getcomposer.org/download/${{ inputs.composer_version }}/composer.phar -O composer.phar 1>/dev/null 2>&1 && chmod +x composer.phar
|
|
||||||
${WARDEN} env exec -T php-fpm php composer.phar -v
|
|
||||||
${WARDEN} env exec -T php-fpm php composer.phar install --no-interaction --no-progress
|
|
||||||
else
|
|
||||||
echo "Skipping composer install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install Magento
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
SEARCH: ${{ inputs.search }}
|
|
||||||
REDIS: ${{ inputs.redis }}
|
|
||||||
RABBITMQ: ${{ inputs.rabbitmq }}
|
|
||||||
VARNISH: ${{ inputs.varnish }}
|
|
||||||
RUN_SETUP_INSTALL: ${{ inputs.run_setup_install }}
|
|
||||||
run: |
|
|
||||||
if [ $RUN_SETUP_INSTALL == "1" ]; then
|
|
||||||
SEARCH_ENGINE_VERSION=${SEARCH##*:}
|
|
||||||
case "$SEARCH" in
|
|
||||||
elasticsearch:*)
|
|
||||||
SEARCH_HOST="elasticsearch"
|
|
||||||
;;&
|
|
||||||
elasticsearch:5*)
|
|
||||||
SEARCH_TYPE="elasticsearch5"
|
|
||||||
;;
|
|
||||||
elasticsearch:6*)
|
|
||||||
SEARCH_TYPE="elasticsearch6"
|
|
||||||
;;
|
|
||||||
elasticsearch:7* | elasticsearch:8*)
|
|
||||||
SEARCH_TYPE="elasticsearch7"
|
|
||||||
;;
|
|
||||||
opensearch:*)
|
|
||||||
SEARCH_TYPE="opensearch"
|
|
||||||
SEARCH_HOST="opensearch"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Default values
|
|
||||||
SEARCH_TYPE="elasticsearch7"
|
|
||||||
SEARCH_HOST="elasticsearch"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
declare -a PARAMETERS
|
|
||||||
PARAMETERS+=(--backend-frontname=admin --db-host=db --db-name=magento --db-user=magento --db-password=magento)
|
|
||||||
|
|
||||||
if [[ -n $REDIS ]]; then
|
|
||||||
PARAMETERS+=(--session-save=redis --session-save-redis-host=redis --session-save-redis-port=6379 --session-save-redis-db=2 --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0 --cache-backend-redis-port=6379 --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=1 --page-cache-redis-port=6379)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $VARNISH ]]; then
|
|
||||||
PARAMETERS+=(--http-cache-hosts=varnish:80)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $RABBITMQ ]]; then
|
|
||||||
PARAMETERS+=(--amqp-host=rabbitmq --amqp-port=5672 --amqp-user=guest --amqp-password=guest)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $SEARCH_TYPE == "opensearch" ]]; then
|
|
||||||
PARAMETERS+=(--opensearch-host=$SEARCH_HOST --opensearch-port=9200 --opensearch-index-prefix=magento2 --opensearch-enable-auth=0 --opensearch-timeout=15)
|
|
||||||
else
|
|
||||||
PARAMETERS+=(--search-engine=$SEARCH_TYPE --elasticsearch-host=$SEARCH_HOST --elasticsearch-port=9200 --elasticsearch-enable-auth=0 --elasticsearch-index-prefix=magento2)
|
|
||||||
fi
|
|
||||||
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento setup:install "${PARAMETERS[@]}"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Skipping setup:install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Admin User
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_admin_user_creation }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm php bin/magento admin:user:create \
|
|
||||||
--admin-user=admin \
|
|
||||||
--admin-password=abcABC123 \
|
|
||||||
--admin-email=user-email-dummy@mage-os-awesome.com \
|
|
||||||
--admin-firstname=Admin \
|
|
||||||
--admin-lastname=User
|
|
||||||
else
|
|
||||||
echo "Skipping admin user creation"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set All Magento Configs
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_magento_config_preset }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_adminhtml 1
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set cms/wysiwyg/enabled disabled
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set admin/security/admin_account_sharing 1
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set admin/security/use_form_key 0
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento config:set web/seo/use_rewrites 1
|
|
||||||
else
|
|
||||||
echo "Skipping magento config preset"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run Magento Setup Upgrade
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_setup_upgrade }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento setup:upgrade
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento setup:db:status
|
|
||||||
else
|
|
||||||
echo "Skipping setup:upgrade"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set to production mode
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_production_deploy_mode }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento deploy:mode:set production
|
|
||||||
else
|
|
||||||
echo "Skipping deploy:mode:set production"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run Magento Re-indexation
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_reindex }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm bin/magento indexer:reindex
|
|
||||||
else
|
|
||||||
echo "Skipping indexer:reindex"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run PHP BIN/MAGENTO
|
|
||||||
working-directory: ${{ inputs.base_directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ${{ inputs.run_setup_install }} == "1" ]; then
|
|
||||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
|
||||||
${WARDEN} env exec -T php-fpm php bin/magento
|
|
||||||
else
|
|
||||||
echo "Skipping php bin/magento test command"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user