From 309f48785c4965a291be088ea60146f455095224 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 9 Sep 2022 14:37:11 -0400 Subject: [PATCH 1/3] Add CI-specific pants config file --- pants.ci.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pants.ci.toml diff --git a/pants.ci.toml b/pants.ci.toml new file mode 100644 index 0000000000..9bc051f7af --- /dev/null +++ b/pants.ci.toml @@ -0,0 +1,13 @@ +# This config is for CI. It extends the config in pants.toml. +# See https://www.pantsbuild.org/docs/using-pants-in-ci + +[GLOBAL] +# Colors often work in CI, but the shell is usually not a TTY so Pants +# doesn't attempt to use them by default. +colors = true + +[stats] +# "print metrics of your cache's performance at the end of the run, +# including the number of cache hits and the total time saved thanks +# to caching" +log = true From 9f45f91b0b8b7e4069f91ee5ac9c648650a84c27 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 9 Sep 2022 17:19:58 -0400 Subject: [PATCH 2/3] add gha workflow to validate pants BUILD files --- .github/workflows/pants.yaml | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/pants.yaml diff --git a/.github/workflows/pants.yaml b/.github/workflows/pants.yaml new file mode 100644 index 0000000000..f3de3924f8 --- /dev/null +++ b/.github/workflows/pants.yaml @@ -0,0 +1,62 @@ +--- +name: Validate Pants Metadata + +on: + # temporarily only allow manual runs until we have BUILD files and lockfiles + workflow_dispatch: + #push: + # branches: + # # only on merges to master branch + # - master + # # and version branches, which only include minor versions (eg: v3.4) + # - v[0-9]+.[0-9]+ + # tags: + # # also version tags, which include bugfix releases (eg: v3.4.0) + # - v[0-9]+.[0-9]+.[0-9]+ + #pull_request: + # type: [opened, reopened, edited] + # branches: + # # Only for PRs targeting those branches + # - master + # - v[0-9]+.[0-9]+ + +jobs: + pants-tailor: + name: Make sure pants BUILD files are up-to-date + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # a test uses a submodule, and pants needs access to it to calculate deps. + submodules: 'true' + + - name: Initialize Pants and its GHA caches + uses: pantsbuild/actions/init-pants@c0ce05ee4ba288bb2a729a2b77294e9cb6ab66f7 + # This action adds an env var to make pants use both pants.ci.toml & pants.toml. + # This action also creates 3 GHA caches (1 is optional). + # - `pants-setup` has the bootsrapped pants install + # - `pants-named-caches` has pip/wheel and PEX caches + # - `pants-lmdb-store` has the fine-grained process cache. + # If we ever use a remote cache, then we can drop this. + # Otherwise, we may need an additional workflow or job to delete old caches + # if they are not expiring fast enough, and we hit the GHA 10GB per repo max. + with: + # To ignore a bad cache, bump the cache* integer. + gha-cache-key: cache0-BUILD + # This hash should include all of our lockfiles so that the pip/pex caches + # get invalidated on any transitive dependency update. + named-caches-hash: ${{ hashFiles('requirements.txt' }} + # enable the optional lmdb_store cache since we're not using remote caching. + cache-lmdb-store: 'true' + + - name: Check BUILD files + run: | + ./pants tailor --check update-build-files --check :: + + - name: Upload pants log + uses: actions/upload-artifact@v2 + with: + name: pants-log-py${{ matrix.python-version }} + path: .pants.d/pants.log + if: always() # We want the log even on failures. From f54294d520eb237b76707c9b61f933a0e5726409 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 9 Sep 2022 20:23:10 -0400 Subject: [PATCH 3/3] update changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0b9f249c68..9e081cf387 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -53,7 +53,7 @@ Added * Begin introducing `pants `_ to improve DX (Developer Experience) working on StackStorm, improve our security posture, and improve CI reliability thanks in part - to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 + to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 Contributed by @cognifloyd Changed