Skip to content

Commit a2dd724

Browse files
devversionamysorto
authored andcommitted
build: do not accidentally cache undesired files in github action (#23875)
This commit fixes that the Github actions currently may cache undesired files. e.g. when Bazel runs the `dist/` folder is populated and symlinked with the execroot, where another clone of the `node_modules` would be cached accidentally then. We use an explicit path instead of a pattern as it has been recommended by the Github action documentation. Additionally, we fix that the dev-app building on RBE occurs with 2 concurrent jobs due to the host containers only having 2 cores. We can run more jobs in the RBE containers. (cherry picked from commit acd5ee1)
1 parent 5585d4f commit a2dd724

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/actions/yarn-install/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ runs:
77
- uses: actions/cache@v2
88
with:
99
path: |
10-
**/node_modules
10+
./node_modules/
1111
# Cache key. Whenever the postinstall patches change, the cache needs to be invalidated.
1212
# If just the `yarn.lock` file changes, the most recent cache can be restored though.
1313
# See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action.
14-
key: v2-${{hashFiles('tools/postinstall/apply-patches.js')}}-${{hashFiles('yarn.lock')}}
15-
restore-keys: v2-${{hashFiles('tools/postinstall/apply-patches.js')}}-
14+
key: v3-${{hashFiles('tools/postinstall/apply-patches.js')}}-${{hashFiles('yarn.lock')}}
15+
restore-keys: v3-${{hashFiles('tools/postinstall/apply-patches.js')}}-
1616

1717
- run: yarn install --frozen-lockfile --non-interactive
1818
shell: bash

.github/workflows/build-dev-app.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ jobs:
2828
GCP_DECRYPT_TOKEN: angular
2929

3030
# Build the web package. Note that we also need to make the Github environment
31-
# variables available so that the RBE is configured.
31+
# variables available so that the RBE is configured. Note: We run Bazel from a
32+
# low-resource Github action container, so we manually need to instruct Bazel to run
33+
# more actions concurrently as by default this is computed based on the host resources.
3234
- name: Building dev-app
3335
run: |
3436
source ${GITHUB_ENV}
35-
bazel build //src/dev-app:web_package --symlink_prefix=dist/
37+
bazel build //src/dev-app:web_package --symlink_prefix=dist/ --jobs=32
3638
3739
# Prepare the workflow artifact that is available for the deploy workflow. We store the pull
3840
# request number and SHA in a file that can be read by the deploy workflow. This is necessary

0 commit comments

Comments
 (0)