Skip to content

Commit

Permalink
Merge pull request #296 from Workiva/workiva-build
Browse files Browse the repository at this point in the history
Set up Workiva Build, move build steps since Travis which no longer runs
  • Loading branch information
greglittlefield-wf authored Jan 13, 2021
2 parents 7d69757 + c5162bb commit c9197eb
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 36 deletions.
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

83 changes: 83 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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":

4 changes: 2 additions & 2 deletions test/factory/common_factory_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void commonFactoryTests(ReactComponentFactoryProxy factory,
final arguments = <dynamic>[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)', () {
Expand All @@ -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', () {
Expand Down
2 changes: 1 addition & 1 deletion test/factory/dart_function_factory_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 1 addition & 5 deletions test/lifecycle_test/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c9197eb

Please sign in to comment.