From 6d0a1055f1d7b510ac3464eff2e197328ab20f72 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sat, 8 Feb 2025 13:54:00 -0800 Subject: [PATCH 1/2] refactor repo CI and analysis options files --- .github/workflows/api_benchmark.yaml | 36 ++ .github/workflows/benchmarks.yaml | 36 ++ .github/workflows/dart.yml | 522 ------------------ .github/workflows/post_summaries.yaml | 17 + .github/workflows/protobuf.yaml | 37 ++ .github/workflows/protoc_plugin.yaml | 37 ++ .github/workflows/publish.yaml | 15 +- README.md | 16 +- api_benchmark/analysis_options.yaml | 12 +- api_benchmark/lib/dashboard.dart | 2 + api_benchmark/lib/dashboard_view.dart | 2 + api_benchmark/mono_pkg.yaml | 9 - api_benchmark/web/props_browser.dart | 2 + api_benchmark/web/readjson_browser.dart | 2 + .../analysis_options.yaml | 0 benchmarks/mono_pkg.yaml | 10 - benchmarks/pubspec.yaml | 2 +- mono_repo.yaml | 16 - protobuf/analysis_options.yaml | 13 +- protobuf/mono_pkg.yaml | 16 - protoc_plugin/analysis_options.yaml | 14 +- protoc_plugin/mono_pkg.yaml | 15 - tool/ci.sh | 135 ----- tool/setup.sh | 6 +- 24 files changed, 226 insertions(+), 746 deletions(-) create mode 100644 .github/workflows/api_benchmark.yaml create mode 100644 .github/workflows/benchmarks.yaml delete mode 100644 .github/workflows/dart.yml create mode 100644 .github/workflows/post_summaries.yaml create mode 100644 .github/workflows/protobuf.yaml create mode 100644 .github/workflows/protoc_plugin.yaml delete mode 100644 api_benchmark/mono_pkg.yaml rename analysis_options.yaml => benchmarks/analysis_options.yaml (100%) delete mode 100644 benchmarks/mono_pkg.yaml delete mode 100644 mono_repo.yaml delete mode 100644 protobuf/mono_pkg.yaml delete mode 100644 protoc_plugin/mono_pkg.yaml delete mode 100755 tool/ci.sh diff --git a/.github/workflows/api_benchmark.yaml b/.github/workflows/api_benchmark.yaml new file mode 100644 index 000000000..41d0eea83 --- /dev/null +++ b/.github/workflows/api_benchmark.yaml @@ -0,0 +1,36 @@ +name: package:api_benchmark +permissions: read-all + +on: + # Run CI on pushes to the main branch and on PRs against main. + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: "0 0 * * 0" + +defaults: + run: + working-directory: api_benchmark/ + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [stable, dev] + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 + with: + sdk: ${{ matrix.sdk }} + - run: ../tool/setup.sh + - run: ./compile_protos.sh + + - run: dart pub get + - run: dart analyze --fatal-infos + - run: dart format --output=none --set-exit-if-changed . + if: ${{ matrix.sdk == 'stable' }} diff --git a/.github/workflows/benchmarks.yaml b/.github/workflows/benchmarks.yaml new file mode 100644 index 000000000..6d1d22e35 --- /dev/null +++ b/.github/workflows/benchmarks.yaml @@ -0,0 +1,36 @@ +name: package:benchmarks +permissions: read-all + +on: + # Run CI on pushes to the main branch and on PRs against main. + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: "0 0 * * 0" + +defaults: + run: + working-directory: benchmarks/ + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [stable, dev] + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 + with: + sdk: ${{ matrix.sdk }} + - run: ../tool/setup.sh + - run: ./tool/compile_protos.sh + + - run: dart pub get + - run: dart analyze --fatal-infos + - run: dart format --output=none --set-exit-if-changed . + if: ${{ matrix.sdk == 'stable' }} diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml deleted file mode 100644 index c9f6846e2..000000000 --- a/.github/workflows/dart.yml +++ /dev/null @@ -1,522 +0,0 @@ -# Created with package:mono_repo v6.6.2 -name: Dart CI -on: - push: - branches: master - pull_request: - branches: master - schedule: - - cron: "0 0 * * 0" -defaults: - run: - shell: bash -env: - PUB_ENVIRONMENT: bot.github -permissions: read-all - -jobs: - job_001: - name: mono_repo self validate - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: stable - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - name: mono_repo self validate - run: dart pub global activate mono_repo 6.6.2 - - name: mono_repo self validate - run: dart pub global run mono_repo generate --validate - job_002: - name: "format_analyze; linux; Dart 3.3.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:analyze_1-analyze_2" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart analyze lib - run: dart analyze lib - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart analyze test - run: dart analyze test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - job_003: - name: "format_analyze; linux; Dart dev; PKG: api_benchmark; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./compile_protos.sh`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark;commands:format-command_0-command_1" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: api_benchmark_pub_upgrade - name: api_benchmark; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: api_benchmark - - name: "api_benchmark; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'" - working-directory: api_benchmark - - name: api_benchmark; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'" - working-directory: api_benchmark - - name: api_benchmark; ./compile_protos.sh - run: ./compile_protos.sh - if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'" - working-directory: api_benchmark - job_004: - name: "format_analyze; linux; Dart dev; PKG: benchmarks; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./tool/compile_protos.sh`, `dart analyze --fatal-infos`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:benchmarks;commands:format-command_0-command_2-analyze_0" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:benchmarks - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: benchmarks_pub_upgrade - name: benchmarks; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: benchmarks - - name: "benchmarks; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'" - working-directory: benchmarks - - name: benchmarks; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'" - working-directory: benchmarks - - name: benchmarks; ./tool/compile_protos.sh - run: ./tool/compile_protos.sh - if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'" - working-directory: benchmarks - - name: "benchmarks; dart analyze --fatal-infos" - run: dart analyze --fatal-infos - if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'" - working-directory: benchmarks - job_005: - name: "format_analyze; linux; Dart dev; PKG: protobuf; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:format-analyze_0" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: "protobuf; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - - name: "protobuf; dart analyze --fatal-infos" - run: dart analyze --fatal-infos - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - job_006: - name: "format_analyze; linux; Dart dev; PKG: protoc_plugin; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `make protos`, `dart analyze --fatal-infos`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:format-command_0-command_3-analyze_0" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: "protoc_plugin; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: "protoc_plugin; dart analyze --fatal-infos" - run: dart analyze --fatal-infos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - job_007: - name: "run_tests; linux; Dart 3.3.0; PKG: protobuf; `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_008: - name: "run_tests; linux; Dart 3.3.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; dart test - run: dart test - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_009: - name: "run_tests; linux; Dart dev; PKG: protobuf; `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_010: - name: "run_tests; linux; Dart dev; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; dart test - run: dart test - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_011: - name: "run_tests; osx; Dart 3.3.0; PKG: protobuf; `dart test`" - runs-on: macos-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test" - restore-keys: | - os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf - os:macos-latest;pub-cache-hosted;sdk:3.3.0 - os:macos-latest;pub-cache-hosted - os:macos-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_012: - name: "run_tests; osx; Dart dev; PKG: protobuf; `dart test`" - runs-on: macos-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test" - restore-keys: | - os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf - os:macos-latest;pub-cache-hosted;sdk:dev - os:macos-latest;pub-cache-hosted - os:macos-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_013: - name: "run_tests; windows; Dart 3.3.0; PKG: protobuf; `dart test`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - job_014: - name: "run_tests; windows; Dart dev; PKG: protobuf; `dart test`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test - run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 diff --git a/.github/workflows/post_summaries.yaml b/.github/workflows/post_summaries.yaml new file mode 100644 index 000000000..31c1e5060 --- /dev/null +++ b/.github/workflows/post_summaries.yaml @@ -0,0 +1,17 @@ +name: Comment on the pull request + +on: + # Trigger this workflow after the Publish workflow completes. This workflow + # will have permissions to do things like create comments on the PR, even if + # the original workflow couldn't. + workflow_run: + workflows: + - Publish + types: + - completed + +jobs: + upload: + uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main + permissions: + pull-requests: write diff --git a/.github/workflows/protobuf.yaml b/.github/workflows/protobuf.yaml new file mode 100644 index 000000000..84b067c1e --- /dev/null +++ b/.github/workflows/protobuf.yaml @@ -0,0 +1,37 @@ +name: package:protobuf +permissions: read-all + +on: + # Run CI on pushes to the main branch and on PRs against main. + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: "0 0 * * 0" + +defaults: + run: + working-directory: protobuf/ + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu, macos, windows] + sdk: [stable, dev] + runs-on: ${{ matrix.os }}-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 + with: + sdk: ${{ matrix.sdk }} + - run: ../tool/setup.sh + + - run: dart pub get + - run: dart analyze --fatal-infos + - run: dart format --output=none --set-exit-if-changed . + if: ${{ matrix.sdk == 'stable' }} + - run: dart test diff --git a/.github/workflows/protoc_plugin.yaml b/.github/workflows/protoc_plugin.yaml new file mode 100644 index 000000000..eea894d05 --- /dev/null +++ b/.github/workflows/protoc_plugin.yaml @@ -0,0 +1,37 @@ +name: package:protoc_plugin +permissions: read-all + +on: + # Run CI on pushes to the main branch and on PRs against main. + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: "0 0 * * 0" + +defaults: + run: + working-directory: protoc_plugin/ + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [stable, dev] + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 + with: + sdk: ${{ matrix.sdk }} + - run: ../tool/setup.sh + - run: make protos + + - run: dart pub get + - run: dart analyze --fatal-infos + - run: dart format --output=none --set-exit-if-changed . + if: ${{ matrix.sdk == 'stable' }} + - run: dart test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6706b071b..69b20b1b3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,18 +3,17 @@ name: Publish on: - # Trigger on pull requests that target the default branch. pull_request: - branches: [ master ] - types: [opened, synchronize, reopened, labeled, unlabeled] - # Also, trigger when tags are pushed to the repo. + branches: [master] push: - tags: [ '[A-z]+-v[0-9]+.[0-9]+.[0-9]+*' ] + tags: ['[A-z]+-v[0-9]+.[0-9]+.[0-9]+*'] -# The script below will perform publishing checks (version checks, publishing -# dry run, ...) when run on a PR, and perform an actual pub publish when run as -# a result of a git tag event. jobs: publish: if: ${{ github.repository_owner == 'google' }} uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main + permissions: + id-token: write + pull-requests: write + with: + write-comments: false diff --git a/README.md b/README.md index e42f4c5c7..f69362bc6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![CI status](https://github.com/google/protobuf.dart/workflows/Dart%20CI/badge.svg)](https://github.com/google/protobuf.dart/actions?query=workflow%3A%22Dart%22+branch%3Amaster) - ## Protobuf support for Dart [Protocol Buffers](https://developers.google.com/protocol-buffers) (protobuf) @@ -7,14 +5,14 @@ are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. This repository is home to packages related to -[protobuf for Dart](https://pub.dev/documentation/protobuf/latest/). +[protobuf support for Dart](https://pub.dev/documentation/protobuf/latest/). -Package | Description | Published Version ---- | --- | --- -[protobuf](protobuf/) | A support library for the generated code | [![pub package](https://img.shields.io/pub/v/protobuf.svg)](https://pub.dev/packages/protobuf) -[protoc_plugin](protoc_plugin/) | A Dart back-end for the protoc compiler | [![pub package](https://img.shields.io/pub/v/protoc_plugin.svg)](https://pub.dev/packages/protoc_plugin) -[api_benchmark](api_benchmark/) | Benchmarking for various API calls | -[query_benchmark](query_benchmark/) | Benchmark for encoding and decoding of a "real-world" protobuf | +| Package | Description | Published Version | +| --- | --- | --- | +| [protobuf](protobuf/) | Runtime library for protocol buffers support. | [![pub package](https://img.shields.io/pub/v/protobuf.svg)](https://pub.dev/packages/protobuf) | +| [protoc_plugin](protoc_plugin/) | A protobuf protoc compiler plugin used to generate Dart code. | [![pub package] |(https://img.shields.io/pub/v/protoc_plugin.svg)](https://pub.dev/packages/protoc_plugin) +| [api_benchmark](api_benchmark/) | Benchmarking a number of different api calls. | | +| [benchmarks](benchmarks/) | Benchmarks for various protobuf functions. | | ## Publishing automation diff --git a/api_benchmark/analysis_options.yaml b/api_benchmark/analysis_options.yaml index 7e489e016..2c6ed643c 100644 --- a/api_benchmark/analysis_options.yaml +++ b/api_benchmark/analysis_options.yaml @@ -1,7 +1,17 @@ -include: ../analysis_options.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: false errors: + lines_longer_than_80_chars: ignore only_throw_errors: ignore + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - comment_references + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - use_super_parameters diff --git a/api_benchmark/lib/dashboard.dart b/api_benchmark/lib/dashboard.dart index 395bd5c9e..991b79cab 100644 --- a/api_benchmark/lib/dashboard.dart +++ b/api_benchmark/lib/dashboard.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use + import 'dart:async' show Future; import 'dart:convert'; import 'dart:html'; diff --git a/api_benchmark/lib/dashboard_view.dart b/api_benchmark/lib/dashboard_view.dart index 5a8965963..7fe863392 100644 --- a/api_benchmark/lib/dashboard_view.dart +++ b/api_benchmark/lib/dashboard_view.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use + import 'dart:async' show EventSink, Stream, StreamController; import 'dart:html'; diff --git a/api_benchmark/mono_pkg.yaml b/api_benchmark/mono_pkg.yaml deleted file mode 100644 index c3046ef03..000000000 --- a/api_benchmark/mono_pkg.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# See https://github.com/dart-lang/mono_repo for details - -stages: - - format_analyze: - - group: - - format - - command: ./../tool/setup.sh - - command: ./compile_protos.sh - sdk: dev diff --git a/api_benchmark/web/props_browser.dart b/api_benchmark/web/props_browser.dart index 077ae9d5f..9945f76a6 100644 --- a/api_benchmark/web/props_browser.dart +++ b/api_benchmark/web/props_browser.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use + import 'dart:html' show querySelector; import 'package:api_benchmark/dashboard.dart' show showDashboard; diff --git a/api_benchmark/web/readjson_browser.dart b/api_benchmark/web/readjson_browser.dart index aa380e683..c292ab5bf 100644 --- a/api_benchmark/web/readjson_browser.dart +++ b/api_benchmark/web/readjson_browser.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use + import 'dart:html' show querySelector; import 'package:api_benchmark/dashboard.dart' show showDashboard; diff --git a/analysis_options.yaml b/benchmarks/analysis_options.yaml similarity index 100% rename from analysis_options.yaml rename to benchmarks/analysis_options.yaml diff --git a/benchmarks/mono_pkg.yaml b/benchmarks/mono_pkg.yaml deleted file mode 100644 index df3f45473..000000000 --- a/benchmarks/mono_pkg.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# See https://github.com/dart-lang/mono_repo for details - -stages: - - format_analyze: - - group: - - format - - command: ./../tool/setup.sh - - command: ./tool/compile_protos.sh - - analyze: --fatal-infos - sdk: dev diff --git a/benchmarks/pubspec.yaml b/benchmarks/pubspec.yaml index 68b002584..14515e426 100644 --- a/benchmarks/pubspec.yaml +++ b/benchmarks/pubspec.yaml @@ -3,7 +3,7 @@ # BSD-style license that can be found in the LICENSE file. name: protobuf_benchmarks -description: Benchmarks various protobuf functions +description: Benchmarks for various protobuf functions. publish_to: none environment: diff --git a/mono_repo.yaml b/mono_repo.yaml deleted file mode 100644 index 93f1d7860..000000000 --- a/mono_repo.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# See https://github.com/google/mono_repo.dart for details on this file -self_validate: format_analyze - -github: - on: - # Run CI on pushes to the master branch, and on PRs against master. - push: - branches: master - pull_request: - branches: master - schedule: - - cron: "0 0 * * 0" - -merge_stages: -- format_analyze -- run_tests diff --git a/protobuf/analysis_options.yaml b/protobuf/analysis_options.yaml index 06eee2aec..91a903246 100644 --- a/protobuf/analysis_options.yaml +++ b/protobuf/analysis_options.yaml @@ -1,5 +1,16 @@ -include: ../analysis_options.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: false + errors: + lines_longer_than_80_chars: ignore + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - comment_references + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - use_super_parameters diff --git a/protobuf/mono_pkg.yaml b/protobuf/mono_pkg.yaml deleted file mode 100644 index 4d9ca7b6c..000000000 --- a/protobuf/mono_pkg.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# See https://github.com/dart-lang/mono_repo for details - -stages: - - format_analyze: - - group: - - format - - analyze: --fatal-infos - sdk: [dev] - - group: - - analyze: lib - - analyze: test - sdk: [pubspec] - - run_tests: - - group: [test] - sdk: [pubspec, dev] - os: [linux, osx, windows] diff --git a/protoc_plugin/analysis_options.yaml b/protoc_plugin/analysis_options.yaml index 2a1174d71..43f52b1bf 100644 --- a/protoc_plugin/analysis_options.yaml +++ b/protoc_plugin/analysis_options.yaml @@ -1,6 +1,18 @@ -include: ../analysis_options.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: + language: + strict-casts: true errors: avoid_dynamic_calls: ignore + lines_longer_than_80_chars: ignore only_throw_errors: ignore + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - comment_references + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - use_super_parameters diff --git a/protoc_plugin/mono_pkg.yaml b/protoc_plugin/mono_pkg.yaml deleted file mode 100644 index d9625f261..000000000 --- a/protoc_plugin/mono_pkg.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# See https://github.com/dart-lang/mono_repo for details -stages: - - format_analyze: - - group: - - format - - command: ./../tool/setup.sh - - command: make protos - - analyze: --fatal-infos - sdk: [dev] - - run_tests: - - group: - - command: ./../tool/setup.sh - - command: make protos - - test - sdk: [pubspec, dev] diff --git a/tool/ci.sh b/tool/ci.sh deleted file mode 100755 index 987255104..000000000 --- a/tool/ci.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -# Created with package:mono_repo v6.6.2 - -# Support built in commands on windows out of the box. - -# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter pub" is called instead of "dart pub". -# This assumes that the Flutter SDK has been installed in a previous step. -function pub() { - if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then - command flutter pub "$@" - else - command dart pub "$@" - fi -} - -function format() { - command dart format "$@" -} - -# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter analyze" is called instead of "dart analyze". -# This assumes that the Flutter SDK has been installed in a previous step. -function analyze() { - if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then - command flutter analyze "$@" - else - command dart analyze "$@" - fi -} - -if [[ -z ${PKGS} ]]; then - echo -e '\033[31mPKGS environment variable must be set! - TERMINATING JOB\033[0m' - exit 64 -fi - -if [[ "$#" == "0" ]]; then - echo -e '\033[31mAt least one task argument must be provided! - TERMINATING JOB\033[0m' - exit 64 -fi - -SUCCESS_COUNT=0 -declare -a FAILURES - -for PKG in ${PKGS}; do - echo -e "\033[1mPKG: ${PKG}\033[22m" - EXIT_CODE=0 - pushd "${PKG}" >/dev/null || EXIT_CODE=$? - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: '${PKG}' does not exist - TERMINATING JOB\033[0m" - exit 64 - fi - - dart pub upgrade || EXIT_CODE=$? - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: ${PKG}; 'dart pub upgrade' - FAILED (${EXIT_CODE})\033[0m" - FAILURES+=("${PKG}; 'dart pub upgrade'") - else - for TASK in "$@"; do - EXIT_CODE=0 - echo - echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m" - case ${TASK} in - analyze_0) - echo 'dart analyze --fatal-infos' - dart analyze --fatal-infos || EXIT_CODE=$? - ;; - analyze_1) - echo 'dart analyze lib' - dart analyze lib || EXIT_CODE=$? - ;; - analyze_2) - echo 'dart analyze test' - dart analyze test || EXIT_CODE=$? - ;; - command_0) - echo './../tool/setup.sh' - ./../tool/setup.sh || EXIT_CODE=$? - ;; - command_1) - echo './compile_protos.sh' - ./compile_protos.sh || EXIT_CODE=$? - ;; - command_2) - echo './tool/compile_protos.sh' - ./tool/compile_protos.sh || EXIT_CODE=$? - ;; - command_3) - echo 'make protos' - make protos || EXIT_CODE=$? - ;; - format) - echo 'dart format --output=none --set-exit-if-changed .' - dart format --output=none --set-exit-if-changed . || EXIT_CODE=$? - ;; - test) - echo 'dart test' - dart test || EXIT_CODE=$? - ;; - *) - echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m" - exit 64 - ;; - esac - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: ${PKG}; TASK: ${TASK} - FAILED (${EXIT_CODE})\033[0m" - FAILURES+=("${PKG}; TASK: ${TASK}") - else - echo -e "\033[32mPKG: ${PKG}; TASK: ${TASK} - SUCCEEDED\033[0m" - SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) - fi - - done - fi - - echo - echo -e "\033[32mSUCCESS COUNT: ${SUCCESS_COUNT}\033[0m" - - if [ ${#FAILURES[@]} -ne 0 ]; then - echo -e "\033[31mFAILURES: ${#FAILURES[@]}\033[0m" - for i in "${FAILURES[@]}"; do - echo -e "\033[31m $i\033[0m" - done - fi - - popd >/dev/null || exit 70 - echo -done - -if [ ${#FAILURES[@]} -ne 0 ]; then - exit 1 -fi diff --git a/tool/setup.sh b/tool/setup.sh index 6f4811f80..878707d2c 100755 --- a/tool/setup.sh +++ b/tool/setup.sh @@ -1,9 +1,11 @@ #!/bin/bash -wget -O protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip +wget -O protoc.zip \ + https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip unzip -d protoc protoc.zip + if [[ -z "${GITHUB_ENV}" ]]; then - # Local mono_repo presubmit run + # Local run export PATH=$PWD/protoc/bin:$PATH else # GitHub Actions From c6ec3bdffdaeec603b4dc2c457d0fd624f0614d9 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sat, 8 Feb 2025 14:11:16 -0800 Subject: [PATCH 2/2] update gitignore files to avoid a pub warning --- .github/workflows/protoc_plugin.yaml | 2 +- .gitignore | 7 +++---- api_benchmark/.gitignore | 1 + benchmarks/.gitignore | 2 ++ protoc_plugin/.gitignore | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 api_benchmark/.gitignore create mode 100644 benchmarks/.gitignore diff --git a/.github/workflows/protoc_plugin.yaml b/.github/workflows/protoc_plugin.yaml index eea894d05..bb266d6e7 100644 --- a/.github/workflows/protoc_plugin.yaml +++ b/.github/workflows/protoc_plugin.yaml @@ -28,9 +28,9 @@ jobs: with: sdk: ${{ matrix.sdk }} - run: ../tool/setup.sh - - run: make protos - run: dart pub get + - run: make protos - run: dart analyze --fatal-infos - run: dart format --output=none --set-exit-if-changed . if: ${{ matrix.sdk == 'stable' }} diff --git a/.gitignore b/.gitignore index 095775944..5b83f4284 100644 --- a/.gitignore +++ b/.gitignore @@ -4,17 +4,16 @@ .packages .pub build/ -**/lib/generated/** -packages pubspec.lock -benchmarks/out doc/ # `dart compile exe` outputs *.exe # `dart compile js` outputs -*.js* +*.js +*.js.deps +*.js.map # `dart compile wasm` outputs *.wasm diff --git a/api_benchmark/.gitignore b/api_benchmark/.gitignore new file mode 100644 index 000000000..59187aa9f --- /dev/null +++ b/api_benchmark/.gitignore @@ -0,0 +1 @@ +lib/generated/** diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore new file mode 100644 index 000000000..c766086f8 --- /dev/null +++ b/benchmarks/.gitignore @@ -0,0 +1,2 @@ +lib/generated/ +out/ diff --git a/protoc_plugin/.gitignore b/protoc_plugin/.gitignore index 11e5fe701..40fd95469 100644 --- a/protoc_plugin/.gitignore +++ b/protoc_plugin/.gitignore @@ -9,4 +9,4 @@ benchmark/data/pubspec.link.lock benchmark/data/hostname.txt benchmark/data/latest_vm.pb.json benchmark/lib/generated -out +out/