diff --git a/.github/workflows/dart_ci.yml b/.github/workflows/dart_ci.yml new file mode 100644 index 00000000..09c52c6e --- /dev/null +++ b/.github/workflows/dart_ci.yml @@ -0,0 +1,49 @@ +name: Dart CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [stable, dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.1 + with: + channel: ${{ matrix.sdk }} + + - name: Print Dart SDK version + run: dart --version + + - id: install + name: Install dependencies + run: dart pub get + + - name: Validate dependencies + run: dart pub run dependency_validator -i build_runner,build_test,build_web_compilers + if: always() && steps.install.outcome == 'success' + + # TODO: Uncomment this, and remove the Dart 2.7.2 format step in the Workiva Build Dockerfile + # once we are able to bump the lower bound of SDK. +# - name: Verify formatting +# run: dart format --output=none --line-length=120 --set-exit-if-changed . +# if: always() && ${{ matrix.sdk }} == 'stable' && steps.install.outcome == 'success' + + - name: Analyze project source + run: dart analyze + if: always() && steps.install.outcome == 'success' + + - name: Run tests (DDC) + run: dart pub run build_runner test -- --preset dartdevc + if: always() && steps.install.outcome == 'success' + + - name: Run tests (dart2js) + run: dart pub run build_runner test --release -- --preset dart2js + if: always() && steps.install.outcome == 'success' diff --git a/Dockerfile b/Dockerfile index 3fbd606e..170f7df0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,22 +16,14 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key # Fail the build if the version doesn't match what we expected RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\." -# Need to analyze and format since dart_build_image only does it automatically for -# packages that depend on dart_dev -RUN dartanalyzer . +# TODO: Remove this and instead run it within the github actions CI on the stable channel once SDK lower bound is >=2.9.3 RUN dartfmt --line-length=120 --dry-run --set-exit-if-changed . -RUN pub run dependency_validator -i build_runner,build_test,build_web_compilers - -# TODO run tests using dart_unit_test_image in skynet, remove Chrome install +# TODO: Remove these test runs once SDK lower bound is >=2.9.3 RUN pub run build_runner test --release -- --preset dart2js --exclude-tags=dart-2-7-dart2js-variadic-issues RUN pub run build_runner test -- --preset dartdevc -RUN dart ./tool/run_consumer_tests.dart --orgName Workiva --repoName over_react --testCmd "pub run dart_dev test -P dartdevc" - - -# We need 2.9.2 to verify the Chrome MemoryInfo workaround: https://github.com/cleandart/react-dart/pull/280, -# and to run the tests that fail in 2.7 +# We need 2.9.2 to verify the Chrome MemoryInfo workaround: https://github.com/cleandart/react-dart/pull/280 # TODO remove the workaround as well as this config once SDK lower bound is >=2.9.3 FROM google/dart:2.9.2 RUN dart --version @@ -74,10 +66,9 @@ WORKDIR /build/ ADD . /build/ RUN pub get -# Run dart2js tests that fail in 2.7 -RUN pub run build_runner test --release -- --preset dart2js --tags=dart-2-7-dart2js-variadic-issues # Run DDC tests to verify Chrome workaround RUN pub run build_runner test -- --preset dartdevc - +# Run dart2js tests that fail in 2.7 +RUN pub run build_runner test --release -- --preset dart2js --tags=dart-2-7-dart2js-variadic-issues FROM scratch diff --git a/README.md b/README.md index 464a4a91..ba2a11ff 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Pub](https://img.shields.io/pub/v/react.svg)](https://pub.dev/packages/react) ![ReactJS v17.0.1](https://img.shields.io/badge/React_JS-v17.0.1-green.svg) -[![Build Status](https://travis-ci.com/cleandart/react-dart.svg?branch=master)](https://travis-ci.com/cleandart/react-dart) +[![Dart CI](https://github.com/Workiva/react-dart/workflows/Dart%20CI/badge.svg?branch=master)](https://github.com/Workiva/react-dart/actions?query=workflow%3A%22Dart+CI%22+branch%3Amaster) [![React Dart API Docs](https://img.shields.io/badge/api_docs-react-blue.svg)](https://pub.dev/documentation/react/latest/) _Thanks to the folks at [Vacuumlabs](https://www.vacuumlabs.com/) for creating this project! :heart:_