Update lint.yml #5
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: CI/CD Workflow with Strict Linting | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.19.4' | |
- name: Get dependencies | |
run: | | |
cd app | |
flutter pub get | |
- name: Run Flutter Analyzer | |
run: | | |
cd app | |
flutter analyze > analysis_result.txt | |
grep -v "TODO" analysis_result.txt > filtered_result.txt | |
cat filtered_result.txt | |
if [ -s filtered_result.txt ] && [ "$(wc -l < filtered_result.txt)" -gt 0 ]; then | |
echo "Linting issues found, failing the workflow." | |
exit 1 | |
else | |
echo "No linting issues found." | |
fi | |
- name: Check Version Bump | |
run: | | |
cd app | |
PREV_VERSION=$(git show HEAD~1:app/pubspec.yaml | grep '^version:' | awk '{print $2}') | |
CURR_VERSION=$(grep '^version:' app/pubspec.yaml | awk '{print $2}') | |
if [ "$PREV_VERSION" == "$CURR_VERSION" ]; then | |
echo "Version has not been bumped. Failing the workflow." | |
exit 1 | |
fi |