From 11ac661e50eb9a94d395cb0cc5a2d69e315189b4 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Sat, 17 Aug 2024 20:42:16 -0400 Subject: [PATCH] Add separate file path matchers for Python and Go This will enable us to run fewer builds when we only modify files relevant to one build or the other, as well as exclude builds entirely when modifying README.md or other documentation not relevant to the code or tests entirely. --- .github/workflows/go.yaml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/python.yaml | 28 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 8a30955..8b4cc8f 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -14,11 +14,48 @@ name: "Go" +# GitHub Actions does not support anchors: +# https://github.com/actions/runner/issues/1182 +# so we need to duplicate paths below and manually keep them in sync. on: push: branches: [ main ] + paths: + # Go source files + - '**/*.go' + # Go config files + - 'go.mod' + - 'go.sum' + # Go-relevant shell scripts + - 'go*.sh' + - 'regen.sh' + # Cross-language build files and scripts + - 'Makefile' + - 'json_to_yaml_test.sh' + # Test data + - 'testdata/**' + # Go CI configs + - '.github/workflows/go.yaml' # this file + pull_request: branches: [ main ] + paths: + # Go source files + - '**/*.go' + # Go config files + - 'go.mod' + - 'go.sum' + # Go-relevant shell scripts + - 'go*.sh' + - 'regen.sh' + # Cross-language build files and scripts + - 'Makefile' + - 'json_to_yaml_test.sh' + # Test data + - 'testdata/**' + # Go CI configs + - '.github/workflows/go.yaml' # this file + schedule: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule # diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 33efe81..3075480 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -14,11 +14,39 @@ name: "Python" +# GitHub Actions does not support anchors: +# https://github.com/actions/runner/issues/1182 +# so we need to duplicate paths below and manually keep them in sync. on: push: branches: [ main ] + paths: + # Python source files + - '**/*.py' + # Python config files + - 'requirements.txt' + # Cross-language build files and scripts + - 'Makefile' + - 'json_to_yaml_test.sh' + # Test data + - 'testdata/**' + # Python CI configs + - '.github/workflows/python.yaml' # this file + pull_request: branches: [ main ] + # Python source files + - '**/*.py' + # Python config files + - 'requirements.txt' + # Cross-language build files and scripts + - 'Makefile' + - 'json_to_yaml_test.sh' + # Test data + - 'testdata/**' + # Python CI configs + - '.github/workflows/python.yaml' # this file + schedule: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule #