fix(gradle): fix workflow to run assemble check with batch (#31022)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> currently, the command in ci workflow is `nx affected -t build` ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> change to run `nx affected -t assemble, check` with batch turned on for gradle ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
6e12a821df
commit
70cec4b41a
@ -6,6 +6,9 @@ exports[`ci-workflow generator connected to nxCloud circleci pipeline should mat
|
|||||||
orbs:
|
orbs:
|
||||||
nx: nrwl/nx@1.6.2
|
nx: nrwl/nx@1.6.2
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
environment:
|
environment:
|
||||||
@ -21,13 +24,14 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
# Uncomment this line to enable task distribution
|
# Uncomment this line to enable task distribution
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: 'main'
|
main-branch-name: 'main'
|
||||||
|
|
||||||
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.
|
||||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t build
|
# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-e2e-tests.
|
||||||
|
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
@ -51,6 +55,9 @@ permissions:
|
|||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -64,7 +71,7 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
# Uncomment this line to enable task distribution
|
# Uncomment this line to enable task distribution
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- name: Set up JDK 21 for x64
|
- name: Set up JDK 21 for x64
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
@ -74,12 +81,13 @@ jobs:
|
|||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v4
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
- uses: nrwl/nx-set-shas@v4
|
- uses: nrwl/nx-set-shas@v4
|
||||||
|
|
||||||
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.
|
||||||
- run: ./nx affected -t build
|
# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-tests
|
||||||
|
- run: ./nx affected -t assemble check
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -89,6 +97,9 @@ exports[`ci-workflow generator not connected to nxCloud circleci pipeline should
|
|||||||
orbs:
|
orbs:
|
||||||
nx: nrwl/nx@1.6.2
|
nx: nrwl/nx@1.6.2
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
environment:
|
environment:
|
||||||
@ -104,13 +115,14 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
# Connect your workspace by running "nx connect" and uncomment this line to enable task distribution
|
# Connect your workspace by running "nx connect" and uncomment this line to enable task distribution
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: 'main'
|
main-branch-name: 'main'
|
||||||
|
|
||||||
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.
|
||||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t build
|
# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-e2e-tests.
|
||||||
|
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
@ -134,6 +146,9 @@ permissions:
|
|||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -147,7 +162,7 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
# Connect your workspace by running "nx connect" and uncomment this line to enable task distribution
|
# Connect your workspace by running "nx connect" and uncomment this line to enable task distribution
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- name: Set up JDK 21 for x64
|
- name: Set up JDK 21 for x64
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
@ -157,11 +172,12 @@ jobs:
|
|||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v4
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
- uses: nrwl/nx-set-shas@v4
|
- uses: nrwl/nx-set-shas@v4
|
||||||
|
|
||||||
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.
|
||||||
- run: ./nx affected -t build
|
# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-tests
|
||||||
|
- run: ./nx affected -t assemble check
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -3,6 +3,9 @@ version: 2.1
|
|||||||
orbs:
|
orbs:
|
||||||
nx: nrwl/nx@1.6.2
|
nx: nrwl/nx@1.6.2
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
environment:
|
environment:
|
||||||
@ -18,13 +21,13 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
||||||
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: '<%= mainBranch %>'
|
main-branch-name: '<%= mainBranch %>'
|
||||||
|
|
||||||
<% for (const command of commands) { %>
|
<% for (const command of commands) { %>
|
||||||
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comment) { %><%= command.comment %><% } else {%>- run: <%= command %><% } %><% } %>
|
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comments) { %><% for (const comment of command.comments) { %>
|
||||||
|
<%= comment %><% } %><% } else {%>- run: <%= command %><% } %><% } %>
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|||||||
@ -10,6 +10,9 @@ permissions:
|
|||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
NX_BATCH_MODE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -23,7 +26,7 @@ jobs:
|
|||||||
# Run this command as early as possible, before dependencies are installed
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
||||||
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="build"
|
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="check"
|
||||||
|
|
||||||
- name: Set up JDK 21 for x64
|
- name: Set up JDK 21 for x64
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
@ -33,9 +36,9 @@ jobs:
|
|||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v4
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
- uses: nrwl/nx-set-shas@v4
|
- uses: nrwl/nx-set-shas@v4
|
||||||
|
|
||||||
<% for (const command of commands) { %>
|
<% for (const command of commands) { %>
|
||||||
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comment) { %><%= command.comment %><% } else {%>- run: <%= command %><% } %><% } %>
|
<% if (command.command) { %>- run: <%= command.command %><% } else if (command.comments) { %><% for (const comment of command.comments) { %>
|
||||||
|
<%= comment %><% } %><% } else {%>- run: <%= command %><% } %><% } %>
|
||||||
|
|||||||
@ -16,25 +16,31 @@ function getCiCommands(ci: Schema['ci']): Command[] {
|
|||||||
case 'circleci': {
|
case 'circleci': {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
comment: `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
|
comments: [
|
||||||
|
`# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
|
||||||
|
`# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-e2e-tests.`,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: `./nx affected --base=$NX_BASE --head=$NX_HEAD -t build`,
|
command: `./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
comment: `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
|
comments: [
|
||||||
|
`# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
|
||||||
|
`# Change from check to check-ci if you turn on the atomizer. Learn more: https://nx.dev/nx-api/gradle#splitting-tests`,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{ command: `./nx affected -t build` },
|
{ command: `./nx affected -t assemble check` },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Command = { command: string } | { comment: string } | string;
|
export type Command = { command: string } | { comments: string[] } | string;
|
||||||
|
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user