Skip to content

(do not merge) test CI for PR #19964 #20021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
79bb220
test initial script
RadhepS Feb 4, 2025
72ee03c
test
RadhepS Feb 4, 2025
cb27a30
test
RadhepS Feb 4, 2025
db6c939
test
RadhepS Feb 4, 2025
a06f440
test
RadhepS Feb 4, 2025
1098e34
test
RadhepS Feb 4, 2025
6ba0022
test
RadhepS Feb 4, 2025
09ea6c3
test
RadhepS Feb 4, 2025
e586931
test
RadhepS Feb 4, 2025
e6dcc91
test
RadhepS Feb 4, 2025
c1e6843
test
RadhepS Feb 4, 2025
62717e9
test
RadhepS Feb 4, 2025
e13c6c4
test
RadhepS Feb 4, 2025
c2f5f80
test
RadhepS Feb 4, 2025
313c9a9
test
RadhepS Feb 4, 2025
4c36e35
test
RadhepS Feb 4, 2025
426a8e0
update
RadhepS Feb 4, 2025
feb58a0
test
RadhepS Feb 4, 2025
c8b66f3
test
RadhepS Feb 4, 2025
1d4abcb
update
RadhepS Feb 4, 2025
eaf7d21
test
RadhepS Feb 5, 2025
883e406
test
RadhepS Feb 5, 2025
7f3f730
test
RadhepS Feb 5, 2025
d41ee07
tets
RadhepS Feb 5, 2025
6dea4bd
test
RadhepS Feb 5, 2025
fb90532
test
RadhepS Feb 5, 2025
681faf5
test
RadhepS Feb 5, 2025
20ec6cd
test
RadhepS Feb 5, 2025
fd584e3
test
RadhepS Feb 5, 2025
5ff08d1
test
RadhepS Feb 5, 2025
6db7ba1
test
RadhepS Feb 5, 2025
91aa9d9
test
RadhepS Feb 5, 2025
b38dda8
test
RadhepS Feb 5, 2025
d222c85
test
RadhepS Feb 5, 2025
b6b3b58
update
RadhepS Feb 5, 2025
d52b273
add comments
RadhepS Feb 5, 2025
6564c8c
Merge branch 'develop' into feature/cxspa-9258
RadhepS Feb 5, 2025
980556f
Update index.ts
RadhepS Feb 5, 2025
489949a
Update ng-package.json
RadhepS Feb 5, 2025
c74ae89
Update public_api.ts
RadhepS Feb 5, 2025
3e4d2b2
Update index.ts
RadhepS Feb 5, 2025
21143b2
adjust script to run all translation folders on default
RadhepS Feb 12, 2025
0b0b976
update to ensure pipeline checks for translationd with src path
Feb 14, 2025
23ca0a8
update to exclude node modules and dist from script
Feb 14, 2025
6cf0cf1
Remove validation from dist or node modules folders
RadhepS Feb 18, 2025
35af624
check for correct folder path variable
Feb 18, 2025
e7c44e9
Merge branch 'develop' into feature/cxspa-9258
RadhepS Feb 18, 2025
b46a45f
Merge branch 'develop' into feature/cxspa-9258
RadhepS Feb 20, 2025
30d4ec1
add random file in integration-libs/s4om/assets/translations
Platonn Feb 24, 2025
d1a00b4
export qsTestTranslations in translations.ts
Platonn Feb 24, 2025
3e7dbe7
create index file and export it
Platonn Feb 24, 2025
a5c8614
import json file in index.ts
Platonn Feb 24, 2025
cb4b05f
remove recent changes
Platonn Feb 24, 2025
33fbad7
add test file json in assets lib
Platonn Feb 24, 2025
ecc2622
export file in index.ts
Platonn Feb 24, 2025
242e90d
add export to translations.ts in assets lib
Platonn Feb 24, 2025
4a77592
revert previous changes
Platonn Feb 24, 2025
8ff9ea9
add test comment somewhere else
Platonn Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/validate-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
pull_request:
paths:
- '**/assets/translations/**'
- '**/assets/src/translations/**'

env:
NODE_VERSION: '20'

name: Validate Configuration of Translation Files
jobs:
validate-translations:
name: Validate Translations
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Run Translation Validation Script
run: |
BASE_COMMIT=${{ github.event.pull_request.base.sha }}
HEAD_COMMIT=${{ github.event.pull_request.head.sha }}

# Get the paths of the changed files
changed_files=$(git diff --name-only $BASE_COMMIT $HEAD_COMMIT | grep -E 'assets/translations|assets/src/translations')

if [ -n "$changed_files" ]; then
for file in $changed_files; do
# Extract the folder path from the file path to pass to the script
folder_path=$(echo "$file" | sed -E 's|(.*assets/(src/)?translations).*|\1|')
echo "Changes detected in $folder_path"
sh ./ci-scripts/validate-translations.sh "$folder_path"
done
else
echo "No translation changes detected"
exit 1
fi
70 changes: 70 additions & 0 deletions ci-scripts/validate-translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/sh
# scripts/handle-translation-changes.sh

# Function to check if an export statement exists in a file
check_export_statements() {
local folder=$1
local file=$2
local statement="from './$folder/index';"
if ! grep -q "$statement" "$file"; then
echo "$folder is not listed in $file"
exit 1
else
echo "$folder is already listed in $file"
fi
}

# Function to check import statements in index.ts files
check_import_statements() {
local folder=$1
local index_file="$folder_path/$folder/index.ts"
[ -f "$index_file" ] || { echo "Index file not found: $index_file"; exit 1; }

json_files=$(find "$folder_path/$folder" -maxdepth 1 -type f -name "*.json" -exec basename {} \;)
for json_file in $json_files; do
local statement="from './$json_file';"
if ! grep -q "$statement" "$index_file"; then
echo "$json_file not found in $index_file"
exit 1
else
echo "$json_file is already listed in $index_file"
fi
done
}

# Function to process a translation folder
process_translation_folder() {
local folder_path=$1
local translations_file="$folder_path/translations.ts"

if echo "$folder_path" | grep -q -e "/dist/" -e "/node_modules/"; then
return
fi

# Ensure the translations file exists
[ -f "$translations_file" ] || { echo "Translations file not found: $translations_file"; exit 1; }

# Get the list of translation folders
translation_folders=$(find "$folder_path" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)

# Check if each folder and index file is listed in the translations file
for folder in $translation_folders; do
check_export_statements "$folder" "$translations_file"
check_import_statements "$folder"
done
}

# Check if folder_path is provided as an argument
if [ -z "$1" ]; then
# Find all translation folders in the repository
translation_paths=$(find . -type d \( -path '*/assets/translations' -o -path '*/assets/src/translations' \))

for path in $translation_paths; do
process_translation_folder "$path"
done
else
folder_path=$1
process_translation_folder "$folder_path"
fi

echo "Translations all successfully validated"
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ type DefaultSsrOptimizationOptions = Omit<
'ssrFeatureToggles'
>
>;

export const defaultSsrOptimizationOptions: DefaultSsrOptimizationOptions = {
cache: false,
cacheSize: 3000,
Expand Down
2 changes: 2 additions & 0 deletions projects/storefrontapp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import { environment } from '../environments/environment';
import { TestOutletModule } from '../test-outlets/test-outlet.module';
import { SpartacusModule } from './spartacus/spartacus.module';

console.log('defaultSsrOptimizationOptions');

registerLocaleData(localeDe);
registerLocaleData(localeJa);
registerLocaleData(localeZh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { ViewConfig } from '../../../../shared/config/view-config';
import { ViewModes } from '../product-view/product-view.component';
import { ProductListComponentService } from './product-list-component.service';

/** test */

@Component({
selector: 'cx-product-list',
templateUrl: './product-list.component.html',
Expand Down