Skip to content
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

chore: setup Nx Cloud Id for PAT support #2410

Merged
merged 1 commit into from
Nov 6, 2024
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
5 changes: 1 addition & 4 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
env:
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }}
YARN_ENABLE_HARDENED_MODE: 0
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read
Expand All @@ -43,8 +44,6 @@ jobs:
matrix:
os: ${{ fromJson(github.event_name != 'push' && '["ubuntu-latest", "windows-latest"]' || '["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -83,8 +82,6 @@ jobs:
tools/**/dist-test/ut-report.xml
lint:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ on:

env:
YARN_ENABLE_HARDENED_MODE: 0
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
# Check the integrity of yarn lock
yarn_lock_check:
runs-on: ubuntu-latest
env:
NX_SKIP_NX_CACHE: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to your change but don't we want the Nx cache for this step?

Copy link
Contributor Author

@kpanot kpanot Nov 6, 2024

Choose a reason for hiding this comment

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

It is required by nx-cloud runner when run in CI.
cf: https://github.com/AmadeusITGroup/otter/actions/runs/11702511447/job/32590842412

edit:
I completely misread your question, sorry about that.
It would actually speed up the postinstall process, we may want it. I will add it in another PR, I keep it as it currently is in this PR

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./tools/github-actions/setup
Expand All @@ -36,7 +39,6 @@ jobs:
runs-on: ubuntu-latest
needs: [yarn_lock_check]
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_SKIP_NX_CACHE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ on:

env:
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
environment: ${{inputs.isPullRequest && 'development' || 'production'}}
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ To be able to benefit from this feature, you will need to perform the following

1. Create an account on [Nx Cloud App](https://cloud.nx.app/)
2. Create a Personal Access Token on [profile page](https://cloud.nx.app/profile/tokens).
3. Create a local environment variable **NX_CLOUD_ACCESS_TOKEN** with your previously generated PAT *(example on Linux: `export NX_CLOUD_ACCESS_TOKEN=xxxxxxx`)*
3. Follow [Nx Cloud instruction](https://nx.dev/ci/recipes/security/personal-access-tokens) to setup your previously generated PAT.

When building (`yarn build`) the project on the `main` branch (or another `release/*` branch), the remote cache will be downloaded.

Expand Down
11 changes: 10 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,5 +515,14 @@
"appsDir": "apps"
},
"useDaemonProcess": false,
"cacheDirectory": ".cache/nx"
"cacheDirectory": ".cache/nx",
"nxCloudId": "63e6951e043da20dd8321aec",
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"nxCloudId": "63e6951e043da20dd8321aec"
kpanot marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
"ngx-highlightjs": "^12.0.0",
"npm-run-all2": "^6.0.0",
"nx": "~19.5.0",
"nx-cloud": "^19.1.0",
"playwright-lighthouse": "~4.0.0",
"postcss": "~8.4.31",
"postcss-scss": "~4.0.9",
Expand Down
47 changes: 42 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6601,6 +6601,15 @@ __metadata:
languageName: node
linkType: hard

"@nrwl/nx-cloud@npm:19.1.0":
version: 19.1.0
resolution: "@nrwl/nx-cloud@npm:19.1.0"
dependencies:
nx-cloud: "npm:19.1.0"
checksum: 10/ecae86aa0af80fb5d82f7f1cfc8e985231624f19b0131237a891895804def6f20a3c69fb2dbab020889b0351361ba9e9108a104c6f40243b029a7f98868a0042
languageName: node
linkType: hard

"@nrwl/tao@npm:19.5.9":
version: 19.5.9
resolution: "@nrwl/tao@npm:19.5.9"
Expand Down Expand Up @@ -8759,6 +8768,7 @@ __metadata:
ngx-highlightjs: "npm:^12.0.0"
npm-run-all2: "npm:^6.0.0"
nx: "npm:~19.5.0"
nx-cloud: "npm:^19.1.0"
pixelmatch: "npm:^5.2.1"
playwright-lighthouse: "npm:~4.0.0"
pngjs: "npm:^7.0.0"
Expand Down Expand Up @@ -15963,7 +15973,7 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:1.7.7, axios@npm:^1.6.7, axios@npm:^1.7.2":
"axios@npm:1.7.7, axios@npm:^1.6.0, axios@npm:^1.6.7, axios@npm:^1.7.2":
version: 1.7.7
resolution: "axios@npm:1.7.7"
dependencies:
Expand Down Expand Up @@ -19279,6 +19289,13 @@ __metadata:
languageName: node
linkType: hard

"dotenv@npm:~10.0.0":
version: 10.0.0
resolution: "dotenv@npm:10.0.0"
checksum: 10/55f701ae213e3afe3f4232fae5edfb6e0c49f061a363ff9f1c5a0c2bf3fb990a6e49aeada11b2a116efb5fdc3bc3f1ef55ab330be43033410b267f7c0809a9dc
languageName: node
linkType: hard

"dotgitignore@npm:^2.1.0":
version: 2.1.0
resolution: "dotgitignore@npm:2.1.0"
Expand Down Expand Up @@ -26745,7 +26762,7 @@ __metadata:
languageName: node
linkType: hard

"node-machine-id@npm:1.1.12":
"node-machine-id@npm:1.1.12, node-machine-id@npm:^1.1.12":
version: 1.1.12
resolution: "node-machine-id@npm:1.1.12"
checksum: 10/46bf3d4fab8d0e63b24c42bcec2b6975c7ec5bc16e53d7a589d095668d0fdf0bfcbcdc28246dd1ef74cf95a37fbd774cd4b17b41f518d79dfad7fdc99f995903
Expand Down Expand Up @@ -27004,6 +27021,26 @@ __metadata:
languageName: node
linkType: hard

"nx-cloud@npm:19.1.0, nx-cloud@npm:^19.1.0":
version: 19.1.0
resolution: "nx-cloud@npm:19.1.0"
dependencies:
"@nrwl/nx-cloud": "npm:19.1.0"
axios: "npm:^1.6.0"
chalk: "npm:^4.1.0"
dotenv: "npm:~10.0.0"
fs-extra: "npm:^11.1.0"
ini: "npm:4.1.3"
node-machine-id: "npm:^1.1.12"
open: "npm:~8.4.0"
tar: "npm:6.2.1"
yargs-parser: "npm:>=21.1.1"
bin:
nx-cloud: bin/nx-cloud.js
checksum: 10/c4cfaac8b048580e6d0b18d1cc6c94107762c91fc9530806465a7286f2fff924bc98914883ddb052c53c4066fbe2bfe19674f69729e28fe4928e25dd1e911828
languageName: node
linkType: hard

"nx@npm:19.5.9, nx@npm:~19.5.0":
version: 19.5.9
resolution: "nx@npm:19.5.9"
Expand Down Expand Up @@ -27276,7 +27313,7 @@ __metadata:
languageName: node
linkType: hard

"open@npm:^8.0.0, open@npm:^8.0.4, open@npm:^8.0.9, open@npm:^8.4.0":
"open@npm:^8.0.0, open@npm:^8.0.4, open@npm:^8.0.9, open@npm:^8.4.0, open@npm:~8.4.0":
version: 8.4.2
resolution: "open@npm:8.4.2"
dependencies:
Expand Down Expand Up @@ -31996,7 +32033,7 @@ __metadata:
languageName: node
linkType: hard

"tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.2.1":
"tar@npm:6.2.1, tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.2.1":
version: 6.2.1
resolution: "tar@npm:6.2.1"
dependencies:
Expand Down Expand Up @@ -34589,7 +34626,7 @@ __metadata:
languageName: node
linkType: hard

"yargs-parser@npm:21.1.1, yargs-parser@npm:^21.0.0, yargs-parser@npm:^21.1.1":
"yargs-parser@npm:21.1.1, yargs-parser@npm:>=21.1.1, yargs-parser@npm:^21.0.0, yargs-parser@npm:^21.1.1":
version: 21.1.1
resolution: "yargs-parser@npm:21.1.1"
checksum: 10/9dc2c217ea3bf8d858041252d43e074f7166b53f3d010a8c711275e09cd3d62a002969a39858b92bbda2a6a63a585c7127014534a560b9c69ed2d923d113406e
Expand Down
Loading