NNeoinit
db5d3e7e创建于 2025年11月5日历史提交
name: Dev Build
# https://maxim-saplin.github.io/data_table_2/dev/#/datatable2

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: macos-latest     
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v4
      with:
        distribution: 'temurin'
        java-version: '21'
        cache: gradle
    - uses: subosito/flutter-action@v2
      with:
        channel: 'stable'
        architecture: x64
        cache: true
        cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
    - name: Flutter Doctor
      run: flutter doctor
      working-directory: ./
    - name: Upgrades flutter
      run: flutter upgrade
      working-directory: ./
    - name: Enable Web
      run: flutter config --enable-web
      working-directory: ./example
    - name: Install dependencies
      run: flutter packages get
      working-directory: ./
      
    - name: Analyze
      run: |
        output=$(flutter analyze; exit_code=$?)
        echo "$output"
        if [ "$exit_code" -ne 0 ]; then
          echo "::warning::Flutter analyze found issues"
          echo "$output"
        fi
        exit 0  # Always exit 0 to prevent job failure
        
    - name: Run tests
      run: flutter test --coverage
#     - name: Upload coverage to codecov
#       run: curl -s https://codecov.io/bash
#       shell: bash
    - uses: codecov/codecov-action@v5
      with:
        #token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
        #files: ./coverage1.xml,./coverage2.xml # optional
        #flags: unittests # optional
        #name: codecov-umbrella # optional
        fail_ci_if_error: false # optional (default = false)
        verbose: true # optional (default = false)
      
    - name: Build Web
      run: flutter build web
      working-directory: ./example
      
    - name: Fix PWA
      run: sed -i'.js' -e 's+"/"+""+g' flutter_service_worker.js #https://github.com/flutter/flutter/issues/68449
      working-directory: ./example/build/web
      
    - name: Deploy 🚀
      uses: JamesIves/github-pages-deploy-action@v4.3.3
      with:
        branch: gh-pages # The branch the action should deploy to.
        target-folder: /dev # root folder is stable example build, /dev is the current main build
        folder: ./example/build/web