pw_presubmit: Handle empty list of steps

It's possible that a program doesn't contain any steps that apply to the
files modified by a commit. This should result in a passing build, not a
failing build.

A build with empty values for both the program and step properties will
still fail—this only covers when there is a program property but it
doesn't expand to any steps.

Change-Id: I42408053f9bdcc4509d85cef4f724049abc30d6e
Bug: 588
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/77060
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
3 files changed
tree: 0011a0f533c1e895f91109a4bc306ceeb5c2c072
  1. infra/
  2. recipe_modules/
  3. recipes/
  4. scripts/
  5. .gitignore
  6. .style.yapf
  7. cipd.ensure
  8. OWNERS
  9. presubmit.sh
  10. pyproject.toml
  11. README.md
  12. recipes.py
README.md

Pigweed Recipes

This repository contains recipes for Pigweed.

A recipe is a Python script that runs a series of commands, using the recipe engine framework from the LUCI project. We use recipes to automatically check out, build, and test Pigweed and downstream projects using Pigweed in continuous integration jobs. The commands the recipes use are very similar to the ones you would use as a developer to check out, build, and test Pigweed in your local environment.

See go/pigweed-recipe-docs for complete documentation and a guide for getting started with writing recipes.

Getting the Code

The recommended way to get the source code is with git.

git clone https://pigweed.googlesource.com/infra/recipes

In most cases you will need a Chromium depot_tools checkout in your PATH as well.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools ~/depot_tools
echo 'export PATH="$PATH:$HOME/depot_tools"' >> ~/.bashrc

Running Tests

./presubmit.sh runs three different sets of tests:

  • Recipe expectation tests (./recipes.py test train)
  • Formatting (./black --diff --check .)
  • Dependencies (.recipe_deps/fuchsia/scripts/cleanup_deps.py --check)

The formatting check will tell you what‘s wrong but not fix it. For that you need to run ./black .. Similarly, the dependencies check will tell you what’s wrong but you'll need to edit the files to fix issues.

If not using ./presubmit.sh you'll need to run ./scripts/ensure_black.sh before ./black is present.