Skip to content

Commit

Permalink
ci: update ci for checking assets & translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
esmaeil-ahmadipour committed Dec 13, 2024
1 parent e70c8d3 commit f77a31c
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,43 @@ jobs:
flutter-version: '3.24.5'
- name: Install dependencies
run: flutter pub get
# - 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: |
# git diff --exit-code lib/l10n/ || (
# echo "Localization files are outdated. Run 'flutter gen-l10n' and commit changes.";
# exit 1;
# )
- name: Run Dart Format Check
- name: Run Dart Format Check (Efficient)
run: |
dart format . --set-exit-if-changed || (
# Exclude generated files (e.g., .g.dart, .freezed.dart) from the dart format check
dart format . --set-exit-if-changed --output none --exclude=**/*.g.dart --exclude=**/*.freezed.dart || (
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)
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.";
exit 1;
)
- name: Check Localization Files Changes
run: |
# Check if there are changes after generating localization files
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: Generate Assets Files
run: |
# Command to rebuild asset files
dart run build_runner build --delete-conflicting-outputs --build-filter="lib/src/core/utils/gen/assets/*.dart" || (
echo "Error: Failed to generate asset files.";
exit 1;
)
- name: Check Asset Files Changes
run: |
# Check if there are changes after generating asset files
git diff --exit-code lib/src/core/utils/gen/assets || (
echo "Error: Asset files are outdated. Run the generation command and commit the changes.";
exit 1;
)
- name: Run tests
run: flutter test
merge_check:
Expand Down

0 comments on commit f77a31c

Please sign in to comment.