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:
|
||||
nx: nrwl/nx@1.6.2
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
environment:
|
||||
@ -21,13 +24,14 @@ jobs:
|
||||
# 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
|
||||
# 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:
|
||||
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
|
||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t build
|
||||
# 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.
|
||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
@ -51,6 +55,9 @@ permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
@ -64,7 +71,7 @@ jobs:
|
||||
# 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
|
||||
# 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
|
||||
uses: actions/setup-java@v4
|
||||
@ -74,12 +81,13 @@ jobs:
|
||||
architecture: x64
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v4
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- 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
|
||||
- run: ./nx affected -t build
|
||||
# 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
|
||||
- run: ./nx affected -t assemble check
|
||||
"
|
||||
`;
|
||||
|
||||
@ -89,6 +97,9 @@ exports[`ci-workflow generator not connected to nxCloud circleci pipeline should
|
||||
orbs:
|
||||
nx: nrwl/nx@1.6.2
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
environment:
|
||||
@ -104,13 +115,14 @@ jobs:
|
||||
# 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
|
||||
# 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:
|
||||
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
|
||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t build
|
||||
# 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.
|
||||
- run: ./nx affected --base=$NX_BASE --head=$NX_HEAD -t assemble check
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
@ -134,6 +146,9 @@ permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
@ -147,7 +162,7 @@ jobs:
|
||||
# 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
|
||||
# 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
|
||||
uses: actions/setup-java@v4
|
||||
@ -157,11 +172,12 @@ jobs:
|
||||
architecture: x64
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v4
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- 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
|
||||
- run: ./nx affected -t build
|
||||
# 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
|
||||
- run: ./nx affected -t assemble check
|
||||
"
|
||||
`;
|
||||
|
||||
@ -3,6 +3,9 @@ version: 2.1
|
||||
orbs:
|
||||
nx: nrwl/nx@1.6.2
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
environment:
|
||||
@ -18,13 +21,13 @@ jobs:
|
||||
# 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
|
||||
<% 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:
|
||||
main-branch-name: '<%= mainBranch %>'
|
||||
|
||||
<% 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:
|
||||
version: 2
|
||||
|
||||
@ -10,6 +10,9 @@ permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NX_BATCH_MODE: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
@ -23,7 +26,7 @@ jobs:
|
||||
# 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
|
||||
<% 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
|
||||
uses: actions/setup-java@v4
|
||||
@ -33,9 +36,9 @@ jobs:
|
||||
architecture: x64
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v4
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- uses: nrwl/nx-set-shas@v4
|
||||
|
||||
<% 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': {
|
||||
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: {
|
||||
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 {
|
||||
name: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user