From 4b7627b05f47fe5cca1ce38a890d09fabe7625f4 Mon Sep 17 00:00:00 2001 From: Greg Littlefield Date: Thu, 10 Oct 2024 11:56:42 -0700 Subject: [PATCH] Start running CI on Dart 3 --- .github/workflows/dart_ci.yml | 39 ++++++++++++++++++++++++-------- tool/delete_dart_2_only_files.sh | 17 ++++++++++++++ 2 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 tool/delete_dart_2_only_files.sh diff --git a/.github/workflows/dart_ci.yml b/.github/workflows/dart_ci.yml index 69b79307d..77191ba94 100644 --- a/.github/workflows/dart_ci.yml +++ b/.github/workflows/dart_ci.yml @@ -22,17 +22,24 @@ jobs: strategy: fail-fast: false matrix: - # Can't run on `dev` (Dart 3) until we're fully null-safe. - sdk: [ 2.19.6 ] + sdk: [ 2.19.6, 3.4.4, main ] steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@v1 + - id: setup-dart + uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - name: Print Dart SDK version run: dart --version + - name: Delete Dart-2-only files when running on Dart 3 + run: | + DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}" + if [[ "$DART_VERSION" =~ ^3 ]]; then + ./tool/delete_dart_2_only_files.sh + fi + - id: install name: Install dependencies run: dart pub get @@ -102,21 +109,28 @@ jobs: strategy: fail-fast: false matrix: - # Can't run on `dev` (Dart 3) until we're fully null-safe. - sdk: [ 2.19.6 ] + sdk: [ 2.19.6, 3.4.4, main ] analyzer: # We only have one version currently, but we'll leave this CI step in place # for the next time we need to support multiple analyzer versions. - ^5.1.0 steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@v1 + - id: setup-dart + uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - name: Print Dart SDK version run: dart --version + - name: Delete Dart-2-only files when running on Dart 3 + run: | + DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}" + if [[ "$DART_VERSION" =~ ^3 ]]; then + ./tool/delete_dart_2_only_files.sh + fi + - name: Update analyzer constraint to ${{ matrix.analyzer }} and validate `dart pub get` can resolve id: resolve run: | @@ -142,17 +156,24 @@ jobs: strategy: fail-fast: false matrix: - # Can't run on `stable` (Dart 3) until we're fully null-safe. - sdk: [ 2.19.6 ] + sdk: [ 2.19.6, 3.4.4, main ] steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@v1 + - id: setup-dart + uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - name: Print Dart SDK version run: dart --version + - name: Delete Dart-2-only files when running on Dart 3 + run: | + DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}" + if [[ "$DART_VERSION" =~ ^3 ]]; then + (cd ../.. && ./tool/delete_dart_2_only_files.sh) + fi + - id: link name: Override over_react dependency with local path run: cd ../.. && dart pub get && dart tool/travis_link_plugin_deps.dart diff --git a/tool/delete_dart_2_only_files.sh b/tool/delete_dart_2_only_files.sh new file mode 100644 index 000000000..e64228544 --- /dev/null +++ b/tool/delete_dart_2_only_files.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# +# This script deletes files that can only be run in Dart 2 (ones not using null-safety), +# and need to be deleted for analysis and compilation to work in Dart 3. +# + +set -e + +rm -rf test/over_react/component_declaration/non_null_safe_builder_integration_tests +rm test/over_react/component_declaration/flux_component_test/component2/unsound_flux_component_test.dart +rm test/over_react/component_declaration/flux_component_test/unsound_flux_component_test.dart +rm test/over_react_component_declaration_non_null_safe_test.dart + +rm -rf tools/analyzer_plugin/test/unit/util/non_null_safe +rm -rf tools/analyzer_plugin/test/integration/assists/non_null_safe +rm -rf tools/analyzer_plugin/test/integration/diagnostics/non_null_safe \ No newline at end of file