diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 87a340d7..00000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: dart - -dart: - # 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 - - 2.9.2 - - stable - - dev - -# Re-use downloaded pub packages everywhere. -cache: - directories: - - $HOME/.pub-cache - - $HOME/.dart_tool - -before_script: - - dartanalyzer . - - | - if [ "$TRAVIS_DART_VERSION" == "stable" ]; then - dartfmt --line-length=120 --dry-run --set-exit-if-changed . - fi - - pub run dependency_validator -i build_runner,build_test,build_web_compilers - -script: - - pub run build_runner test --release -- --preset dart2js - - pub run build_runner test -- --preset dartdevc - - dart ./tool/run_consumer_tests.dart --orgName Workiva --repoName over_react --testCmd "pub run dart_dev test -P dartdevc" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3fbd606e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,83 @@ +FROM drydock-prod.workiva.net/workiva/dart_build_image:1 + +# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile + +# Set the expected Chrome major version. This allows us to update the expected version when +# we need to roll out a new version of this base image with a new chrome version as the only change +ENV EXPECTED_CHROME_VERSION=87 + +# Install Chrome +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ + echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ + apt-get -qq update && apt-get install -y google-chrome-stable && \ + mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \ + sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome + +# 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 . +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 +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 +# 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 + +# Don't allow the dart package to be updated via apt +RUN apt-mark hold dart + +# Update image - required by aviary +RUN apt-get update -qq && \ + apt-get dist-upgrade -y && \ + apt-get autoremove -y && \ + apt-get clean all +# Install deps for Chrome install +RUN apt-get install -y \ + build-essential \ + curl \ + git \ + make \ + parallel \ + wget \ + && rm -rf /var/lib/apt/lists/* + +# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile + +# Set the expected Chrome major version. This allows us to update the expected version when +# we need to roll out a new version of this base image with a new chrome version as the only change +ENV EXPECTED_CHROME_VERSION=87 + +# Install Chrome +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ + echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ + apt-get -qq update && apt-get install -y google-chrome-stable && \ + mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \ + sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome + +# Fail the build if the version doesn't match what we expected +RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\." + +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 + + +FROM scratch diff --git a/dart_test.yaml b/dart_test.yaml index 06689dcc..f610cad4 100644 --- a/dart_test.yaml +++ b/dart_test.yaml @@ -12,4 +12,7 @@ presets: exclude_tags: no-dartdevc tags: - "fails-on-241": + # Variadic children tests of >5 children that fail in Dart 2.7 for an unknown reason, seemingly an SDK bug. + # These tests pass in later Dart SDKs, so we ignore them when running in 2.7. + "dart-2-7-dart2js-variadic-issues": + diff --git a/test/factory/common_factory_tests.dart b/test/factory/common_factory_tests.dart index a8a42929..7b50456f 100644 --- a/test/factory/common_factory_tests.dart +++ b/test/factory/common_factory_tests.dart @@ -70,7 +70,7 @@ void commonFactoryTests(ReactComponentFactoryProxy factory, final arguments = [props, ...expectedChildren]; final instance = Function.apply(factory, arguments); expect(getChildren(instance), expectedChildren); - }); + }, tags: i > 5 ? 'dart-2-7-dart2js-variadic-issues' : null); } test('$maxSupportedVariadicChildCount (and passes static analysis)', () { @@ -79,7 +79,7 @@ void commonFactoryTests(ReactComponentFactoryProxy factory, // Generate these instead of hard coding them to ensure the arguments passed into this test match maxSupportedVariadicChildCount final expectedChildren = new List.generate(maxSupportedVariadicChildCount, (i) => i + 1); expect(getChildren(instance), equals(expectedChildren)); - }); + }, tags: 'dart-2-7-dart2js-variadic-issues'); }); test('a List', () { diff --git a/test/factory/dart_function_factory_test.dart b/test/factory/dart_function_factory_test.dart index f6466c78..d33ae1a2 100644 --- a/test/factory/dart_function_factory_test.dart +++ b/test/factory/dart_function_factory_test.dart @@ -31,7 +31,7 @@ main() { expect(_getJsFunctionName(FunctionFoo.reactFunction), '_FunctionFoo'); expect(FunctionFoo.displayName, _getJsFunctionName(FunctionFoo.reactFunction)); - }, tags: ['fails-on-241']); + }); test('is populated by the provided argument', () { expect(NamedFunctionFoo.displayName, 'Bar'); diff --git a/test/lifecycle_test/util.dart b/test/lifecycle_test/util.dart index d6d3d47d..068f67b9 100644 --- a/test/lifecycle_test/util.dart +++ b/test/lifecycle_test/util.dart @@ -40,11 +40,7 @@ mixin LifecycleTestHelper on Component { 'context': context, }); - var lifecycleCallback = props == null - ? staticProps == null - ? null - : staticProps[memberName] - : props[memberName]; + var lifecycleCallback = props == null ? staticProps == null ? null : staticProps[memberName] : props[memberName]; if (lifecycleCallback != null) { return Function.apply( lifecycleCallback,