diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml new file mode 100644 index 0000000..5ea0247 --- /dev/null +++ b/.github/workflows/flutter.yml @@ -0,0 +1,47 @@ +name: Flutter CI + +on: + push: + branches: + - master # Runs on pushes to the main branch + pull_request: + branches: + - '**' # Runs on all pull requests + +jobs: + flutter-test: + name: Run Flutter Tests + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the code + - name: Checkout Code + uses: actions/checkout@v3 + + # Step 2: Set up Flutter + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: 3.13.0 + + # Step 3: Precache Dependencies + - name: Flutter Precache + run: flutter precache + + # Step 4: Run Flutter Doctor (Optional, for Debugging) + - name: Flutter Doctor + run: flutter doctor + + # Step 5: Run Tests + - name: Run Tests + run: flutter test + + # Cache dependencies + - name: Cache Pub Dependencies + uses: actions/cache@v3 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.yaml') }} + restore-keys: | + ${{ runner.os }}-pub-cache- + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a33f34b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -os: - - linux -dist: focal # Use Ubuntu Focal (20.04) for a more up-to-date environment -sudo: false - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++6 - - fonts-droid-fallback - -before_script: - # Clone the Flutter repository and ensure proper initialization - - git clone https://github.com/flutter/flutter.git -b stable # Use stable instead of beta for reliability - - export PATH="$PATH:`pwd`/flutter/bin" # Add Flutter to PATH - - flutter --version # Verify Flutter installation - - flutter precache # Precache necessary artifacts for the Flutter SDK - - flutter doctor # Verify the Flutter environment - -script: - - flutter test # Run Flutter tests - -cache: - directories: - - $HOME/.pub-cache # Cache the pub packages - - flutter # Cache the Flutter SDK