feat: add easy localization package to project #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linting & Tests Validation | |
on: | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
lint_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
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 | |
run: | | |
dart format . --set-exit-if-changed || ( | |
echo "Code formatting issues detected. Run 'dart format .' and commit the changes."; | |
exit 1; | |
) | |
- name: Run Flutter Analyze | |
run: flutter analyze | |
- name: Run tests | |
run: flutter test | |
merge_check: | |
runs-on: ubuntu-latest | |
needs: lint_and_test | |
if: ${{ success() }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Merge Pull Request | |
run: echo "Linting and tests passed successfully.Merge request is ready for merge" |