[presubmit] Add PRESUBMIT.py

https://crbug.com/1032231

Change-Id: I81827754ae95bfef980963953a35206681037b1d
Reviewed-on: https://dart-review.googlesource.com/c/recipes/+/137983
Reviewed-by: Robbie Iannucci <iannucci@google.com>
diff --git a/.style.yapf b/.style.yapf
new file mode 100644
index 0000000..5068d37
--- /dev/null
+++ b/.style.yapf
@@ -0,0 +1,4 @@
+[style]
+# Dart uses Google style, but Chromium recipes use Chromium's style. For now,
+# we'll keep the same style as before.
+based_on_style = chromium
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
new file mode 100644
index 0000000..8f2eef7
--- /dev/null
+++ b/PRESUBMIT.py
@@ -0,0 +1,20 @@
+# Copyright 2020 The Dart project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+def CommonChecks(input_api, output_api):
+  results = []
+  results.extend(
+      input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
+  results += input_api.RunTests([
+      input_api.Command(
+          name='recipes test',
+          cmd=[input_api.python_executable, 'recipes.py', 'test', 'run'],
+          kwargs={},
+          message=output_api.PresubmitError,
+      )
+  ])
+  return results
+
+
+CheckChangeOnUpload = CommonChecks
+CheckChangeOnCommit = CommonChecks