Skip to content

Commit 0f94a1d

Browse files
chore: switch to turbo for build (botpress#13107)
1 parent 26ab99d commit 0f94a1d

24 files changed

+355
-170
lines changed

.github/actions/setup-tilt/action.yml

-32
This file was deleted.

.github/actions/setup/action.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Setup
2+
description: install dependencies and build
3+
4+
inputs:
5+
filter:
6+
type: string
7+
description: 'packages to build'
8+
required: false
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- uses: pnpm/[email protected]
14+
with:
15+
version: 8.6.0
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: '18.x'
19+
check-latest: true
20+
- name: Install dependencies
21+
shell: bash
22+
run: pnpm i --frozen-lockfile
23+
- name: Build
24+
shell: bash
25+
run: |
26+
filter="${{ inputs.filter }}"
27+
if [ -z "$filter" ]; then
28+
pnpm build
29+
else
30+
pnpm build --filter $filter
31+
fi

.github/workflows/bugbuster.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ jobs:
2121
timeout-minutes: 15
2222
steps:
2323
- uses: actions/checkout@v2
24-
- name: Setup Tilt
25-
uses: ./.github/actions/setup-tilt
24+
- name: Setup
25+
uses: ./.github/actions/setup
2626
with:
27-
tilt_cmd: 'build-packages'
28-
- name: Install NPM Dependencies
29-
run: pnpm install
27+
filter: '@botpress/*'
3028
- name: Login to Botpress
3129
run: pnpm bp login -y --token ${{ secrets.PRODUCTION_TOKEN_CLOUD_OPS_ACCOUNT }} --workspace-id ${{ secrets.PRODUCTION_CLOUD_OPS_WORKSPACE_ID }}
3230
- name: Install Botpress Dependencies

.github/workflows/check-integration-versions.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
timeout-minutes: 15
1313
steps:
1414
- uses: actions/checkout@v2
15-
- name: Setup Tilt
16-
uses: ./.github/actions/setup-tilt
15+
- name: Setup
16+
uses: ./.github/actions/setup
1717
with:
18-
tilt_cmd: 'build-packages'
18+
filter: '@botpress/*'
1919
- name: Login to Botpress
2020
run: pnpm bp login -y --token ${{ secrets.PRODUCTION_TOKEN_CLOUD_OPS_ACCOUNT }} --workspace-id ${{ secrets.PRODUCTION_CLOUD_OPS_WORKSPACE_ID }}
2121
- name: Get changed files

.github/workflows/deploy-integrations-production.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v2
21-
- name: Setup Tilt
22-
uses: ./.github/actions/setup-tilt
21+
- name: Setup
22+
uses: ./.github/actions/setup
2323
- name: Deploy Integrations
2424
uses: ./.github/actions/deploy-integrations
2525
with:

.github/workflows/deploy-integrations-staging.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v2
25-
- name: Setup Tilt
26-
uses: ./.github/actions/setup-tilt
25+
- name: Setup
26+
uses: ./.github/actions/setup
2727
- name: Deploy Integrations
2828
uses: ./.github/actions/deploy-integrations
2929
with:

.github/workflows/publish-packages.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
NODE_OPTIONS: '--max_old_space_size=8192'
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Setup Tilt
18-
uses: ./.github/actions/setup-tilt
17+
- name: Setup
18+
uses: ./.github/actions/setup
1919
with:
20-
tilt_cmd: 'build-packages'
20+
filter: '@botpress/*'
2121
- name: Publish Client
2222
uses: botpress/gh-actions/publish-if-not-exists@master
2323
with:

.github/workflows/run-checks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
NODE_OPTIONS: '--max_old_space_size=8192'
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Setup Tilt
18-
uses: ./.github/actions/setup-tilt
17+
- name: Setup
18+
uses: ./.github/actions/setup
1919
- run: pnpm run format:check
2020
- run: pnpm run lint:check
2121
- run: pnpm run type:check

.github/workflows/run-cli-tests.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
NODE_OPTIONS: '--max_old_space_size=8192'
1717
steps:
1818
- uses: actions/checkout@v2
19-
- name: Setup Tilt
20-
uses: ./.github/actions/setup-tilt
19+
- name: Setup
20+
uses: ./.github/actions/setup
21+
with:
22+
filter: '@botpress/cli'
2123
- run: |
2224
pnpm run -F cli e2e:test -v \
2325
--api-url https://api.botpress.dev \

.github/workflows/run-client-tests.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ jobs:
1414
NODE_OPTIONS: '--max_old_space_size=8192'
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Setup Tilt
18-
uses: ./.github/actions/setup-tilt
17+
- name: Setup
18+
uses: ./.github/actions/setup
19+
with:
20+
filter: '@botpress/client'
1921
- run: |
2022
pnpm -F client exec puppeteer browsers install chrome
2123
pnpm -F client run e2e:test

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ __snapshots__
99
.env
1010
.botpress
1111
.botpresshome
12-
.botpresshome.*
12+
.botpresshome.*
13+
.turbo

Tiltfile

+1-106
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,10 @@
1-
# constants
2-
3-
GENERATE_CLIENT_RESSOURCES = ['pnpm-install', 'generate-client']
4-
BUILD_PACKAGES_RESSOURCES = GENERATE_CLIENT_RESSOURCES + ['build-client', 'build-sdk', 'build-cli']
5-
BUILD_ALL_RESSOURCES = BUILD_PACKAGES_RESSOURCES + ['build-integrations', 'add-integrations', 'build-bots']
6-
7-
COMMAND_RESSOURCES = {
8-
'generate-client': GENERATE_CLIENT_RESSOURCES,
9-
'build-packages': BUILD_PACKAGES_RESSOURCES,
10-
'build-all': BUILD_ALL_RESSOURCES
11-
}
12-
AVAILABLE_COMMANDS = [k for k in COMMAND_RESSOURCES.keys()]
13-
14-
# config
15-
16-
config.define_string('cmd')
17-
cfg = config.parse()
18-
command = cfg.get('cmd', 'build-all')
19-
20-
if command not in AVAILABLE_COMMANDS:
21-
fail('command must be one of %s' % AVAILABLE_COMMANDS)
22-
23-
enabled_services = COMMAND_RESSOURCES[command]
24-
config.clear_enabled_resources()
25-
config.set_enabled_resources(enabled_services)
26-
27-
# resources
28-
29-
## pnpm install
30-
311
local_resource(
322
name='pnpm-install',
333
cmd='pnpm install',
34-
labels=['scripts'],
35-
)
36-
37-
## generate client
38-
39-
local_resource(
40-
name='generate-client',
41-
allow_parallel=True,
42-
dir='packages/client',
43-
cmd='pnpm generate',
44-
labels=['client'],
45-
)
46-
47-
## build client
48-
49-
local_resource(
50-
name='build-client',
51-
allow_parallel=True,
52-
dir='packages/client',
53-
cmd='pnpm build',
54-
labels=['client'],
55-
resource_deps=['generate-client'],
56-
deps=["./packages/client"]
574
)
585

59-
## build sdk
60-
616
local_resource(
62-
name='build-sdk',
63-
allow_parallel=True,
64-
dir='packages/sdk',
7+
name='pnpm-build',
658
cmd='pnpm build',
66-
labels=['sdk'],
67-
resource_deps=['build-client'],
68-
deps=["./packages/sdk"]
69-
)
70-
71-
## build cli
72-
73-
local_resource(
74-
name='build-cli',
75-
allow_parallel=True,
76-
dir='packages/cli',
77-
cmd='pnpm build',
78-
labels=['cli'],
79-
resource_deps=['build-sdk'],
80-
deps=["./packages/cli"]
81-
)
82-
83-
## build integrations
84-
85-
local_resource(
86-
name='build-integrations',
87-
allow_parallel=True,
88-
cmd='pnpm -r --stream -F @botpresshub/* exec bp build --source-map',
89-
labels=['integrations'],
90-
resource_deps=['build-cli'],
91-
deps=["./integrations"]
92-
)
93-
94-
## build bots
95-
96-
bot_filter = ".\\bots\\*" if os.name == 'nt' else './bots/*'
97-
98-
local_resource(
99-
name='add-integrations',
100-
allow_parallel=True,
101-
cmd='pnpm -r --stream -F "%s" run integrations' % bot_filter,
102-
labels=['bots'],
103-
resource_deps=['build-integrations'],
104-
deps=["./bots"]
105-
)
106-
107-
local_resource(
108-
name='build-bots',
109-
allow_parallel=True,
110-
cmd='pnpm -r --stream -F "%s" exec bp build --source-map' % bot_filter,
111-
labels=['bots'],
112-
resource_deps=['add-integrations'],
113-
deps=["./bots"]
1149
)
11510

bots/bugbuster/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "bugbuster",
2+
"name": "@bp-bots/bugbuster",
33
"scripts": {
44
"type:check": "tsc --noEmit",
55
"integrations": "es-node ./integrations.ts"

bots/hello-world/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "hello-world",
2+
"name": "@bp-bots/hello-world",
33
"version": "1.0.0",
44
"description": "Hello-world bot",
55
"private": true,

bots/hit-looper/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "hit-looper",
2+
"name": "@bp-bots/hit-looper",
33
"scripts": {
44
"type:check": "tsc --noEmit",
55
"integrations": "es-node ./integrations.ts"

bots/sheetzy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sheetzy",
2+
"name": "@bp-bots/sheetzy",
33
"scripts": {
44
"type:check": "tsc --noEmit",
55
"integrations": "es-node ./integrations.ts"

integrations/dalle/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"type:check": "tsc --noEmit",
55
"version": "bp --version",
66
"login": "bp login",
7+
"build": "bp build",
78
"dev": "bp dev",
89
"gen": "bp gen",
910
"deploy": "bp deploy"

integrations/gsheets/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@botpresshub/gsheets",
33
"scripts": {
4-
"type:check": "tsc --noEmit"
4+
"type:check": "tsc --noEmit",
5+
"build": "pnpm bp build"
56
},
67
"keywords": [],
78
"private": true,

integrations/notion/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@botpresshub/notion",
33
"scripts": {
4-
"type:check": "tsc --noEmit"
4+
"type:check": "tsc --noEmit",
5+
"build": "pnpm bp build"
56
},
67
"keywords": [],
78
"private": true,

integrations/zendesk/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@botpresshub/zendesk",
33
"scripts": {
4-
"type:check": "tsc --noEmit"
4+
"type:check": "tsc --noEmit",
5+
"build": "pnpm bp build"
56
},
67
"keywords": [],
78
"private": true,

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "botpress",
33
"private": true,
44
"scripts": {
5+
"build": "turbo build",
56
"bump": "depsynky bump && pnpm -w install",
67
"type:check": "pnpm -r --stream type:check",
78
"format:check": "prettier --check .",
@@ -30,6 +31,7 @@
3031
"prettier": "^2.8.1",
3132
"retry-cli": "^0.7.0",
3233
"ts-node": "^10.9.1",
34+
"turbo": "^1.13.3",
3335
"typescript": "^4.9.4",
3436
"vitest": "^0.33.0"
3537
},

0 commit comments

Comments
 (0)