ci: Setup ci-test runner count based on tags defined (#29791)
## Description - Added logic to handle the runner count based on the tags #### Type of change - Workflow files ## Testing - Workflow run <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a `tag-check` job to validate the presence of tags in workflow commands. - Workflows now comment on PRs with documentation links for tags when tags are missing. - **Enhancements** - Enhanced CI workflows to conditionally run jobs based on tag presence. - Added matrix inputs to improve job configuration flexibility. - **Documentation** - Added comments to PRs with links to workflow runs when tags are specified. - **Refactor** - Centralized tag and matrix setup across multiple workflows for consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
8ce2521919
commit
a24ec21a74
70
.github/workflows/ci-test-custom-script.yml
vendored
70
.github/workflows/ci-test-custom-script.yml
vendored
|
|
@ -13,6 +13,12 @@ on:
|
||||||
description: "These are the optional tags a developer can specify in order to run a subset of all the tests"
|
description: "These are the optional tags a developer can specify in order to run a subset of all the tests"
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
default: ""
|
||||||
|
matrix:
|
||||||
|
description: "Matrix jobs"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci-test:
|
ci-test:
|
||||||
|
|
@ -29,69 +35,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
job: ${{ fromJson(inputs.matrix) }}
|
||||||
[
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8,
|
|
||||||
9,
|
|
||||||
10,
|
|
||||||
11,
|
|
||||||
12,
|
|
||||||
13,
|
|
||||||
14,
|
|
||||||
15,
|
|
||||||
16,
|
|
||||||
17,
|
|
||||||
18,
|
|
||||||
19,
|
|
||||||
20,
|
|
||||||
21,
|
|
||||||
22,
|
|
||||||
23,
|
|
||||||
24,
|
|
||||||
25,
|
|
||||||
26,
|
|
||||||
27,
|
|
||||||
28,
|
|
||||||
29,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
32,
|
|
||||||
33,
|
|
||||||
34,
|
|
||||||
35,
|
|
||||||
36,
|
|
||||||
37,
|
|
||||||
38,
|
|
||||||
39,
|
|
||||||
40,
|
|
||||||
41,
|
|
||||||
42,
|
|
||||||
43,
|
|
||||||
44,
|
|
||||||
45,
|
|
||||||
46,
|
|
||||||
47,
|
|
||||||
48,
|
|
||||||
49,
|
|
||||||
50,
|
|
||||||
51,
|
|
||||||
52,
|
|
||||||
53,
|
|
||||||
54,
|
|
||||||
55,
|
|
||||||
56,
|
|
||||||
57,
|
|
||||||
58,
|
|
||||||
59,
|
|
||||||
]
|
|
||||||
|
|
||||||
# Service containers to run with this job. Required for running tests
|
# Service containers to run with this job. Required for running tests
|
||||||
services:
|
services:
|
||||||
|
|
|
||||||
56
.github/workflows/integration-tests-command.yml
vendored
56
.github/workflows/integration-tests-command.yml
vendored
|
|
@ -6,20 +6,58 @@ on:
|
||||||
types: [ok-to-test-command]
|
types: [ok-to-test-command]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
tag-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tags: ${{ steps.checkAll.outputs.tags }}
|
||||||
|
matrix: ${{ steps.checkAll.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check if tags arg is present in the command
|
||||||
|
id: checkTags
|
||||||
|
run: |
|
||||||
|
checkArg=`echo '${{toJSON(github.event.client_payload.slash_command.args.named)}}' | jq 'has("tags")'`
|
||||||
|
echo "tags=$checkArg" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Add a comment on the PR with tags documentation link
|
||||||
|
if: steps.checkTags.outputs.tags != 'true'
|
||||||
|
uses: peter-evans/create-or-update-comment@v3
|
||||||
|
with:
|
||||||
|
issue-number: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
body: |
|
||||||
|
The provided command lacks any tags. Please execute '/ok-to-test' again, specifying the tags you want to include or use `@tag.All` to run all specs.
|
||||||
|
Explore the tags documentation [here](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918)
|
||||||
|
|
||||||
|
- name: Stop the workflow run if tags are not present
|
||||||
|
if: steps.checkTags.outputs.tags != 'true'
|
||||||
|
run: exit 1
|
||||||
|
|
||||||
|
- name: Check if @tag.All is present in tags
|
||||||
|
if: steps.checkTags.outputs.tags == 'true'
|
||||||
|
id: checkAll
|
||||||
|
run: |
|
||||||
|
tags="${{ github.event.client_payload.slash_command.args.named.tags }}"
|
||||||
|
if [[ $tags == *"@tag.All"* ]]; then
|
||||||
|
echo "tags=" >> $GITHUB_OUTPUT
|
||||||
|
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "tags=$tags" >> $GITHUB_OUTPUT
|
||||||
|
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
# This step creates a comment on the PR with a link to this workflow run.
|
# This step creates a comment on the PR with a link to this workflow run.
|
||||||
- name: Add a comment on the PR with link to workflow run
|
- name: Add a comment on the PR with link to workflow run
|
||||||
|
if: steps.checkTags.outputs.tags == 'true'
|
||||||
uses: peter-evans/create-or-update-comment@v3
|
uses: peter-evans/create-or-update-comment@v3
|
||||||
with:
|
with:
|
||||||
issue-number: ${{ github.event.client_payload.pull_request.number }}
|
issue-number: ${{ github.event.client_payload.pull_request.number }}
|
||||||
body: |
|
body: |
|
||||||
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
||||||
Workflow: `${{ github.workflow }}`.
|
Workflow: `${{ github.workflow }}`.
|
||||||
Tags: `${{ github.event.client_payload.slash_command.args.named.tags }}`.
|
Tags: `${{ steps.checkAll.outputs.tags }}`.
|
||||||
|
|
||||||
server-build:
|
server-build:
|
||||||
|
needs: [tag-check]
|
||||||
|
if: success()
|
||||||
name: server-build
|
name: server-build
|
||||||
uses: ./.github/workflows/server-build.yml
|
uses: ./.github/workflows/server-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -28,6 +66,8 @@ jobs:
|
||||||
skip-tests: true
|
skip-tests: true
|
||||||
|
|
||||||
client-build:
|
client-build:
|
||||||
|
needs: [tag-check]
|
||||||
|
if: success()
|
||||||
name: client-build
|
name: client-build
|
||||||
uses: ./.github/workflows/client-build.yml
|
uses: ./.github/workflows/client-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -36,6 +76,8 @@ jobs:
|
||||||
check-test-files: "true"
|
check-test-files: "true"
|
||||||
|
|
||||||
rts-build:
|
rts-build:
|
||||||
|
needs: [tag-check]
|
||||||
|
if: success()
|
||||||
name: rts-build
|
name: rts-build
|
||||||
uses: ./.github/workflows/rts-build.yml
|
uses: ./.github/workflows/rts-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -43,6 +85,8 @@ jobs:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
|
||||||
test-appsmithctl:
|
test-appsmithctl:
|
||||||
|
needs: [tag-check]
|
||||||
|
if: success()
|
||||||
name: appsmithctl
|
name: appsmithctl
|
||||||
uses: ./.github/workflows/appsmithctl.yml
|
uses: ./.github/workflows/appsmithctl.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -50,7 +94,7 @@ jobs:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
|
||||||
build-docker-image:
|
build-docker-image:
|
||||||
needs: [client-build, server-build, rts-build]
|
needs: [tag-check, client-build, server-build, rts-build]
|
||||||
# Only run if the build step is successful
|
# Only run if the build step is successful
|
||||||
if: success()
|
if: success()
|
||||||
name: build-docker-image
|
name: build-docker-image
|
||||||
|
|
@ -60,7 +104,7 @@ jobs:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
|
||||||
ci-test:
|
ci-test:
|
||||||
needs: [build-docker-image]
|
needs: [tag-check, build-docker-image]
|
||||||
# Only run if the build step is successful
|
# Only run if the build step is successful
|
||||||
if: success()
|
if: success()
|
||||||
name: ci-test
|
name: ci-test
|
||||||
|
|
@ -68,7 +112,9 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
tags: ${{ github.event.client_payload.slash_command.args.named.tags }}
|
tags: ${{ needs.tag-check.outputs.tags }}
|
||||||
|
matrix: ${{ needs.tag-check.outputs.matrix }}
|
||||||
|
|
||||||
|
|
||||||
ci-test-result:
|
ci-test-result:
|
||||||
needs: [ci-test]
|
needs: [ci-test]
|
||||||
|
|
|
||||||
38
.github/workflows/test-build-docker-image.yml
vendored
38
.github/workflows/test-build-docker-image.yml
vendored
|
|
@ -6,6 +6,12 @@ on:
|
||||||
- cron: "30 00 * * 1-5"
|
- cron: "30 00 * * 1-5"
|
||||||
# This line enables manual triggering of this workflow.
|
# This line enables manual triggering of this workflow.
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tags:
|
||||||
|
description: "Tags"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
|
||||||
# trigger for pushes to master
|
# trigger for pushes to master
|
||||||
push:
|
push:
|
||||||
|
|
@ -17,7 +23,31 @@ on:
|
||||||
- "!app/client/cypress/manual_TestSuite/**"
|
- "!app/client/cypress/manual_TestSuite/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tags: ${{ steps.setup.outputs.tags }}
|
||||||
|
matrix: ${{ steps.setup.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- name: Set tags and matrix runner
|
||||||
|
id: setup
|
||||||
|
run: |
|
||||||
|
if [ "${{github.event_name}}" == "workflow_dispatch" ]; then
|
||||||
|
if [[ "${{inputs.tags}}" != "" && "${{inputs.tags}}" != *"@tag.All"* ]]; then
|
||||||
|
echo "tags=${{inputs.tags}}" >> $GITHUB_OUTPUT
|
||||||
|
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "tags=" >> $GITHUB_OUTPUT
|
||||||
|
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "tags=" >> $GITHUB_OUTPUT
|
||||||
|
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
server-build:
|
server-build:
|
||||||
|
needs: [setup]
|
||||||
|
if: success()
|
||||||
name: server-build
|
name: server-build
|
||||||
uses: ./.github/workflows/server-build.yml
|
uses: ./.github/workflows/server-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -26,6 +56,8 @@ jobs:
|
||||||
skip-tests: true
|
skip-tests: true
|
||||||
|
|
||||||
client-build:
|
client-build:
|
||||||
|
needs: [setup]
|
||||||
|
if: success()
|
||||||
name: client-build
|
name: client-build
|
||||||
uses: ./.github/workflows/client-build.yml
|
uses: ./.github/workflows/client-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -33,6 +65,8 @@ jobs:
|
||||||
pr: 0
|
pr: 0
|
||||||
|
|
||||||
rts-build:
|
rts-build:
|
||||||
|
needs: [setup]
|
||||||
|
if: success()
|
||||||
name: rts-build
|
name: rts-build
|
||||||
uses: ./.github/workflows/rts-build.yml
|
uses: ./.github/workflows/rts-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
@ -50,7 +84,7 @@ jobs:
|
||||||
pr: 0
|
pr: 0
|
||||||
|
|
||||||
ci-test:
|
ci-test:
|
||||||
needs: [build-docker-image]
|
needs: [setup, build-docker-image]
|
||||||
# Only run if the build step is successful
|
# Only run if the build step is successful
|
||||||
if: success()
|
if: success()
|
||||||
name: ci-test
|
name: ci-test
|
||||||
|
|
@ -58,6 +92,8 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
pr: 0
|
pr: 0
|
||||||
|
tags: ${{needs.setup.outputs.tags}}
|
||||||
|
matrix: ${{needs.setup.outputs.matrix}}
|
||||||
|
|
||||||
server-unit-tests:
|
server-unit-tests:
|
||||||
name: server-unit-tests
|
name: server-unit-tests
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user