Skip to content

Commit

Permalink
Merge branch 'main' into feat/case-sensitive-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Nov 9, 2023
2 parents e45031f + d427b50 commit e5244cb
Show file tree
Hide file tree
Showing 21 changed files with 160 additions and 261 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/publishable.yml

This file was deleted.

154 changes: 34 additions & 120 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Verify packages abilities

on:
push:
Expand All @@ -14,136 +14,50 @@ on:
paths-ignore:
- "**.md"

jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
strategy:
matrix:
directory: [
"dio",
"example",
"example_flutter_app",
"plugins/cookie_manager",
"plugins/http2_adapter",
"plugins/native_dio_adapter"
]
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: stable
- run: dart format --set-exit-if-changed .

analyze:
needs: format
name: Analyze Dart-only libraries
runs-on: ubuntu-latest
strategy:
matrix:
directory: ["dio", "example", "plugins/cookie_manager", "plugins/http2_adapter"]
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- uses: actions/checkout@v3
- name: Prepare Dart SDK
uses: dart-lang/[email protected]
with:
sdk: stable
- name: Analyze
run: dart pub get && dart analyze --fatal-infos

analyze_flutter:
needs: format
name: Analyze Flutter libraries
runs-on: ubuntu-latest
strategy:
matrix:
directory: ["example_flutter_app", "plugins/native_dio_adapter"]
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- uses: actions/checkout@v3
- name: Prepare Flutter SDK
uses: subosito/[email protected]
with:
cache: true
channel: stable
- name: Analyze
run: flutter pub get && flutter analyze --fatal-infos
defaults:
run:
shell: bash -leo pipefail {0}

test_dio:
needs: [analyze, analyze_flutter]
name: Run unit tests with dio
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ 2.15.0, stable, beta ]
platform: [ vm, chrome, firefox ]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}
- run: |
chmod +x ./scripts/prepare_pinning_certs.sh
./scripts/prepare_pinning_certs.sh
shell: bash
- run: dart pub get
working-directory: dio
- run: dart test --chain-stack-traces --platform=${{ matrix.platform }}
working-directory: dio

test_plugins:
needs: [analyze, analyze_flutter]
name: Run unit tests with plugins
jobs:
workflows:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ 2.15.0, stable, beta ]
directory: ["plugins/cookie_manager", "plugins/http2_adapter"]
sdk: [ min, stable, beta ]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
- uses: subosito/[email protected]
with:
sdk: ${{ matrix.sdk }}
cache: true
flutter-version: ${{ matrix.sdk == 'min' && '2.8.0' || '' }}
channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }}
- run: |
chmod +x ./scripts/prepare_pinning_certs.sh
./scripts/prepare_pinning_certs.sh
shell: bash
- name: Install proxy
if: matrix.directory == 'plugins/http2_adapter'
- name: Install proxy for tests
run: sudo apt-get install -y squid
- run: dart pub get
working-directory: ${{ matrix.directory }}
- run: dart test --chain-stack-traces
working-directory: ${{ matrix.directory }}

test_flutter_plugins:
needs: [analyze, analyze_flutter]
name: Run unit tests with Flutter plugins
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
channel: [ min, stable, beta ]
directory: ["plugins/native_dio_adapter"]
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- uses: actions/checkout@v3
- name: Prepare Flutter SDK
uses: subosito/[email protected]
- uses: bluefireteam/melos-action@v2
with:
cache: true
flutter-version: ${{ matrix.channel == 'min' && '3.13.0' || '' }}
channel: ${{ matrix.channel == 'min' && 'stable' || matrix.channel }}
- run: flutter test
run-bootstrap: false
- name: Patching files for Flutter ${{ matrix.sdk }}
run: dart ./scripts/files_patch.dart
- name: Check satisfied packages
run: |
dart ./scripts/melos_ignored_packages.dart
echo $(cat .melos_ignored_packages) >> ~/.bash_profile
- name: Bootstrap
run: melos bootstrap $(eval echo $IGNORED_PACKAGES)
- name: '[Verify step] Format'
run: melos exec $(eval echo $IGNORED_PACKAGES) -- "dart format --set-exit-if-changed ."
- name: '[Verify step] Analyze Dart packages'
run: melos exec $(eval echo $IGNORED_PACKAGES) --no-flutter -- "dart analyze --fatal-infos"
- name: '[Verify step] Analyze Flutter packages'
run: melos exec $(eval echo $IGNORED_PACKAGES) --flutter -- "flutter analyze --fatal-infos"
- name: '[Verify step] Publish dry-run'
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" -- "dart pub publish --dry-run"
- name: '[Verify step] Test Dart packages'
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --no-flutter -- "dart test --chain-stack-traces --platform=vm,chrome,firefox"
- name: '[Verify step] Test Flutter packages'
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --flutter -- "flutter test"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.example/flutter.png
build/
# Remove the following pattern if you wish to check in your lock file
**/pubspec.lock
pubspec.lock

# Directory created by dartdoc
doc/api/
Expand Down Expand Up @@ -41,6 +41,7 @@ plugins/http2_adapter/test/*_pinning.txt

# Miscellaneous
.DS_Store
.melos*packages

# IDEA configurations
/.idea/*
Expand Down
9 changes: 5 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ include: package:lints/recommended.yaml

analyzer:
errors:
deprecated_member_use_from_same_package: ignore
todo: ignore

linter:
rules:
- prefer_final_locals
- prefer_final_in_for_each
- prefer_single_quotes
- unnecessary_parenthesis
prefer_final_locals: true
prefer_final_in_for_each: true
prefer_single_quotes: true
unnecessary_parenthesis: true
6 changes: 3 additions & 3 deletions dio/README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void main() {
我们通过 `HttpClientAdapter``Dio``HttpClient` 解耦,
这样一来便可以自由定制 HTTP 请求的底层实现。
Dio 使用 `IOHttpClientAdapter` 作为原生平台默认的桥梁,
`BrowserClientAdapter` 作为 Web 平台的桥梁。
`BrowserHttpClientAdapter` 作为 Web 平台的桥梁。
你可以通过 `HttpClientAdapter()` 来根据平台创建它们。

```dart
Expand All @@ -704,13 +704,13 @@ dio.httpClientAdapter = HttpClientAdapter();
```dart
import 'package:dio/browser.dart';
// ...
dio.httpClientAdapter = BrowserClientAdapter();
dio.httpClientAdapter = BrowserHttpClientAdapter();
```
- 对于原生平台:
```dart
import 'package:dio/io.dart';
// ...
dio.httpClientAdapter = IOClientAdapter();
dio.httpClientAdapter = IOHttpClientAdapter();
```

[示例](../example/lib/adapter.dart) 中包含了一个简单的自定义桥接。
Expand Down
6 changes: 3 additions & 3 deletions dio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ There is an example for [customizing Transformer](../example/lib/transformer.dar
We can use any `HttpClient` not just `dart:io:HttpClient` to make HTTP requests.
And all we need is providing a `HttpClientAdapter`.
The default `HttpClientAdapter` for Dio is `IOHttpClientAdapter` on native platforms,
and `BrowserClientAdapter` on the Web platform.
and `BrowserHttpClientAdapter` on the Web platform.
They can be initiated by calling the `HttpClientAdapter()`.

```dart
Expand All @@ -729,13 +729,13 @@ If you want to use platform adapters explicitly:
```dart
import 'package:dio/browser.dart';
// ...
dio.httpClientAdapter = BrowserClientAdapter();
dio.httpClientAdapter = BrowserHttpClientAdapter();
```
- For native platforms:
```dart
import 'package:dio/io.dart';
// ...
dio.httpClientAdapter = IOClientAdapter();
dio.httpClientAdapter = IOHttpClientAdapter();
```

[Here](../example/lib/adapter.dart) is a simple example to custom adapter.
Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/dio_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class DioException implements Exception {
}) =>
DioException(
type: DioExceptionType.connectionError,
message: 'The connection errored: $reason. '
message: 'The connection errored: $reason '
'This indicates an error which most likely cannot be solved by the library.',
requestOptions: requestOptions,
response: null,
Expand Down
1 change: 0 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ dependency_overrides:

dev_dependencies:
lints: any
test: ^1.22.1
31 changes: 0 additions & 31 deletions example/test/example_test.dart

This file was deleted.

2 changes: 0 additions & 2 deletions example_flutter_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ dependencies:
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
sdk: flutter
lints: any

# For information on the generic Dart part of this file, see the
Expand Down
Loading

0 comments on commit e5244cb

Please sign in to comment.