Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Workiva Build, move build steps since Travis which no longer runs #296

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Collaborator

@joebingham-wk joebingham-wk Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Rosie supports this and the repo is now part of the Workiva ecosystem, should we nix this and set up consumer testing using Rosie? If not now, we could cut a ticket for it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, totally! I just included it since we had it in the old CI, and would have something in place until we set it up



# 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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was just due to dartfmt

? 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