Skip to content

Commit

Permalink
Merge branch 'master' into feature/support-cjs-and-mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhe554 authored Feb 6, 2024
2 parents e96a854 + bf62661 commit cdd74b0
Show file tree
Hide file tree
Showing 42 changed files with 665 additions and 216 deletions.
5 changes: 4 additions & 1 deletion .nx/workflows/agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ launch-templates:
~/.cache/Cypress
~/.pnpm-store
BASE_BRANCH: 'master'

- name: Install e2e deps
script: |
sudo apt-get update
sudo apt-get install -y ca-certificates lsof
- name: Install Pnpm
script: |
npm install -g @pnpm/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions community/approved-plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,5 +458,10 @@
"name": "@gnuechtel/nx-cucumber",
"description": "Plugin to use Cucumber within Nx workspaces",
"url": "https://gitlab.com/gnuechtel/open-source/-/tree/main/libs/nx-cucumber"
},
{
"name": "@analogjs/platform",
"description": "Official plugin to add Analog to your Nx monorepo.",
"url": "https://analogjs.org/docs/integrations/nx"
}
]
57 changes: 57 additions & 0 deletions docs/generated/manifests/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,29 @@
"path": "/ci/recipes/on-premise",
"tags": []
},
{
"id": "troubleshooting",
"name": "Troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"mediaImage": "",
"file": "",
"itemList": [
{
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
}
],
"isExternal": false,
"path": "/ci/recipes/troubleshooting",
"tags": []
},
{
"id": "other",
"name": "Other",
Expand Down Expand Up @@ -1224,6 +1247,40 @@
"path": "/ci/recipes/on-premise/advanced-config",
"tags": []
},
"/ci/recipes/troubleshooting": {
"id": "troubleshooting",
"name": "Troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"mediaImage": "",
"file": "",
"itemList": [
{
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
}
],
"isExternal": false,
"path": "/ci/recipes/troubleshooting",
"tags": []
},
"/ci/recipes/troubleshooting/ci-execution-failed": {
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
},
"/ci/recipes/other": {
"id": "other",
"name": "Other",
Expand Down
42 changes: 42 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -6144,6 +6144,23 @@
],
"disableCollapsible": false
},
{
"name": "Troubleshooting",
"path": "/ci/recipes/troubleshooting",
"id": "troubleshooting",
"isExternal": false,
"children": [
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
}
],
"disableCollapsible": false
},
{
"name": "Other",
"path": "/ci/recipes/other",
Expand Down Expand Up @@ -6544,6 +6561,31 @@
"children": [],
"disableCollapsible": false
},
{
"name": "Troubleshooting",
"path": "/ci/recipes/troubleshooting",
"id": "troubleshooting",
"isExternal": false,
"children": [
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
}
],
"disableCollapsible": false
},
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "Other",
"path": "/ci/recipes/other",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/next/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ The library in `dist` is publishable to npm or a private registry.

### Static HTML Export

Next.js applications can be statically exported by changing th eoutput inside your Next.js configuration file.
Next.js applications can be statically exported by changing the output inside your Next.js configuration file.

```js {% fileName="apps/my-next-app/next.config.js" %}
const nextConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ and the version of NodeJS that we tested it against.
| 13.x | 10.x, 12.x, 14.x | ~4.6.2 |
| 14.x | 12.x, 14.x, 16.x | ~4.7.2 |
| 15.x | 14.x, 16.x, 18.x | ~5.0.0 |
| 16.x (previous) | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (latest) | 18.x, 20.x | ~5.1.0 |
| 16.x | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (previous) | 18.x, 20.x | ~5.1.0 |
| 18.x (latest) | 18.x, 20.x | ~5.1.0 |
12 changes: 12 additions & 0 deletions docs/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,18 @@
}
]
},
{
"name": "Troubleshooting",
"id": "troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"itemList": [
{
"name": "CI Execution Failed",
"id": "ci-execution-failed",
"file": "nx-cloud/troubleshooting/ci-execution-failed"
}
]
},
{
"name": "Other",
"id": "other",
Expand Down
2 changes: 1 addition & 1 deletion docs/nx-cloud/reference/nx-cloud-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ individual commands as follows:

## npx nx-cloud stop-all-agents

Same as `npx nx-cloud complete-ci-run` and `npx nx-cloud complete-run-group`.
Same as `npx nx-cloud complete-ci-run`.

This command tells Nx Cloud to terminate all agents associated with this CI pipeline execution.
Invoking this command is not needed anymore. New versions of Nx Cloud can track when the main job terminates
Expand Down
62 changes: 62 additions & 0 deletions docs/nx-cloud/troubleshooting/ci-execution-failed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Understanding 'CI Execution Failed'

## Task Runner-Related

### No additional tasks detected

Nx Cloud is not aware of any more tasks to distribute. This can occur if Nx Cloud thinks it is done receiving tasks to distribute and all existing tasks have been completed.

If you are receiving this error before your full pipeline has completed, consider using [--stop-agents-after](https://nx.dev/ci/reference/nx-cloud-cli#stopagentsafter) with the target set to the last target run in your pipeline.

### The Nx Cloud heartbeat process failed to report its status in time

While running in CI environments, Nx Cloud spawns a background process called the "heartbeat" to help maintain status synchronization between itself and external platforms. When the heartbeat process does not report to Nx Cloud for 30 seconds or longer, Nx Cloud assumes something has gone wrong and terminates the current CI Pipeline Execution.

This behavior can be disabled by setting the [--require-explicit-completion](https://nx.dev/ci/reference/nx-cloud-cli#requireexplicitcompletion) flag to `true` on your `nx-cloud start-ci-run` command.

### A command was issued to stop all Nx Cloud agents

Nx Cloud provides two commands to forcibly stop agents, [stop-all-agents and complete-ci-run](https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-stopallagents).

Once these commands are invoked, the current CI Pipeline Execution is closed and can no longer receive new work.

### Nx Cloud agents were stopped due to an error

Nx Cloud detected a failed task in the current CI Pipeline Execution and has halted further execution.

This behavior can be disabled by setting the [--stop-agents-on-failure](https://nx.dev/ci/reference/nx-cloud-cli#stopagentsonfailure) flag to `false` on your `nx-cloud start-ci-run` command.

## Nx Agents-Related

### Failed to start Nx Agents workflow

Nx Cloud was unable to start the agents workflow with the configuration provided to `nx-cloud start-ci-run`. View the CI Pipeline Execution in the Nx Cloud UI for additional details.

### Unable to get workflow status from Nx Agents

Nx Cloud was unable to communicate with the Nx Agents assigned to a workflow for the current CI Pipeline Execution. View the CI Pipeline Execution in the Nx Cloud UI for additional details.

## Status Reconciliation-Related

### One or more workflows were cancelled

The current CI Pipeline Execution had a workflow cancelled due to either:

- a manual request in the Nx Cloud UI, or
- a push to the same branch that already had a running workflow.

### One or more workflows encountered a critical error

The current CI Pipeline Execution encountered a critical error in a child execution environment. View the CI Pipeline Execution in the Nx Cloud UI for additional details.

### One or more workflows failed

The current CI Pipeline Execution had at least one workflow with failed steps.

### One or more workflows encountered an error

The current CI Pipeline Execution had at least one workflow that executed tasks which failed. See also: [Nx Cloud agents were stopped due to an error](#nx-cloud-agents-were-stopped-due-to-an-error)

### One or more workflows timed out

The current CI Pipeline Execution had at least one workflow that exceeded the timeout duration. View the CI Pipeline Execution in the Nx Cloud UI for additional details.
7 changes: 6 additions & 1 deletion docs/shared/concepts/inferred-tasks.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Inferred Tasks
# Inferred Tasks (Project Crystal)

In Nx version 18, many Nx plugins will automatically infer tasks for your projects based on the configuration of different tools. Many tools have configuration files which determine what a tool does. Nx is able to cache the results of running the tool. Nx plugins use the same configuration files to infer how Nx should [run the task](/features/run-tasks). This includes [fine-tuned cache settings](/features/cache-task-results) and automatic [task dependencies](/concepts/task-pipeline-configuration).

For example, the `@nx/webpack` plugin infers tasks to run webpack through Nx based on your repository's webpack configuration. This configuration already defines the destination of your build files, so Nx reads that value and caches the correct output files.

{% youtube
src="https://youtu.be/wADNsVItnsM"
title="Project Crystal"
/%}

## How Does a Plugin Infer Tasks?

Every plugin has its own custom logic, but in order to infer tasks, they all go through the following steps.
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/packages/next/plugin-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ The library in `dist` is publishable to npm or a private registry.

### Static HTML Export

Next.js applications can be statically exported by changing th eoutput inside your Next.js configuration file.
Next.js applications can be statically exported by changing the output inside your Next.js configuration file.

```js {% fileName="apps/my-next-app/next.config.js" %}
const nextConfig = {
Expand Down
5 changes: 3 additions & 2 deletions docs/shared/packages/workspace/nx-compatibility-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ and the version of NodeJS that we tested it against.
| 13.x | 10.x, 12.x, 14.x | ~4.6.2 |
| 14.x | 12.x, 14.x, 16.x | ~4.7.2 |
| 15.x | 14.x, 16.x, 18.x | ~5.0.0 |
| 16.x (previous) | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (latest) | 18.x, 20.x | ~5.1.0 |
| 16.x | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (previous) | 18.x, 20.x | ~5.1.0 |
| 18.x (latest) | 18.x, 20.x | ~5.1.0 |
1 change: 1 addition & 0 deletions docs/shared/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The following environment variables are ones that you can set to change the beha

| Property | Type | Description |
| -------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| NX_ADD_PLUGINS | boolean | If set to false, Nx will not add plugins to infer tasks. This is true by default. Workspaces created before Nx 18 will have this disabled via a migration for backwards compatibility |
| NX_BASE | string | The default base branch to use when calculating the affected projects. Can be overridden on the command line with `--base`. |
| NX_CACHE_DIRECTORY | string | The cache for task outputs is stored in `node_modules/.cache/nx` by default. Set this variable to use a different directory. |
| NX_CACHE_PROJECT_GRAPH | boolean | If set to `false`, disables the project graph cache. Most useful when developing a plugin that modifies the project graph. |
Expand Down
2 changes: 2 additions & 0 deletions docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@
- [Authenticate via SAML](/ci/recipes/on-premise/auth-saml)
- [Authenticate via SAML on Managed Version](/ci/recipes/on-premise/auth-saml-managed)
- [Advanced Configuration](/ci/recipes/on-premise/advanced-config)
- [Troubleshooting](/ci/recipes/troubleshooting)
- [CI Execution Failed](/ci/recipes/troubleshooting/ci-execution-failed)
- [Other](/ci/recipes/other)
- [Record Non-Nx Commands](/ci/recipes/other/record-commands)
- [Prepare applications for deployment via CI](/ci/recipes/other/ci-deployment)
Expand Down
15 changes: 3 additions & 12 deletions e2e/angular-core/src/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,13 @@ describe('Angular Projects', () => {
);

// check e2e tests
let appPort = 4958;
updateJson(join(app1, 'project.json'), (config) => {
config.targets.serve.options ??= {};
config.targets.serve.options.port = appPort;
return config;
});
if (runE2ETests()) {
const e2eResults = runCLI(
`e2e ${app1}-e2e --config baseUrl=http://localhost:${appPort}`
);
const e2eResults = runCLI(`e2e ${app1}-e2e`);
expect(e2eResults).toContain('All specs passed!');
// TODO(leo): check why the port is not being killed and add assertion after fixing it
await killPort(appPort);
expect(await killPort(4200)).toBeTruthy();
}

appPort = 4207;
const appPort = 4207;
const process = await runCommandUntil(
`serve ${app1} -- --port=${appPort}`,
(output) => output.includes(`listening on localhost:${appPort}`)
Expand Down
32 changes: 12 additions & 20 deletions e2e/angular-module-federation/src/module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,17 @@ describe('Angular Module Federation', () => {
);

// Build host and remote
const buildOutput = await runCommandUntil(`build ${host}`, (output) =>
output.includes('Successfully ran target build')
);
await killProcessAndPorts(buildOutput.pid);
const remoteOutput = await runCommandUntil(`build ${remote}`, (output) =>
output.includes('Successfully ran target build')
);
await killProcessAndPorts(remoteOutput.pid);
const buildHostOutput = runCLI(`build ${host}`);
expect(buildHostOutput).toContain('Successfully ran target build');
const buildRemoteOutput = runCLI(`build ${remote}`);
expect(buildRemoteOutput).toContain('Successfully ran target build');

if (runE2ETests()) {
const hostE2eResults = await runCommandUntil(
const e2eProcess = await runCommandUntil(
`e2e ${host}-e2e --no-watch --verbose`,
(output) => output.includes('All specs passed!')
);
await killProcessAndPorts(hostE2eResults.pid, hostPort, hostPort + 1);
await killProcessAndPorts(e2eProcess.pid, hostPort, hostPort + 1);
}
}, 500_000);

Expand Down Expand Up @@ -467,21 +463,17 @@ describe('Angular Module Federation', () => {
);

// Build host and remote
const buildOutput = await runCommandUntil(`build ${host}`, (output) =>
output.includes('Successfully ran target build')
);
await killProcessAndPorts(buildOutput.pid);
const remoteOutput = await runCommandUntil(`build ${remote}`, (output) =>
output.includes('Successfully ran target build')
);
await killProcessAndPorts(remoteOutput.pid);
const buildHostOutput = runCLI(`build ${host}`);
expect(buildHostOutput).toContain('Successfully ran target build');
const buildRemoteOutput = runCLI(`build ${remote}`);
expect(buildRemoteOutput).toContain('Successfully ran target build');

if (runE2ETests()) {
const hostE2eResults = await runCommandUntil(
const e2eProcess = await runCommandUntil(
`e2e ${host}-e2e --no-watch --verbose`,
(output) => output.includes('All specs passed!')
);
await killProcessAndPorts(hostE2eResults.pid, hostPort, hostPort + 1);
await killProcessAndPorts(e2eProcess.pid, hostPort, hostPort + 1);
}
}, 500_000);
});
Loading

0 comments on commit cdd74b0

Please sign in to comment.