Update ci.yml (#109)

Use latest CI setup script
Fix directive ordering
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1608e16..6cb37f7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,49 +1,52 @@
 name: ci
 
 on:
+  # Run on PRs and pushes to the default branch.
   push:
     branches: [ master ]
   pull_request:
+    branches: [ master ]
   schedule:
-    # “At 00:00 (UTC) on Sunday.”
-    - cron: '0 0 * * 0'
+    - cron: "0 0 * * 0"
+
+env:
+  PUB_ENVIRONMENT: bot.github
 
 jobs:
-  analyze_format:
+  # Check code formatting and static analysis on a single OS (linux)
+  # against Dart dev and stable.
+  analyze:
     runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        sdk: [dev]
     steps:
-    - uses: cedx/setup-dart@v2
-      with:
-        release-channel: dev
-    - run: dart --version
-    - uses: actions/checkout@v2
+      - uses: actions/checkout@v2
+      - uses: dart-lang/setup-dart@v1.0
+        with:
+          sdk: ${{ matrix.sdk }}
+      - id: install
+        name: Install dependencies
+        run: dart pub get
+      - name: Check formatting
+        run: dart format --output=none --set-exit-if-changed .
+        if: always() && steps.install.outcome == 'success'
+      - name: Analyze code
+        run: dart analyze --fatal-infos
+        if: always() && steps.install.outcome == 'success'
 
-    - run: pub get
-
-    - run: dart format --output=none --set-exit-if-changed .
-    - run: dart analyze --fatal-infos .
-  test_web:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: cedx/setup-dart@v2
-      with:
-        release-channel: dev
-    - run: dart --version
-    - uses: actions/checkout@v2
-
-    - run: pub get
-    - run: pub run test -p chrome
-  test_vm:
+  test:
+    needs: analyze
+    runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-       os: [macos-latest, windows-latest, ubuntu-latest]
-    runs-on: ${{ matrix.os }}
+        os: [ubuntu-latest]
+        sdk: [2.12.0, dev]
     steps:
-    - uses: cedx/setup-dart@v2
-      with:
-        release-channel: dev
-    - run: dart --version
-    - uses: actions/checkout@v2
-
-    - run: pub get
-    - run: pub run test -p vm
+      - uses: actions/checkout@v2
+      - uses: dart-lang/setup-dart@v1.0
+        with:
+          sdk: ${{ matrix.sdk }}
+      - run: dart pub get
+      - run: dart test --platform vm,chrome
diff --git a/test/browser_test.dart b/test/browser_test.dart
index ac25dbe..24b36a7 100644
--- a/test/browser_test.dart
+++ b/test/browser_test.dart
@@ -3,11 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 @TestOn('browser')
-
 import 'dart:html';
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
 
 void main() {
   group('new Context()', () {
diff --git a/test/path_map_test.dart b/test/path_map_test.dart
index 127d7c6..11c4a3e 100644
--- a/test/path_map_test.dart
+++ b/test/path_map_test.dart
@@ -2,9 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
-
 import 'package:path/path.dart';
+import 'package:test/test.dart';
 
 void main() {
   group('considers equal', () {
diff --git a/test/path_set_test.dart b/test/path_set_test.dart
index 3214e19..135f9de 100644
--- a/test/path_set_test.dart
+++ b/test/path_set_test.dart
@@ -2,9 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
-
 import 'package:path/path.dart';
+import 'package:test/test.dart';
 
 void main() {
   group('considers equal', () {
diff --git a/test/path_test.dart b/test/path_test.dart
index 6625ac4..b99b78b 100644
--- a/test/path_test.dart
+++ b/test/path_test.dart
@@ -2,8 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
 
 void main() {
   group('path.Style', () {
diff --git a/test/posix_test.dart b/test/posix_test.dart
index 8ade403..53b18f2 100644
--- a/test/posix_test.dart
+++ b/test/posix_test.dart
@@ -2,8 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/url_test.dart b/test/url_test.dart
index cb2d4cb..96f86b5 100644
--- a/test/url_test.dart
+++ b/test/url_test.dart
@@ -2,8 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/utils.dart b/test/utils.dart
index 96702bf..08d4a52 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -2,8 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
 
 /// A matcher for a closure that throws a [p.PathException].
 final throwsPathException = throwsA(const TypeMatcher<p.PathException>());
diff --git a/test/windows_test.dart b/test/windows_test.dart
index d658795..1e8c374 100644
--- a/test/windows_test.dart
+++ b/test/windows_test.dart
@@ -2,8 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:test/test.dart';
 import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
 
 import 'utils.dart';