Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡️ Improve melos and workflow setup #2021

Merged
merged 10 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
30 changes: 0 additions & 30 deletions example_flutter_app/test/widget_test.dart

This file was deleted.

4 changes: 4 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ ide:
intellij:
enabled: true
moduleNamePrefix: ''

command:
bootstrap:
runPubGetInParallel: false
1 change: 1 addition & 0 deletions plugins/cookie_manager/test/basic_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@TestOn('vm')
import 'package:cookie_jar/cookie_jar.dart';
import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@TestOn('vm')
import 'dart:collection';
import 'dart:convert';
import 'dart:io';
Expand Down
1 change: 1 addition & 0 deletions plugins/cookie_manager/test/cookies_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@TestOn('vm')
import 'dart:io';
import 'dart:typed_data';

Expand Down
1 change: 1 addition & 0 deletions plugins/http2_adapter/test/http2_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@TestOn('vm')
import 'package:dio/dio.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
import 'package:test/test.dart';
Expand Down
2 changes: 1 addition & 1 deletion plugins/native_dio_adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

*None.*
- Adds the missing `flutter` dependency.

## 1.1.0

Expand Down
Loading