From d6d8314aa78996c9e79edd68a12834b48c9f3e22 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Sat, 9 Dec 2023 16:49:28 -0600 Subject: [PATCH] ci: revamp workflows (#4020) --- .github/DOCS_ISSUE_TEMPLATE.md | 15 - .../actions/angular_dart_package/action.yaml | 81 +++++ .github/actions/dart_package/action.yaml | 103 +++++++ .github/actions/flutter_package/action.yaml | 119 +++++++ .github/codecov.yml | 3 + .github/workflows/angular_bloc.yaml | 70 ----- .github/workflows/angular_dart_examples.yaml | 70 ----- .github/workflows/bloc.yaml | 68 ---- .github/workflows/bloc_concurrency.yaml | 68 ---- .github/workflows/bloc_test.yaml | 68 ---- .github/workflows/bloc_tools.yaml | 69 ----- .github/workflows/build.yaml | 22 -- .github/workflows/docs.yaml | 21 -- .github/workflows/flutter_bloc.yaml | 66 ---- .github/workflows/flutter_examples.yaml | 92 ------ .github/workflows/hydrated_bloc.yaml | 66 ---- .github/workflows/main.yaml | 290 ++++++++++++++++++ .github/workflows/replay_bloc.yaml | 66 ---- packages/bloc_tools/pubspec.yaml | 2 +- 19 files changed, 597 insertions(+), 762 deletions(-) delete mode 100644 .github/DOCS_ISSUE_TEMPLATE.md create mode 100644 .github/actions/angular_dart_package/action.yaml create mode 100644 .github/actions/dart_package/action.yaml create mode 100644 .github/actions/flutter_package/action.yaml create mode 100644 .github/codecov.yml delete mode 100644 .github/workflows/angular_bloc.yaml delete mode 100644 .github/workflows/angular_dart_examples.yaml delete mode 100644 .github/workflows/bloc.yaml delete mode 100644 .github/workflows/bloc_concurrency.yaml delete mode 100644 .github/workflows/bloc_test.yaml delete mode 100644 .github/workflows/bloc_tools.yaml delete mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/docs.yaml delete mode 100644 .github/workflows/flutter_bloc.yaml delete mode 100644 .github/workflows/flutter_examples.yaml delete mode 100644 .github/workflows/hydrated_bloc.yaml create mode 100644 .github/workflows/main.yaml delete mode 100644 .github/workflows/replay_bloc.yaml diff --git a/.github/DOCS_ISSUE_TEMPLATE.md b/.github/DOCS_ISSUE_TEMPLATE.md deleted file mode 100644 index 19d8cde3172..00000000000 --- a/.github/DOCS_ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "[Translations] Update docs" -labels: documentation, translation ---- -Update Translations to include changes from {{ sha }}. - -- [ ] az (@KenanYusubov) -- [ ] cs -- [ ] es (@KingDarBoja or @Classy-Bear) -- [ ] fr (@sachaarbonel or @StefanYYC) -- [ ] jp (@dshukertjr) -- [ ] ko-kr (@zoomKoding) -- [ ] pt-br (@rodrigobastosv or @alisson-suzigan) -- [ ] ru (@basilex) -- [ ] zh-cn (@jakecastelli) diff --git a/.github/actions/angular_dart_package/action.yaml b/.github/actions/angular_dart_package/action.yaml new file mode 100644 index 00000000000..2ffa5314a60 --- /dev/null +++ b/.github/actions/angular_dart_package/action.yaml @@ -0,0 +1,81 @@ +name: Angular Dart Package Workflow +description: Build and test Angular Dart packages. + +inputs: + codecov_token: + required: true + description: The Codecov token used to upload coverage + concurrency: + required: false + default: "4" + description: The value of the concurrency flag (-j) used when running tests + coverage_excludes: + required: false + default: "" + description: Globs to exclude from coverage + dart_sdk: + required: false + default: "stable" + description: "The dart sdk version to use" + working_directory: + required: false + default: "." + description: The working directory for this workflow + min_coverage: + required: false + default: "100" + description: The minimum coverage percentage value + min_score: + required: false + default: "120" + description: The minimum pana score value + analyze_directories: + required: false + default: "lib test" + description: Directories to analyze + report_on: + required: false + default: "lib" + description: Directories to report on when collecting coverage + platform: + required: false + default: "vm" + description: Platform to use when running tests + +runs: + using: "composite" + steps: + - name: ๐ŸŽฏ Setup Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: ${{inputs.dart_sdk}} + + - name: ๐Ÿ“ฆ Install Dependencies + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart pub get + + - name: ๐Ÿ› ๏ธ Build + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + dart pub global activate webdev + webdev build + + - name: โœจ Format + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart format --set-exit-if-changed . + + - name: ๐Ÿ” Analyze + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart analyze --fatal-warnings ${{inputs.analyze_directories}} + + - name: ๐Ÿงช Test + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + if [ -d "test" ]; then + dart run build_runner test --fail-on-severe + fi diff --git a/.github/actions/dart_package/action.yaml b/.github/actions/dart_package/action.yaml new file mode 100644 index 00000000000..cd590030950 --- /dev/null +++ b/.github/actions/dart_package/action.yaml @@ -0,0 +1,103 @@ +name: Dart Package Workflow +description: Build and test Dart packages. + +inputs: + codecov_token: + required: true + description: The Codecov token used to upload coverage + concurrency: + required: false + default: "4" + description: The value of the concurrency flag (-j) used when running tests + coverage_excludes: + required: false + default: "" + description: Globs to exclude from coverage + dart_sdk: + required: false + default: "stable" + description: "The dart sdk version to use" + working_directory: + required: false + default: "." + description: The working directory for this workflow + min_coverage: + required: false + default: "100" + description: The minimum coverage percentage value + min_score: + required: false + default: "120" + description: The minimum pana score value + analyze_directories: + required: false + default: "lib test" + description: Directories to analyze + report_on: + required: false + default: "lib" + description: Directories to report on when collecting coverage + +runs: + using: "composite" + steps: + - name: ๐ŸŽฏ Setup Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: ${{inputs.dart_sdk}} + + - name: ๐Ÿ“ฆ Install Dependencies + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart pub get + + - name: โœจ Format + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart format --set-exit-if-changed . + + - name: ๐Ÿ” Analyze + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart analyze --fatal-warnings ${{inputs.analyze_directories}} + + - name: ๐Ÿงช Test + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + dart pub global activate coverage + dart test -j ${{inputs.concurrency}} --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=${{inputs.report_on}} --check-ignore + + - name: ๐Ÿ“ฆ Detect Package Name + env: + PACKAGE_PATH: ${{ inputs.working_directory}} + id: package + shell: ${{ inputs.shell }} + run: echo "name=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT + + - name: โฌ†๏ธ Upload Coverage + uses: codecov/codecov-action@v3 + env: + PACKAGE_PATH: ${{ inputs.working_directory}} + with: + flags: ${{ steps.package.outputs.name }} + token: ${{ inputs.codecov_token }} + + - name: ๐Ÿ“Š Verify Coverage + uses: VeryGoodOpenSource/very_good_coverage@v2 + with: + path: ${{inputs.working_directory}}/coverage/lcov.info + exclude: ${{inputs.coverage_excludes}} + min_coverage: ${{inputs.min_coverage}} + + - name: ๐Ÿ’ฏ Verify Pub Score + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + dart pub global activate pana + sudo apt-get install webp + PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") + echo "score: $PANA_SCORE" + IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1] + if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi + if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi diff --git a/.github/actions/flutter_package/action.yaml b/.github/actions/flutter_package/action.yaml new file mode 100644 index 00000000000..1a2426eb2c3 --- /dev/null +++ b/.github/actions/flutter_package/action.yaml @@ -0,0 +1,119 @@ +name: Flutter Package Workflow +description: Build and test a Flutter package. + +inputs: + codecov_token: + required: true + description: The Codecov token used to upload coverage + collect_coverage: + required: false + default: "true" + description: Whether to collect code coverage + collect_score: + required: false + default: "true" + description: Whether to collect the pana score + concurrency: + required: false + default: "4" + description: The value of the concurrency flag (-j) used when running tests + coverage_excludes: + required: false + default: "" + description: Globs to exclude from coverage + working_directory: + required: false + default: "." + description: The working directory for this workflow + min_coverage: + required: false + default: "100" + description: The minimum coverage percentage value + analyze_directories: + required: false + default: "lib test" + description: Directories to analyze + report_on: + required: false + default: "lib" + description: Directories to report on when collecting coverage + platform: + required: false + default: "vm" + description: Platform to use when running tests + +runs: + using: "composite" + steps: + - name: ๐Ÿฆ Setup Flutter + uses: subosito/flutter-action@v2 + + - name: ๐Ÿ“ฆ Install Dependencies + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: flutter pub get + + - name: โœจ Format + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart format --set-exit-if-changed . + + - name: ๐Ÿ” Analyze + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: dart analyze --fatal-warnings ${{inputs.analyze_directories}} + + - name: ๐Ÿงช Test + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + if [ -d "test" ]; then + flutter test --no-pub --test-randomize-ordering-seed random --coverage + fi + + - name: Exclude Generated Code from Coverage + if: ${{ inputs.collect_coverage == 'true' && inputs.coverage_excludes != '' }} + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + mv coverage/lcov.info coverage/lcov.info.bak + sudo apt-get -y install lcov + lcov --remove coverage/lcov.info.bak "${{inputs.coverage_excludes}}" -o coverage/lcov.info + + - name: ๐Ÿ“ฆ Detect Package Name + if: inputs.collect_coverage == 'true' + env: + PACKAGE_PATH: ${{ inputs.working_directory}} + id: package + shell: ${{ inputs.shell }} + run: echo "name=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT + + - name: โฌ†๏ธ Upload Coverage + if: inputs.collect_coverage == 'true' + uses: codecov/codecov-action@v3 + env: + PACKAGE_PATH: ${{ inputs.working_directory}} + with: + flags: ${{ steps.package.outputs.name }} + token: ${{ inputs.codecov_token }} + + - name: ๐Ÿ“Š Verify Coverage + if: inputs.collect_coverage == 'true' + uses: VeryGoodOpenSource/very_good_coverage@v2 + with: + path: ${{inputs.working_directory}}/coverage/lcov.info + exclude: ${{inputs.coverage_excludes}} + min_coverage: ${{inputs.min_coverage}} + + - name: ๐Ÿ’ฏ Verify Pub Score + if: inputs.collect_score == 'true' + working-directory: ${{ inputs.working_directory }} + shell: ${{ inputs.shell }} + run: | + dart pub global activate pana + sudo apt-get install webp + PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") + echo "score: $PANA_SCORE" + IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1] + if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi + if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000000..b7052f68ce4 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,3 @@ +flag_management: + default_rules: + carryforward: true diff --git a/.github/workflows/angular_bloc.yaml b/.github/workflows/angular_bloc.yaml deleted file mode 100644 index 43a58e4f364..00000000000 --- a/.github/workflows/angular_bloc.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: angular_bloc - -on: - push: - paths: - - "packages/angular_bloc/**" - - ".github/workflows/angular_bloc.yaml" - - pull_request: - paths: - - "packages/angular_bloc/**" - - ".github/workflows/angular_bloc.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/angular_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 - with: - sdk: 3.0.0 - - - name: Install Dependencies - run: dart pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: dart analyze --fatal-infos --fatal-warnings . - - - name: Run Tests - run: | - dart pub global activate coverage 1.2.0 - dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/angular_bloc/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/angular_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh 110 diff --git a/.github/workflows/angular_dart_examples.yaml b/.github/workflows/angular_dart_examples.yaml deleted file mode 100644 index 3e9ec6582b0..00000000000 --- a/.github/workflows/angular_dart_examples.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: angular_dart_examples - -on: - push: - paths: - - ".github/workflows/angular_dart_examples.yaml" - - "packages/angular_bloc/**" - - "examples/angular_counter/**" - - "examples/github_search/common_github_search/**" - - "examples/github_search/angular_github_search/**" - - pull_request: - paths: - - ".github/workflows/angular_dart_examples.yaml" - - "packages/angular_bloc/**" - - "examples/angular_counter/**" - - "examples/github_search/common_github_search/**" - - "examples/github_search/angular_github_search/**" - -jobs: - examples: - strategy: - matrix: - folder: - [ - "examples/angular_counter", - "examples/github_search/common_github_search", - "examples/github_search/angular_github_search", - ] - fail-fast: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: dart-lang/setup-dart@v1 - with: - sdk: 3.0.0 - - - name: Install Dependencies - working-directory: ${{ matrix.folder }} - run: dart pub get - - - name: Install webdev - if: matrix.folder != 'examples/github_search/common_github_search' - working-directory: ${{ matrix.folder }} - run: | - dart pub global activate webdev - webdev build - - - name: Format - working-directory: ${{ matrix.folder }} - run: dart format --set-exit-if-changed . - - - name: Analyze - working-directory: ${{ matrix.folder }} - run: dart analyze --fatal-infos --fatal-warnings . - - - name: Run tests - working-directory: ${{ matrix.folder }} - run: | - if [ -d "test" ]; then - dart run build_runner test --fail-on-severe - fi - - build: - needs: [examples] - runs-on: ubuntu-latest - steps: - - name: noop - run: echo 'noop' diff --git a/.github/workflows/bloc.yaml b/.github/workflows/bloc.yaml deleted file mode 100644 index 2c1a9cebbae..00000000000 --- a/.github/workflows/bloc.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: bloc - -on: - push: - paths: - - "packages/bloc/**" - - ".github/workflows/bloc.yaml" - - pull_request: - paths: - - "packages/bloc/**" - - ".github/workflows/bloc.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 - - - name: Install Dependencies - run: dart pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: dart analyze --fatal-infos --fatal-warnings . - - - name: Run Tests - run: | - dart pub global activate coverage 1.2.0 - dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/bloc/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/.github/workflows/bloc_concurrency.yaml b/.github/workflows/bloc_concurrency.yaml deleted file mode 100644 index ec368b74332..00000000000 --- a/.github/workflows/bloc_concurrency.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: bloc_concurrency - -on: - push: - paths: - - "packages/bloc_concurrency/**" - - ".github/workflows/bloc_concurrency.yaml" - - pull_request: - paths: - - "packages/bloc_concurrency/**" - - ".github/workflows/bloc_concurrency.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/bloc_concurrency - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 - - - name: Install Dependencies - run: dart pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: dart analyze --fatal-infos --fatal-warnings . - - - name: Run Tests - run: | - dart pub global activate coverage 1.2.0 - dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/bloc_concurrency/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/bloc_concurrency - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/.github/workflows/bloc_test.yaml b/.github/workflows/bloc_test.yaml deleted file mode 100644 index 2fc7690d7f5..00000000000 --- a/.github/workflows/bloc_test.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: bloc_test - -on: - push: - paths: - - "packages/bloc_test/**" - - ".github/workflows/bloc_test.yaml" - - pull_request: - paths: - - "packages/bloc_test/**" - - ".github/workflows/bloc_test.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/bloc_test - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 - - - name: Install Dependencies - run: dart pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: dart analyze --fatal-infos --fatal-warnings . - - - name: Run Tests - run: | - dart pub global activate coverage 1.2.0 - dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/bloc_test/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/bloc_test - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/.github/workflows/bloc_tools.yaml b/.github/workflows/bloc_tools.yaml deleted file mode 100644 index 3ceca1a39d8..00000000000 --- a/.github/workflows/bloc_tools.yaml +++ /dev/null @@ -1,69 +0,0 @@ -name: bloc_tools - -on: - pull_request: - paths: - - ".github/workflows/bloc_tools.yaml" - - "packages/bloc_tools/**" - push: - branches: - - master - paths: - - ".github/workflows/bloc_tools.yaml" - - "packages/bloc_tools/**" - -jobs: - build: - defaults: - run: - working-directory: packages/bloc_tools - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: flutter packages get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: flutter analyze . - - - name: Verify Build - run: flutter pub run test --run-skipped -t pull-request-only - - - name: Run Tests - run: flutter test -x pull-request-only --no-pub --coverage --test-randomize-ordering-seed random - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/bloc_tools/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/bloc_tools - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index f3e3aeeced0..00000000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: build - -on: - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: noop - run: echo 'noop' - - semantic_pull_request: - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1 - - pana: - runs-on: ubuntu-latest - steps: - - name: noop - run: echo 'noop' diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml deleted file mode 100644 index e8d1cf661bc..00000000000 --- a/.github/workflows/docs.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: docs - -on: - push: - branches: - - master - paths: - - '.github/workflows/docs.yaml' - - 'README.md' - - 'docs/*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/DOCS_ISSUE_TEMPLATE.md diff --git a/.github/workflows/flutter_bloc.yaml b/.github/workflows/flutter_bloc.yaml deleted file mode 100644 index 734f487b131..00000000000 --- a/.github/workflows/flutter_bloc.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: flutter_bloc - -on: - push: - paths: - - "packages/flutter_bloc/**" - - ".github/workflows/flutter_bloc.yaml" - - pull_request: - paths: - - "packages/flutter_bloc/**" - - ".github/workflows/flutter_bloc.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/flutter_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: flutter packages get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: flutter analyze lib test example - - - name: Run tests - run: flutter test --no-pub --coverage --test-randomize-ordering-seed random - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/flutter_bloc/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/flutter_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/.github/workflows/flutter_examples.yaml b/.github/workflows/flutter_examples.yaml deleted file mode 100644 index 57c240a9200..00000000000 --- a/.github/workflows/flutter_examples.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: flutter_examples - -on: - push: - paths: - - ".github/workflows/flutter_examples.yaml" - - "packages/flutter_bloc/**" - - "examples/flutter_bloc_with_stream/**" - - "examples/flutter_complex_list/**" - - "examples/flutter_counter/**" - - "examples/flutter_dynamic_form/**" - - "examples/flutter_firebase_login/**" - - "examples/flutter_form_validation/**" - - "examples/flutter_infinite_list/**" - - "examples/flutter_login/**" - - "examples/flutter_shopping_cart/**" - - "examples/flutter_timer/**" - - "examples/flutter_todos/**" - - "examples/flutter_weather/**" - - "examples/flutter_wizard/**" - - "examples/github_search/flutter_github_search/**" - - pull_request: - paths: - - ".github/workflows/flutter_examples.yaml" - - "packages/flutter_bloc/**" - - "examples/flutter_bloc_with_stream/**" - - "examples/flutter_complex_list/**" - - "examples/flutter_counter/**" - - "examples/flutter_dynamic_form/**" - - "examples/flutter_firebase_login/**" - - "examples/flutter_form_validation/**" - - "examples/flutter_infinite_list/**" - - "examples/flutter_login/**" - - "examples/flutter_shopping_cart/**" - - "examples/flutter_timer/**" - - "examples/flutter_todos/**" - - "examples/flutter_weather/**" - - "examples/flutter_wizard/**" - - "examples/github_search/flutter_github_search/**" - -jobs: - examples: - strategy: - matrix: - folder: - [ - "packages/flutter_bloc/example", - "examples/flutter_bloc_with_stream", - "examples/flutter_complex_list", - "examples/flutter_counter", - "examples/flutter_dynamic_form", - "examples/flutter_firebase_login", - "examples/flutter_form_validation", - "examples/flutter_infinite_list", - "examples/flutter_login", - "examples/flutter_shopping_cart", - "examples/flutter_timer", - "examples/flutter_todos", - "examples/flutter_todos/packages/local_storage_todos_api", - "examples/flutter_todos/packages/todos_api", - "examples/flutter_todos/packages/todos_repository", - "examples/flutter_weather", - "examples/flutter_wizard", - "examples/github_search/flutter_github_search", - ] - fail-fast: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - name: Install Dependencies - working-directory: ${{ matrix.folder }} - run: flutter packages get - - name: Format - working-directory: ${{ matrix.folder }} - run: dart format --set-exit-if-changed lib - - name: Analyze - working-directory: ${{ matrix.folder }} - run: flutter analyze lib - - name: Run tests - working-directory: ${{ matrix.folder }} - run: | - if [ -d "test" ]; then - flutter test --no-pub --test-randomize-ordering-seed random - fi - build: - needs: [examples] - runs-on: ubuntu-latest - steps: - - name: noop - run: echo 'noop' diff --git a/.github/workflows/hydrated_bloc.yaml b/.github/workflows/hydrated_bloc.yaml deleted file mode 100644 index f087f9ae57a..00000000000 --- a/.github/workflows/hydrated_bloc.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: hydrated_bloc - -on: - push: - paths: - - "packages/hydrated_bloc/**" - - ".github/workflows/hydrated_bloc.yaml" - - pull_request: - paths: - - "packages/hydrated_bloc/**" - - ".github/workflows/hydrated_bloc.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/hydrated_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: flutter pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: flutter analyze lib test example - - - name: Run tests - run: flutter test -j 1 --no-pub --coverage --test-randomize-ordering-seed random - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/hydrated_bloc/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/hydrated_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh 110 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 00000000000..bb694b1a674 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,290 @@ +name: build + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + push: + branches: [master] + +jobs: + semantic_pull_request: + name: โœ… Semantic Pull Request + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1 + + changes: + runs-on: ubuntu-latest + + if: github.event.pull_request.draft == false + + outputs: + needs_angular_dart_example_checks: ${{ steps.needs_angular_dart_example_checks.outputs.changes }} + needs_dart_package_checks: ${{ steps.needs_dart_package_checks.outputs.changes }} + needs_flutter_package_checks: ${{ steps.needs_flutter_package_checks.outputs.changes }} + needs_flutter_example_checks: ${{ steps.needs_flutter_example_checks.outputs.changes }} + + name: ๐Ÿ‘€ Detect Changes + + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v3 + + - uses: dorny/paths-filter@v2 + name: Angular Dart Package Detection + id: needs_angular_dart_example_checks + with: + filters: | + angular_counter: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/angular_dart_package/action.yaml + - examples/angular_counter/** + github_search/angular_github_search: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - examples/github_search/angular_github_search/** + + - uses: dorny/paths-filter@v2 + name: Dart Package Detection + id: needs_dart_package_checks + with: + filters: | + angular_bloc: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - packages/angular_bloc/** + bloc_concurrency: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - packages/bloc_concurrency/** + bloc_test: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - packages/bloc_test/** + bloc_tools: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - packages/bloc_tools/** + bloc: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/dart_package/action.yaml + - packages/bloc/** + + - uses: dorny/paths-filter@v2 + name: Flutter Package Detection + id: needs_flutter_package_checks + with: + filters: | + flutter_bloc: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - packages/flutter_bloc/** + replay_bloc: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - packages/replay_bloc/** + hydrated_bloc: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - packages/hydrated_bloc/** + + - uses: dorny/paths-filter@v2 + name: Example Detection + id: needs_flutter_example_checks + with: + filters: | + flutter_bloc_with_stream: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_bloc_with_stream/** + flutter_complex_list: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_complex_list/** + flutter_counter: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_counter/** + flutter_dynamic_form: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_dynamic_form/** + flutter_firebase_login: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_firebase_login/** + flutter_form_validation: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_form_validation/** + flutter_infinite_list: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_infinite_list/** + flutter_login: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_login/** + flutter_shopping_cart: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_shopping_cart/** + flutter_timer: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_timer/** + flutter_todos: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_todos/** + flutter_weather: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_weather/** + flutter_wizard: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/flutter_wizard/** + github_search/flutter_github_search: + - ./.github/codecov.yml + - ./.github/workflows/main.yaml + - ./.github/actions/flutter_package/action.yaml + - examples/github_search/flutter_github_search/** + + dart_package_checks: + needs: changes + if: ${{ needs.changes.outputs.needs_dart_package_checks != '[]' }} + + strategy: + fail-fast: false + matrix: + package: ${{ fromJSON(needs.changes.outputs.needs_dart_package_checks) }} + + runs-on: ubuntu-latest + + name: ๐ŸŽฏ ${{ matrix.package }} + + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v3 + + - name: ๐ŸŽฏ Build ${{ matrix.package }} + uses: ./.github/actions/dart_package + with: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + working_directory: packages/${{ matrix.package }} + min_coverage: 100 + + flutter_package_checks: + needs: changes + if: ${{ needs.changes.outputs.needs_flutter_package_checks != '[]' }} + + strategy: + fail-fast: false + matrix: + package: ${{ fromJSON(needs.changes.outputs.needs_flutter_package_checks) }} + + runs-on: ubuntu-latest + + name: ๐Ÿฆ ${{ matrix.package }} + + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v3 + + - name: ๐ŸŽฏ Build ${{ matrix.package }} + uses: ./.github/actions/flutter_package + with: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + working_directory: packages/${{ matrix.package }} + min_coverage: 100 + + angular_dart_example_checks: + needs: changes + if: ${{ needs.changes.outputs.needs_angular_dart_example_checks != '[]' }} + + strategy: + fail-fast: false + matrix: + example: ${{ fromJSON(needs.changes.outputs.needs_angular_dart_example_checks) }} + + runs-on: ubuntu-latest + + name: ๐Ÿ›ก๏ธ ${{ matrix.example }} + + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v3 + + - name: ๐ŸŽฏ Build ${{ matrix.example }} + uses: ./.github/actions/angular_dart_package + with: + analyze_directories: lib + working_directory: examples/${{ matrix.example }} + + flutter_example_checks: + needs: changes + if: ${{ needs.changes.outputs.needs_flutter_example_checks != '[]' }} + + strategy: + fail-fast: false + matrix: + example: ${{ fromJSON(needs.changes.outputs.needs_flutter_example_checks) }} + + runs-on: ubuntu-latest + + name: ๐Ÿง‘โ€๐ŸŽ“ ${{ matrix.example }} + + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v3 + + - name: ๐ŸŽฏ Build ${{ matrix.example }} + uses: ./.github/actions/flutter_package + with: + analyze_directories: lib + collect_coverage: false + collect_score: false + working_directory: examples/${{ matrix.example }} + + build: + needs: + [ + semantic_pull_request, + dart_package_checks, + flutter_package_checks, + angular_dart_example_checks, + flutter_example_checks, + ] + if: ${{ always() }} + + runs-on: ubuntu-latest + + steps: + - name: โ›”๏ธ exit(1) on failure + if: ${{ contains(join(needs.*.result, ','), 'failure') }} + run: exit 1 diff --git a/.github/workflows/replay_bloc.yaml b/.github/workflows/replay_bloc.yaml deleted file mode 100644 index db0f07a370c..00000000000 --- a/.github/workflows/replay_bloc.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: replay_bloc - -on: - push: - paths: - - "packages/replay_bloc/**" - - ".github/workflows/replay_bloc.yaml" - - pull_request: - paths: - - "packages/replay_bloc/**" - - ".github/workflows/replay_bloc.yaml" - -jobs: - build: - defaults: - run: - working-directory: packages/replay_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: flutter pub get - - - name: Format - run: dart format --set-exit-if-changed . - - - name: Analyze - run: flutter analyze lib test example - - - name: Run tests - run: flutter test -j 1 --no-pub --coverage --test-randomize-ordering-seed random - - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - path: packages/replay_bloc/coverage/lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: packages/replay_bloc - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.10.0 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - sudo apt-get install webp - - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh diff --git a/packages/bloc_tools/pubspec.yaml b/packages/bloc_tools/pubspec.yaml index adbdcae8e4b..80def24be29 100644 --- a/packages/bloc_tools/pubspec.yaml +++ b/packages/bloc_tools/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: args: ^2.1.0 io: ^1.0.0 mason: ^0.1.0-dev.33 - pub_updater: ^0.3.0 + pub_updater: ^0.4.0 dev_dependencies: build_runner: ^2.0.0