Skip to content

Commit

Permalink
Merge pull request #297 from Workiva/gh-actions-ci
Browse files Browse the repository at this point in the history
Set up Github actions CI
  • Loading branch information
greglittlefield-wf authored Jan 14, 2021
2 parents c9197eb + 76147d6 commit 277cf61
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/dart_ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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'
19 changes: 5 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Pub](https://img.shields.io/pub/v/react.svg)](https://pub.dev/packages/react)
![ReactJS v16.10.1](https://img.shields.io/badge/React_JS-v16.10.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:_
Expand Down

0 comments on commit 277cf61

Please sign in to comment.