Skip to content

Commit 57db076

Browse files
committed
lower the number of parallel dts bundle generation at prod
1 parent 72d301d commit 57db076

File tree

2 files changed

+21
-63
lines changed

2 files changed

+21
-63
lines changed
Lines changed: 19 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,26 @@
11
name: Trigger CircleCI workflow
22

3-
on:
4-
# Use pull_request_target, as we don't need to check out the actual code of the fork in this script.
5-
# And this is the only way to trigger the Circle CI API on forks as well.
6-
pull_request_target:
7-
types: [opened, synchronize, labeled, reopened]
8-
push:
9-
branches:
10-
- next
11-
- main
12-
13-
concurrency:
14-
group: ${{ github.workflow }}-${{ github.ref }}
15-
cancel-in-progress: true
16-
3+
on: push
174
jobs:
18-
get-branch:
19-
if: github.repository_owner == 'storybookjs'
5+
test:
206
runs-on: ubuntu-latest
7+
defaults:
8+
run:
9+
working-directory: ./scripts
2110
steps:
22-
- id: get-branch
23-
env:
24-
# Stored as environment variable to prevent script injection
25-
REF_NAME: ${{ github.ref_name }}
26-
PR_REF_NAME: ${{ github.event.pull_request.head.ref }}
27-
run: |
28-
if [ "${{ github.event.pull_request.head.repo.fork }}" = "true" ]; then
29-
export BRANCH=pull/${{ github.event.pull_request.number }}/head
30-
elif [ "${{ github.event_name }}" = "push" ]; then
31-
export BRANCH="$REF_NAME"
32-
else
33-
export BRANCH="$PR_REF_NAME"
34-
fi
35-
echo "$BRANCH"
36-
echo "branch=$BRANCH" >> $GITHUB_ENV
37-
outputs:
38-
branch: ${{ env.branch }}
11+
- name: Checkout ${{ github.ref_name }}
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 100
3915

40-
get-parameters:
41-
if: github.repository_owner == 'storybookjs'
42-
runs-on: ubuntu-latest
43-
steps:
44-
- if: github.event_name == 'pull_request_target' && (contains(github.event.pull_request.labels.*.name, 'ci:normal'))
45-
run: echo "workflow=normal" >> $GITHUB_ENV
46-
- if: github.event_name == 'pull_request_target' && (contains(github.event.pull_request.labels.*.name, 'ci:docs'))
47-
run: echo "workflow=docs" >> $GITHUB_ENV
48-
- if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci:merged')
49-
run: echo "workflow=merged" >> $GITHUB_ENV
50-
- if: github.event_name == 'pull_request_target' && (contains(github.event.pull_request.labels.*.name, 'ci:daily'))
51-
run: echo "workflow=daily" >> $GITHUB_ENV
52-
outputs:
53-
workflow: ${{ env.workflow }}
54-
ghBaseBranch: ${{ github.event.pull_request.base.ref }}
55-
ghPrNumber: ${{ github.event.pull_request.number }}
16+
- name: Setup Node.js and Install Dependencies
17+
uses: ./.github/actions/setup-node-and-install
5618

57-
trigger-circle-ci-workflow:
58-
runs-on: ubuntu-latest
59-
needs: [get-branch, get-parameters]
60-
if: github.repository_owner == 'storybookjs' && needs.get-parameters.outputs.workflow != ''
61-
steps:
62-
- name: Trigger Normal tests
63-
uses: fjogeleit/http-request-action@v1
64-
with:
65-
url: 'https://circleci.com/api/v2/project/gh/storybookjs/storybook/pipeline'
66-
method: 'POST'
67-
customHeaders: '{"Content-Type": "application/json", "Circle-Token": "${{ secrets.CIRCLE_CI_TOKEN }}"}'
68-
data: '{ "branch": "${{needs.get-branch.outputs.branch}}", "parameters": ${{toJson(needs.get-parameters.outputs)}} }'
19+
- name: run compile
20+
run: yarn task --task=compile --start-from=compile --no-link
21+
- name: run compile
22+
run: yarn task --task=compile --start-from=compile --no-link
23+
- name: run compile
24+
run: yarn task --task=compile --start-from=compile --no-link
25+
- name: run compile
26+
run: yarn task --task=compile --start-from=compile --no-link

scripts/build/utils/generate-types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function generateTypesFiles(cwd: string, data: BuildEntries) {
2121
// ...this way we do not bog down the main process/esbuild and can run them in parallel
2222
// we limit the number of concurrent processes to 3, because we don't want to overload the host machine
2323
// by trial and error, 3 seems to be the sweet spot between perf and consistency
24-
const limited = limit(10);
24+
const limited = limit(5);
2525
let processes: ReturnType<typeof spawn>[] = [];
2626

2727
await Promise.all(
@@ -83,7 +83,7 @@ export async function generateTypesFiles(cwd: string, data: BuildEntries) {
8383
processes.forEach((p) => p.kill());
8484
processes = [];
8585
process.exit(dtsProcess.exitCode || 1);
86-
} else if(!process.env.CI) {
86+
} else if (!process.env.CI) {
8787
console.log('✅ Generated types for', picocolors.cyan(join(DIR_REL, entryPoint)));
8888
}
8989
});

0 commit comments

Comments
 (0)