Skip to content

Commit c9197eb

Browse files
Merge pull request #296 from Workiva/workiva-build
Set up Workiva Build, move build steps since Travis which no longer runs
2 parents 7d69757 + c5162bb commit c9197eb

File tree

6 files changed

+91
-36
lines changed

6 files changed

+91
-36
lines changed

.travis.yml

-27
This file was deleted.

Dockerfile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM drydock-prod.workiva.net/workiva/dart_build_image:1
2+
3+
# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile
4+
5+
# Set the expected Chrome major version. This allows us to update the expected version when
6+
# we need to roll out a new version of this base image with a new chrome version as the only change
7+
ENV EXPECTED_CHROME_VERSION=87
8+
9+
# Install Chrome
10+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
11+
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \
12+
apt-get -qq update && apt-get install -y google-chrome-stable && \
13+
mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \
14+
sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome
15+
16+
# Fail the build if the version doesn't match what we expected
17+
RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\."
18+
19+
# Need to analyze and format since dart_build_image only does it automatically for
20+
# packages that depend on dart_dev
21+
RUN dartanalyzer .
22+
RUN dartfmt --line-length=120 --dry-run --set-exit-if-changed .
23+
24+
RUN pub run dependency_validator -i build_runner,build_test,build_web_compilers
25+
26+
# TODO run tests using dart_unit_test_image in skynet, remove Chrome install
27+
RUN pub run build_runner test --release -- --preset dart2js --exclude-tags=dart-2-7-dart2js-variadic-issues
28+
RUN pub run build_runner test -- --preset dartdevc
29+
30+
RUN dart ./tool/run_consumer_tests.dart --orgName Workiva --repoName over_react --testCmd "pub run dart_dev test -P dartdevc"
31+
32+
33+
# We need 2.9.2 to verify the Chrome MemoryInfo workaround: https://github.com/cleandart/react-dart/pull/280,
34+
# and to run the tests that fail in 2.7
35+
# TODO remove the workaround as well as this config once SDK lower bound is >=2.9.3
36+
FROM google/dart:2.9.2
37+
RUN dart --version
38+
39+
# Don't allow the dart package to be updated via apt
40+
RUN apt-mark hold dart
41+
42+
# Update image - required by aviary
43+
RUN apt-get update -qq && \
44+
apt-get dist-upgrade -y && \
45+
apt-get autoremove -y && \
46+
apt-get clean all
47+
# Install deps for Chrome install
48+
RUN apt-get install -y \
49+
build-essential \
50+
curl \
51+
git \
52+
make \
53+
parallel \
54+
wget \
55+
&& rm -rf /var/lib/apt/lists/*
56+
57+
# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile
58+
59+
# Set the expected Chrome major version. This allows us to update the expected version when
60+
# we need to roll out a new version of this base image with a new chrome version as the only change
61+
ENV EXPECTED_CHROME_VERSION=87
62+
63+
# Install Chrome
64+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
65+
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \
66+
apt-get -qq update && apt-get install -y google-chrome-stable && \
67+
mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \
68+
sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome
69+
70+
# Fail the build if the version doesn't match what we expected
71+
RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\."
72+
73+
WORKDIR /build/
74+
ADD . /build/
75+
76+
RUN pub get
77+
# Run dart2js tests that fail in 2.7
78+
RUN pub run build_runner test --release -- --preset dart2js --tags=dart-2-7-dart2js-variadic-issues
79+
# Run DDC tests to verify Chrome workaround
80+
RUN pub run build_runner test -- --preset dartdevc
81+
82+
83+
FROM scratch

dart_test.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ presets:
1212
exclude_tags: no-dartdevc
1313

1414
tags:
15-
"fails-on-241":
15+
# Variadic children tests of >5 children that fail in Dart 2.7 for an unknown reason, seemingly an SDK bug.
16+
# These tests pass in later Dart SDKs, so we ignore them when running in 2.7.
17+
"dart-2-7-dart2js-variadic-issues":
18+

test/factory/common_factory_tests.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void commonFactoryTests(ReactComponentFactoryProxy factory,
7070
final arguments = <dynamic>[props, ...expectedChildren];
7171
final instance = Function.apply(factory, arguments);
7272
expect(getChildren(instance), expectedChildren);
73-
});
73+
}, tags: i > 5 ? 'dart-2-7-dart2js-variadic-issues' : null);
7474
}
7575

7676
test('$maxSupportedVariadicChildCount (and passes static analysis)', () {
@@ -79,7 +79,7 @@ void commonFactoryTests(ReactComponentFactoryProxy factory,
7979
// Generate these instead of hard coding them to ensure the arguments passed into this test match maxSupportedVariadicChildCount
8080
final expectedChildren = new List.generate(maxSupportedVariadicChildCount, (i) => i + 1);
8181
expect(getChildren(instance), equals(expectedChildren));
82-
});
82+
}, tags: 'dart-2-7-dart2js-variadic-issues');
8383
});
8484

8585
test('a List', () {

test/factory/dart_function_factory_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ main() {
3131
expect(_getJsFunctionName(FunctionFoo.reactFunction), '_FunctionFoo');
3232

3333
expect(FunctionFoo.displayName, _getJsFunctionName(FunctionFoo.reactFunction));
34-
}, tags: ['fails-on-241']);
34+
});
3535

3636
test('is populated by the provided argument', () {
3737
expect(NamedFunctionFoo.displayName, 'Bar');

test/lifecycle_test/util.dart

+1-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ mixin LifecycleTestHelper on Component {
4040
'context': context,
4141
});
4242

43-
var lifecycleCallback = props == null
44-
? staticProps == null
45-
? null
46-
: staticProps[memberName]
47-
: props[memberName];
43+
var lifecycleCallback = props == null ? staticProps == null ? null : staticProps[memberName] : props[memberName];
4844
if (lifecycleCallback != null) {
4945
return Function.apply(
5046
lifecycleCallback,

0 commit comments

Comments
 (0)