From 9281fc9d6155969dade39d02d59caccbe5a3157c Mon Sep 17 00:00:00 2001 From: Chau Tran Date: Sun, 10 Sep 2023 07:59:28 -0500 Subject: [PATCH] chore(repo): attempt to add CI pipeline with Nx Cloud --- .github/workflows/ci.yml | 30 +++++++ libs/ngxtension/.eslintrc.json | 7 +- nx.json | 140 +++++++++++++++++++-------------- package.json | 1 + pnpm-lock.yaml | 56 +++++++++++++ 5 files changed, 172 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..77897d2fe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + main: + name: Nx Cloud - Main Job + uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0 + with: + main-branch-name: main + number-of-agents: 3 + init-commands: | + pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3 + parallel-commands: | + pnpm exec nx-cloud record -- pnpm exec nx format:check + parallel-commands-on-agents: | + pnpm exec nx affected --target=lint --parallel=3 + pnpm exec nx affected --target=test --parallel=3 --ci --code-coverage + pnpm exec nx affected --target=e2e --parallel=3 --ci + pnpm exec nx affected --target=build --parallel=3 + + agents: + name: Nx Cloud - Agents + uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0 + with: + number-of-agents: 3 diff --git a/libs/ngxtension/.eslintrc.json b/libs/ngxtension/.eslintrc.json index ae720749f..20a61bdcc 100644 --- a/libs/ngxtension/.eslintrc.json +++ b/libs/ngxtension/.eslintrc.json @@ -36,7 +36,12 @@ "files": ["*.json"], "parser": "jsonc-eslint-parser", "rules": { - "@nx/dependency-checks": "error" + "@nx/dependency-checks": [ + "error", + { + "ignoredDependencies": ["tslib"] + } + ] } } ] diff --git a/nx.json b/nx.json index 1d46260fd..3a00fb44b 100644 --- a/nx.json +++ b/nx.json @@ -1,63 +1,81 @@ { - "$schema": "./node_modules/nx/schemas/nx-schema.json", - "tasksRunnerOptions": { - "default": { - "runner": "nx/tasks-runners/default", - "options": { - "cacheableOperations": ["build", "lint", "test", "e2e"] - } - } - }, - "workspaceLayout": { - "projectNameAndRootFormat": "as-provided" - }, - "targetDefaults": { - "build": { - "dependsOn": ["^build"], - "inputs": ["production", "^production"] - }, - "test": { - "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"] - }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore", - "{workspaceRoot}/eslint.config.js" - ] - } - }, - "namedInputs": { - "default": ["{projectRoot}/**/*", "sharedGlobals"], - "production": [ - "default", - "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", - "!{projectRoot}/tsconfig.spec.json", - "!{projectRoot}/jest.config.[jt]s", - "!{projectRoot}/src/test-setup.[jt]s", - "!{projectRoot}/test-setup.[jt]s", - "!{projectRoot}/.eslintrc.json", - "!{projectRoot}/eslint.config.js" - ], - "sharedGlobals": [] - }, - "generators": { - "@nx/angular:application": { - "style": "css", - "linter": "eslint", - "unitTestRunner": "jest", - "e2eTestRunner": "none" - }, - "@nx/angular:library": { - "linter": "eslint", - "unitTestRunner": "jest" - }, - "@nx/angular:component": { - "style": "css" - }, - "@nx/workspace:move": { - "projectNameAndRootFormat": "as-provided" - } - } + "$schema": "./node_modules/nx/schemas/nx-schema.json", + "tasksRunnerOptions": { + "default": { + "runner": "nx-cloud", + "options": { + "cacheableOperations": [ + "build", + "lint", + "test", + "e2e" + ], + "accessToken": "ZjZjZjhkOGUtNWQ5MS00NGM0LThmMDQtNDNlNzhkYjJjMmZmfHJlYWQtd3JpdGU=" + } + } + }, + "workspaceLayout": { + "projectNameAndRootFormat": "as-provided" + }, + "targetDefaults": { + "build": { + "dependsOn": [ + "^build" + ], + "inputs": [ + "production", + "^production" + ] + }, + "test": { + "inputs": [ + "default", + "^production", + "{workspaceRoot}/jest.preset.js" + ] + }, + "lint": { + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore", + "{workspaceRoot}/eslint.config.js" + ] + } + }, + "namedInputs": { + "default": [ + "{projectRoot}/**/*", + "sharedGlobals" + ], + "production": [ + "default", + "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", + "!{projectRoot}/tsconfig.spec.json", + "!{projectRoot}/jest.config.[jt]s", + "!{projectRoot}/src/test-setup.[jt]s", + "!{projectRoot}/test-setup.[jt]s", + "!{projectRoot}/.eslintrc.json", + "!{projectRoot}/eslint.config.js" + ], + "sharedGlobals": [] + }, + "generators": { + "@nx/angular:application": { + "style": "css", + "linter": "eslint", + "unitTestRunner": "jest", + "e2eTestRunner": "none" + }, + "@nx/angular:library": { + "linter": "eslint", + "unitTestRunner": "jest" + }, + "@nx/angular:component": { + "style": "css" + }, + "@nx/workspace:move": { + "projectNameAndRootFormat": "as-provided" + } + } } diff --git a/package.json b/package.json index 5c8fb11b3..518a45085 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "jsonc-eslint-parser": "^2.1.0", "ng-packagr": "~16.2.0", "nx": "16.8.1", + "nx-cloud": "^16.4.0", "postcss": "^8.4.5", "postcss-import": "~14.1.0", "postcss-preset-env": "~7.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 461c63731..84b498b42 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -136,6 +136,9 @@ devDependencies: nx: specifier: 16.8.1 version: 16.8.1 + nx-cloud: + specifier: ^16.4.0 + version: 16.4.0 postcss: specifier: ^8.4.5 version: 8.4.29 @@ -4026,6 +4029,14 @@ packages: - verdaccio dev: true + /@nrwl/nx-cloud@16.4.0: + resolution: {integrity: sha512-QitrYK6z9ceagetBlgLMZnC0T85k2JTk+oK0MxZ5p/woclqeYN7SiGNZgMzDq8TjJwt8Fm/MDnsSo3xtufmLBg==} + dependencies: + nx-cloud: 16.4.0 + transitivePeerDependencies: + - debug + dev: true + /@nrwl/tao@16.8.1: resolution: {integrity: sha512-hgGFLyEgONSofxnJsXN9NlUx4J8/YSLUkfZKdR8Qa97+JGZT8FEuk7NLFJOWdYYqROoCzXLHK0d+twFFNPS5BQ==} hasBin: true @@ -5891,6 +5902,16 @@ packages: engines: {node: '>= 0.4'} dev: true + /axios@1.1.3: + resolution: {integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==} + dependencies: + follow-redirects: 1.15.2 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + dev: true + /axios@1.5.0: resolution: {integrity: sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==} dependencies: @@ -7566,6 +7587,11 @@ packages: engines: {node: '>=12'} dev: true + /dotenv@10.0.0: + resolution: {integrity: sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==} + engines: {node: '>=10'} + dev: true + /dotenv@16.3.1: resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} engines: {node: '>=12'} @@ -11277,6 +11303,24 @@ packages: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} dev: true + /nx-cloud@16.4.0: + resolution: {integrity: sha512-jbq4hWvDwRlJVpxgMgbmNSkue+6XZSn53R6Vo6qmCAWODJ9KY1BZdZ/9VRL8IX/BRKebVFiXp3SapFB1qPhH8A==} + hasBin: true + dependencies: + '@nrwl/nx-cloud': 16.4.0 + axios: 1.1.3 + chalk: 4.1.2 + dotenv: 10.0.0 + fs-extra: 11.1.1 + node-machine-id: 1.1.12 + open: 8.4.2 + strip-json-comments: 3.1.1 + tar: 6.1.11 + yargs-parser: 21.1.1 + transitivePeerDependencies: + - debug + dev: true + /nx@16.8.1: resolution: {integrity: sha512-K5KrwNdPz0eEe6SY5wrnhZcigjfIJkttPrIJRXNBQTE50NGcOfz1TjMXPdTWBxBCCua5PAealO3OrE8jpv+QnQ==} hasBin: true @@ -13865,6 +13909,18 @@ packages: readable-stream: 3.6.2 dev: true + /tar@6.1.11: + resolution: {integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==} + engines: {node: '>= 10'} + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 3.3.6 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + dev: true + /tar@6.2.0: resolution: {integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==} engines: {node: '>=10'}