Skip to content

Commit 1cfec5d

Browse files
saikumarrsAI AssistantMoumitaM
authored
chore: speed up checks (#2351)
* chore: speed up checks * chore: add missing setup * chore: temporary change to test affected projects * chore: fix the setup step * chore: fix the packages list * chore: upgrade size-limit action to the latest version * chore: reorganise steps * chore: refactor and optimize checks * chore: revert temporary change * chore: revert temporary change * chore: fix steps ordering * chore: do not run when no projects are impacted --------- Co-authored-by: AI Assistant <ai@rudderstack.com> Co-authored-by: Moumita <36885121+MoumitaM@users.noreply.github.com>
1 parent c88cf7a commit 1cfec5d

1 file changed

Lines changed: 73 additions & 11 deletions

File tree

.github/workflows/security-code-quality-and-bundle-size-checks.yml

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,41 @@ env:
1414
BASE_REF: ${{ github.event.pull_request.base.sha || 'HEAD' }}
1515

1616
jobs:
17+
get-affected-projects:
18+
name: Get affected projects
19+
runs-on: [self-hosted, Linux, X64]
20+
outputs:
21+
affected_projects: ${{ steps.check_affected.outputs.affected_projects }}
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.pull_request.head.sha }}
27+
fetch-depth: 0
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version-file: '.nvmrc'
33+
cache: 'npm'
34+
35+
- name: Setup workspace
36+
env:
37+
HUSKY: 0
38+
run: |
39+
npm run setup:deps
40+
41+
- name: Check for affected projects
42+
id: check_affected
43+
run: |
44+
AFFECTED_PROJECTS=$(npx nx show projects --affected --base=$BASE_REF | paste -sd ',' - | sed 's/,$//')
45+
echo "Affected projects: $AFFECTED_PROJECTS"
46+
echo "affected_projects=$AFFECTED_PROJECTS" >> $GITHUB_OUTPUT
47+
1748
bundle-size-checks:
1849
name: Bundle size checks
1950
runs-on: [self-hosted, Linux, X64]
51+
needs: get-affected-projects
2052
steps:
2153
- name: Checkout
2254
uses: actions/checkout@v4
@@ -30,21 +62,28 @@ jobs:
3062
node-version-file: '.nvmrc'
3163
cache: 'npm'
3264

65+
- name: Setup workspace
66+
env:
67+
HUSKY: 0
68+
run: |
69+
npm run setup:deps
70+
3371
- name: Execute bundle size checks
34-
uses: rudderlabs/github-action-check-size-limit@v2.13.0
72+
uses: rudderlabs/github-action-check-size-limit@v3.0.0
73+
if: ${{ needs.get-affected-projects.outputs.affected_projects != '' }}
3574
env:
3675
HUSKY: 0
3776
with:
3877
github_token: ${{ secrets.GITHUB_TOKEN }}
39-
install_script: setup:ci
40-
build_script: check:size:build
41-
script: npm run check:size:json:ci --silent -- --output-style=static --silent=true --exclude=@rudderstack/analytics-js-sanity-suite
78+
install_script: npm run setup:ci
79+
build_script: npm run check:size:build -- --projects=${{ needs.get-affected-projects.outputs.affected_projects }}
80+
script: npm run check:size:json:ci --silent -- --output-style=static --silent=true --projects=${{ needs.get-affected-projects.outputs.affected_projects }}
4281
is_monorepo: true
4382

44-
security-code-quality-checks:
83+
code-quality-checks:
4584
name: Security and code quality checks
4685
runs-on: [self-hosted, Linux, X64]
47-
86+
needs: get-affected-projects
4887
steps:
4988
- name: Checkout
5089
uses: actions/checkout@v4
@@ -64,11 +103,6 @@ jobs:
64103
run: |
65104
npm run setup:ci
66105
67-
- name: Execute code quality checks
68-
run: |
69-
npm run check:circular
70-
npm run check:duplicates
71-
72106
- name: Build the project
73107
run: |
74108
npm run build:ci
@@ -78,6 +112,34 @@ jobs:
78112
run: |
79113
npm run check:pub:ci
80114
115+
- name: Execute code quality checks
116+
if: ${{ needs.get-affected-projects.outputs.affected_projects != '' }}
117+
run: |
118+
npm run check:circular -- --projects=${{ needs.get-affected-projects.outputs.affected_projects }}
119+
npm run check:duplicates -- --projects=${{ needs.get-affected-projects.outputs.affected_projects }}
120+
121+
security-checks:
122+
name: Security checks
123+
runs-on: [self-hosted, Linux, X64]
124+
steps:
125+
- name: Checkout
126+
uses: actions/checkout@v4
127+
with:
128+
fetch-depth: 0
129+
ref: ${{ github.event.pull_request.head.sha }}
130+
131+
- name: Setup Node
132+
uses: actions/setup-node@v4
133+
with:
134+
node-version-file: '.nvmrc'
135+
cache: 'npm'
136+
137+
- name: Setup workspace
138+
env:
139+
HUSKY: 0
140+
run: |
141+
npm run setup:deps
142+
81143
- name: Execute security checks
82144
run: |
83145
npm run check:security

0 commit comments

Comments
 (0)