Skip to content

Commit

Permalink
Enable Nx Cloud cache for local development.
Browse files Browse the repository at this point in the history
  • Loading branch information
alantreadway committed Dec 18, 2023
1 parent 5db3ef6 commit 89b56b1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on:

env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
NX_NO_CLOUD: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/nx-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Nx Cloud Build

on:
workflow_dispatch: {}
schedule:
# Run periodically to freshen Nx Cloud cache.
- cron: 0 4 * * *

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/latest' }}

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_ACCESS_TOKEN }}

jobs:
execute_blt:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cache node_modules
if: github.event.inputs.clean_checkout != 'true'
id: cache
uses: actions/cache@v3
with:
path: |
node_modules/
packages/*/node_modules/
plugins/*/node_modules/
libraries/*/node_modules/
key: node_modules-${{hashFiles('yarn.lock','patches/*.patch', 'packages/*/package.json', 'plugins/*/package.json')}}
restore-keys: node_modules- # Take any latest cache if failed to find it for current yarn.lock
- name: Setup Node.js
id: setup_node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: yarn install
id: yarn_install
run: (yarn check --integrity && yarn postinstall) || yarn install --ci --prefer-offline

- name: nx build
id: build
run: |
# Non-batched builds - some TS/JS targets will fail if run with --batch, so build them unbatched first.
yarn nx run-many -t build --parallel=3 --exclude "all,ag-charts-website,tag:supports:batch"
# Batched builds.
yarn nx run-many -t build --parallel=3 --exclude all --batch
1 change: 1 addition & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@
"appsDir": "packages",
"libsDir": "libraries"
},
"nxCloudAccessToken": "ZDJhN2YwMWMtYWZiMS00MzY2LWFiZDgtZTc0ZTg4MTk4ZDE2fHJlYWQ=",
"defaultProject": "all"
}

0 comments on commit 89b56b1

Please sign in to comment.