Skip to content

Commit

Permalink
ci: update pipeline with new localization progress checking
Browse files Browse the repository at this point in the history
  • Loading branch information
esmaeil-ahmadipour committed Jan 16, 2025
1 parent ecd9cfd commit d80518f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,31 @@ jobs:
echo "Code formatting issues detected. Run 'dart format .' and commit the changes.";
exit 1;
)
- name: Run Flutter Analyze
run: flutter analyze
- name: Generate Localization Files (Easy Localization)
- name: Generate Localization Files
id: gen_l10n
run: |
# Run the command to generate localization files and capture the output
output=$(flutter gen-l10n)
echo "$output"
# Check if there are untranslated messages in the output
if echo "$output" | grep -q "untranslated message"; then
echo "::error file=lib/l10n/l10n.yaml::Error: Untranslated messages detected in your localization files."
echo "::error::There are untranslated messages in the following languages:"
echo "$output" | grep "untranslated message"
echo "::error::Please ensure that all translations are provided in the respective .arb files."
exit 1
fi
- name: Check Localization Files
run: |
# Generate locale keys
dart run easy_localization:generate -f keys -o locale_keys.g.dart --source-dir=assets/translations --output-dir=lib/src/core/utils/gen/localization || (
echo "Error: Failed to generate locale keys.";
git diff --exit-code lib/l10n/ || (
echo "Localization files are outdated. Run 'flutter gen-l10n' and commit changes.";
exit 1;
)
- name: Run Dart Format and Check Localization Files Changes
- name: Check if translations_utils.dart has changes
run: |
# Run dart format without failing the step
dart format . || echo "dart format completed with warnings, but continuing pipeline."
# Check if there are changes in the localization files after generation
git diff --exit-code lib/src/core/utils/gen/localization || (
echo "Error: Localization files are outdated. Run the generation command and commit the changes.";
git diff --exit-code lib/src/core/utils/gen/localization/translations_utils.dart || (
echo "Error: Changes detected in translations_utils.dart. Please run the necessary custom translation utilities and commit changes.";
exit 1;
)
- name: Generate Assets Files
Expand All @@ -54,6 +62,18 @@ jobs:
echo "Error: Asset files are outdated. Run the generation command and commit the changes.";
exit 1;
)
- name: Run Flutter Analyze
run: flutter analyze
- name: Run Dart Format and Check Localization Files Changes
run: |
# Run dart format without failing the step
dart format . || echo "dart format completed with warnings, but continuing pipeline."
# Check if there are changes in the localization files after generation
git diff --exit-code lib/src/core/utils/gen/localization || (
echo "Error: Localization files are outdated. Run the generation command and commit the changes.";
exit 1;
)
- name: Run tests
run: flutter test
merge_check:
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"title": "¡Hola, Mundo !",
"subtitle": "Bienvenido a Localización",
"description": "Has pulsado el botón tantas veces:",
"switchLanguage": "Cambiar idioma",
"switch_language": "Cambiar idioma",
"applications": "Applications"
}
2 changes: 1 addition & 1 deletion lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"title": "Bonjour le monde !",
"subtitle": "Bienvenue dans Localisation",
"description": "Vous avez appuyé sur le bouton autant de fois :",
"switchLanguage": "Changer de langue",
"switch_language": "Changer de langue",
"applications": "Applications"
}

0 comments on commit d80518f

Please sign in to comment.