| name: package:cupertino_http CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - 'pkgs/cupertino_http/**' | |
| - 'pkgs/http_client_conformance_tests/**' | |
| - '.github/workflows/cupertino.yml' | |
| pull_request: | |
| paths: | |
| - 'pkgs/cupertino_http/**' | |
| - 'pkgs/http_client_conformance_tests/**' | |
| - '.github/workflows/cupertino.yml' | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| env: | |
| PUB_ENVIRONMENT: bot.github | |
| jobs: | |
| analyze: | |
| name: Lint and static analysis | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: pkgs/cupertino_http | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| - id: install | |
| name: Install dependencies | |
| run: flutter pub get | |
| - name: Check formatting | |
| # Don't lint the generated file native_cupertino_bindings.dart | |
| # This approach is simpler than using `find` and excluding that file | |
| # because `dart format` also excludes other file e.g. ones in | |
| # directories start with '.'. | |
| run: > | |
| mv lib/src/native_cupertino_bindings.dart lib/src/native_cupertino_bindings.tmp && | |
| dart format --output=none --set-exit-if-changed . && | |
| mv lib/src/native_cupertino_bindings.tmp lib/src/native_cupertino_bindings.dart | |
| if: always() && steps.install.outcome == 'success' | |
| - name: Analyze code | |
| run: flutter analyze --fatal-infos | |
| if: always() && steps.install.outcome == 'success' | |
| test: | |
| # Test package:cupertino_http use flutter integration tests. | |
| needs: analyze | |
| name: "Build and test" | |
| strategy: | |
| matrix: | |
| # Test on the minimum supported flutter version and the latest | |
| # version. | |
| flutter-version: ["3.16.0", "any"] | |
| runs-on: macos-latest | |
| defaults: | |
| run: | |
| working-directory: pkgs/cupertino_http/example | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: futureware-tech/simulator-action@v3 | |
| with: | |
| model: 'iPhone 8' | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ matrix.flutter-version }} | |
| channel: 'stable' | |
| - name: Run tests | |
| # TODO: Remove the retries when | |
| # https://github.com/flutter/flutter/issues/121231 is fixed. | |
| # See https://github.com/dart-lang/http/issues/938 for context. | |
| run: | | |
| for i in {1..6} | |
| do | |
| flutter test integration_test/main.dart && break | |
| if [ $i -eq 6 ] | |
| then | |
| exit 1 | |
| fi | |
| echo "Retry $i" | |
| done |