Skip to content

build: Improve CI cache #7141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# Parse version from head branch
text: ${{ github.head_ref }}
# match: preprare-release/xx.xx.xx
regex: '^preprare-release\/(\d+\.\d+\.\d+)$'
regex: '^prepare-release\/(\d+\.\d+\.\d+)$'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, there was a typo here, so it didn't trigger this before.


- name: Prepare release
uses: getsentry/action-prepare-release@v1
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ env:
NX_CACHE_RESTORE_KEYS: |
nx-Linux-${{ github.ref }}-${{ github.event.inputs.commit || github.sha }}
nx-Linux-${{ github.ref }}
nx-Linux-refs/heads/develop
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I figured this isn't actually necessary, because the way cache works is that it only ever fetches from the current branch OR the default branch (=develop), so it can't even get the cache from a different branch. so should be all good without this.

nx-Linux

jobs:
Expand Down Expand Up @@ -173,6 +172,7 @@ jobs:
key: ${{ steps.compute_lockfile_hash.outputs.hash }}

- name: Install dependencies
if: steps.cache_dependencies.outputs.cache_hit != 'true'
run: yarn install --ignore-engines --frozen-lockfile
outputs:
dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }}
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
needs.job_get_metadata.outputs.is_release == 'false' &&
needs.job_get_metadata.outputs.force_skip_cache == 'false'
with:
path: node_modules/.cache/nx
path: .nxcache
key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
# On develop branch, we want to _store_ the cache (so it can be used by other branches), but never _restore_ from it
restore-keys:
Expand Down Expand Up @@ -244,12 +244,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -288,12 +288,12 @@ jobs:
# use Node 14 for now.
node-version: '14'
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand All @@ -319,12 +319,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand All @@ -344,12 +344,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand All @@ -370,12 +370,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -407,12 +407,12 @@ jobs:
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -442,12 +442,12 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -480,12 +480,12 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -551,12 +551,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -609,12 +609,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand All @@ -639,12 +639,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -677,12 +677,12 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -713,12 +713,12 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -747,12 +747,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -810,12 +810,12 @@ jobs:
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sentry-node-serverless-*.zip
jest/transformers/*.js
# node tarballs
packages/*/sentry-*.tgz
.nxcache

# logs
yarn-error.log
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.md
.nxcache
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build:transpile",
"build:types",
"lint:eslint"
]
],
"cacheDirectory": ".nxcache"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"circularDepCheck": "lerna run circularDepCheck",
"clean": "run-p clean:build clean:caches",
"clean:build": "lerna run clean",
"clean:caches": "yarn rimraf eslintcache && yarn jest --clearCache",
"clean:caches": "yarn rimraf eslintcache .nxcache && yarn jest --clearCache",
"clean:deps": "lerna clean --yes && rm -rf node_modules && yarn",
"clean:all": "run-p clean:build clean:caches clean:deps",
"codecov": "codecov",
Expand Down