Skip to content

Commit

Permalink
Merge pull request #409 from Workiva/dart-3-ci
Browse files Browse the repository at this point in the history
FED-3253 Officially support Dart 3
  • Loading branch information
rmconsole5-wk authored Oct 18, 2024
2 parents 7cddc4e + 2f0e05b commit b1e09e0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/dart_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,46 @@ on:
- '**'

jobs:
# Run as a separate job outside the Dart SDK matrix below,
# since we can only emit a single SBOM.
create-sbom-release-asset:
name: Create SBOM Release Asset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: 2.19.6 # This version doesn't matter so long as it resolves.
- run: dart pub get
- name: Publish SBOM to Release Assets
uses: anchore/sbom-action@v0
with:
path: ./
format: cyclonedx-json

build:
runs-on: ubuntu-latest
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, stable]
steps:
- uses: actions/checkout@v2
- 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
Expand All @@ -46,14 +70,10 @@ jobs:
run: |
dart run build_runner test --delete-conflicting-outputs -- --preset dartdevc
if: always() && steps.install.outcome == 'success'
timeout-minutes: 5
timeout-minutes: 8

- name: Run tests (dart2js)
run: |
dart run build_runner test --delete-conflicting-outputs --release -- --preset dart2js
if: always() && steps.install.outcome == 'success'
timeout-minutes: 5
- uses: anchore/sbom-action@v0
with:
path: ./
format: cyclonedx-json
timeout-minutes: 8
3 changes: 3 additions & 0 deletions dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ platforms:
- chrome
- vm

# Work around process handing after tests finish: https://github.com/dart-lang/build/issues/3765
concurrency: 1

presets:
dart2js-legacy:
exclude_tags: no-dart2js
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 7.2.0
description: Bindings of the ReactJS library for building interactive interfaces.
homepage: https://github.com/cleandart/react-dart
environment:
sdk: '>=2.13.0 <3.0.0'
sdk: '>=2.13.0 <4.0.0'
dependencies:
js: ^0.6.3
meta: ^1.6.0
Expand Down
11 changes: 11 additions & 0 deletions tool/delete_dart_2_only_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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 test/nullable_callback_detection/non_null_safe_refs.dart
rm test/nullable_callback_detection/nullable_callback_detection_unsound_test.dart

0 comments on commit b1e09e0

Please sign in to comment.