Skip to content

build(deps): bump the all-dependencies group across 1 directory with 12 updates #128

build(deps): bump the all-dependencies group across 1 directory with 12 updates

build(deps): bump the all-dependencies group across 1 directory with 12 updates #128

Workflow file for this run

name: Flutter PR Checks
on:
pull_request:
branches: [ main ]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
# Checks out the repository code for the workflow to access.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to compare with main
# Check if code files changed (skip analysis if only non-code files changed)
- name: Check for code changes
id: code_changes
run: |
# Get list of changed files compared to main
changed_files=$(git diff --name-only origin/main...HEAD)
echo "Changed files:"
echo "$changed_files"
# Check if any changes are in lib, android, ios, or test directories
code_changes=$(echo "$changed_files" | grep -E '^(lib|android|ios|test)/' || true)
if [ -z "$code_changes" ]; then
echo "ℹ️ No code changes detected. Skipping analysis."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "📝 Code changes detected. Running analysis."
echo "skip=false" >> $GITHUB_OUTPUT
fi
# Sets up the Flutter environment with a specific version and channel.
- name: Set up Flutter
if: steps.code_changes.outputs.skip != 'true'
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.4'
channel: 'stable'
cache: true
# Creates a dummy .env file for CI purposes, providing a base URL for the API.
- name: Create dummy .env file
if: steps.code_changes.outputs.skip != 'true'
run: echo "API_BASE_URL=http://dummy.api.for.ci" > .env
# Installs all project dependencies listed in pubspec.yaml.
- name: Install dependencies
if: steps.code_changes.outputs.skip != 'true'
run: flutter pub get
# Analyzes the Flutter project for any issues, failing the job if infos are found.
- name: Analyze project
if: steps.code_changes.outputs.skip != 'true'
run: flutter analyze --fatal-infos # Fails the job if any issues are found
version-check:
name: Check version bump
runs-on: ubuntu-latest
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.user.login != 'dependabot-preview[bot]'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to compare with main
- name: Ensure version bumped
run: |
# Check if there are changes in code directories (lib, android, ios)
echo "Checking for changes in lib/, android/, or ios/ directories..."
# Get list of changed files compared to main
changed_files=$(git diff --name-only origin/main...HEAD)
echo "Changed files:"
echo "$changed_files"
# Check if any changes are in lib, android, or ios directories
code_changes=$(echo "$changed_files" | grep -E '^(lib|android|ios)/' || true)
if [ -z "$code_changes" ]; then
echo "ℹ️ No changes in lib/, android/, or ios/ directories."
echo "ℹ️ Skipping version bump check (only non-code files changed)."
exit 0
fi
echo "📝 Code changes detected in:"
echo "$code_changes"
echo ""
echo "Checking version bump..."
# Extract current PR version
pr_version=$(grep '^version:' pubspec.yaml | awk '{print $2}')
# Extract version from main branch
main_version=$(git show origin/main:pubspec.yaml | grep '^version:' | awk '{print $2}')
echo "PR version: $pr_version"
echo "Main version: $main_version"
if [ "$pr_version" = "$main_version" ]; then
echo "❌ Version not bumped! Please update pubspec.yaml before merging."
exit 1
else
echo "✅ Version bumped."
fi
test:
name: Test
runs-on: ubuntu-latest
steps:
# Checks out the repository code for the workflow to access.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to compare with main
# Check if code files changed (skip tests if only non-code files changed)
- name: Check for code changes
id: code_changes
run: |
# Get list of changed files compared to main
changed_files=$(git diff --name-only origin/main...HEAD)
echo "Changed files:"
echo "$changed_files"
# Check if any changes are in lib, android, ios, or test directories
code_changes=$(echo "$changed_files" | grep -E '^(lib|android|ios|test)/' || true)
if [ -z "$code_changes" ]; then
echo "ℹ️ No code changes detected. Skipping tests."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "📝 Code changes detected. Running tests."
echo "skip=false" >> $GITHUB_OUTPUT
fi
# Sets up the Flutter environment with a specific version and channel.
- name: Set up Flutter
if: steps.code_changes.outputs.skip != 'true'
uses: subosito/flutter-action@v2
with:
flutter-version: '3.38.4'
channel: 'stable'
cache: true
# Creates a dummy .env file for CI purposes, providing a base URL for the API.
- name: Create dummy .env file
if: steps.code_changes.outputs.skip != 'true'
run: |
echo "API_BASE_URL=http://dummy.api.for.ci" > .env
echo "API_BASE_URL_DEBUG=http://dummy.api.for.ci" >> .env
# Installs all project dependencies listed in pubspec.yaml.
- name: Install dependencies
if: steps.code_changes.outputs.skip != 'true'
run: flutter pub get
# Runs all tests defined in the Flutter project.
- name: Run tests
if: steps.code_changes.outputs.skip != 'true'
run: flutter test