Skip to content

Commit 5062bf1

Browse files
authored
V1 SDKs and Docs (#1361)
New SDKs and docs for the v1 release.
1 parent 76e4fda commit 5062bf1

File tree

623 files changed

+28768
-4760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

623 files changed

+28768
-4760
lines changed

.github/workflows/sdk-python.yml

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,95 @@ jobs:
5858
steps:
5959
- uses: actions/checkout@v4
6060

61-
- name: Run Hatchet Engine
61+
- name: Install Protoc
62+
uses: arduino/setup-protoc@v3
63+
with:
64+
version: '25.1'
65+
66+
- name: Install Task
67+
uses: arduino/setup-task@v2
68+
69+
- name: Setup Go
70+
uses: actions/setup-go@v5
71+
with:
72+
go-version: '1.21'
73+
74+
- name: Start Docker dependencies
75+
working-directory: .
6276
run: docker compose up -d
6377

78+
- name: Generate
79+
working-directory: .
80+
run: |
81+
export DATABASE_URL="postgresql://hatchet:[email protected]:5431/hatchet"
82+
go run ./cmd/hatchet-migrate
83+
task generate-go
84+
85+
- name: Setup
86+
working-directory: .
87+
run: |
88+
export SEED_DEVELOPMENT=true
89+
export SERVER_PORT=8080
90+
export SERVER_URL=http://localhost:8080
91+
export SERVER_AUTH_COOKIE_DOMAIN=localhost
92+
export SERVER_AUTH_COOKIE_INSECURE=true
93+
94+
go run ./cmd/hatchet-admin quickstart
95+
96+
go run ./cmd/hatchet-engine --config ./generated/ > engine.log 2>&1 &
97+
go run ./cmd/hatchet-api --config ./generated/ > api.log 2>&1 &
98+
99+
sleep 30
64100
- name: Set up Python ${{ matrix.python-version }}
65101
uses: actions/setup-python@v5
66102
with:
67103
python-version: ${{ matrix.python-version }}
104+
68105
- name: Display Python version
69106
run: python -c "import sys; print(sys.version)"
107+
70108
- name: Install Poetry
71109
uses: snok/install-poetry@v1
72110
with:
73111
version: 1.5.1
74112
virtualenvs-create: true
75113
virtualenvs-in-project: true
114+
76115
- name: Install dependencies
77116
run: poetry install --no-interaction --all-extras
78117

79118
- name: Generate Env File
119+
working-directory: .
80120
run: |
81-
cat <<EOF > .env
82-
HATCHET_CLIENT_TOKEN="$(docker compose run --no-deps setup-config /hatchet/hatchet-admin token create --config /hatchet/config --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52 | xargs)"
83-
HATCHET_CLIENT_TLS_STRATEGY=none
84-
EOF
121+
echo "HATCHET_CLIENT_TOKEN=$(go run ./cmd/hatchet-admin token create --config ./generated/ --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52)" >> $GITHUB_ENV
122+
echo "HATCHET_CLIENT_TLS_ROOT_CA_FILE=../../certs/ca.cert" >> $GITHUB_ENV
123+
echo "HATCHET_CLIENT_WORKER_HEALTHCHECK_ENABLED=True" >> $GITHUB_ENV
85124
86125
- name: Set HATCHET_CLIENT_NAMESPACE
87126
run: |
88127
PYTHON_VERSION=$(python -c "import sys; print(f'py{sys.version_info.major}{sys.version_info.minor}')")
89128
SHORT_SHA=$(git rev-parse --short HEAD)
90129
echo "HATCHET_CLIENT_NAMESPACE=${PYTHON_VERSION}-${SHORT_SHA}" >> $GITHUB_ENV
130+
91131
- name: Run pytest
92132
run: |
93133
echo "Using HATCHET_CLIENT_NAMESPACE: $HATCHET_CLIENT_NAMESPACE"
94-
poetry run pytest -s -vvv --maxfail=5 --timeout=180 --capture=no
134+
135+
poetry run pytest -s -vvv --maxfail=5 --timeout=180 --capture=no -n 5
136+
137+
- name: Upload engine logs
138+
if: always()
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: $HATCHET_CLIENT_NAMESPACE-engine-logs
142+
path: $HATCHET_CLIENT_NAMESPACE-engine.log
143+
144+
- name: Upload API logs
145+
if: always()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: $HATCHET_CLIENT_NAMESPACE-api-logs
149+
path: $HATCHET_CLIENT_NAMESPACE-api.log
95150

96151
publish:
97152
runs-on: ubuntu-latest
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: typescript-manual-publish
2+
on:
3+
workflow_dispatch:
4+
5+
defaults:
6+
run:
7+
working-directory: ./sdks/typescript
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- name: Install pnpm
19+
run: npm install -g pnpm@8
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "20.x"
24+
registry-url: "https://registry.npmjs.org"
25+
26+
- name: Get pnpm store directory
27+
shell: bash
28+
run: |
29+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30+
31+
- name: Setup pnpm cache
32+
uses: actions/cache@v4
33+
with:
34+
path: ${{ env.STORE_PATH }}
35+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
36+
restore-keys: |
37+
${{ runner.os }}-pnpm-store-
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- name: Build and Publish SDK
43+
run: |
44+
VERSION=$(jq '.version' package.json)
45+
46+
## If the version contains `alpha`, it's an alpha version
47+
## and we should tag it as such.=
48+
if [[ "$VERSION" == *alpha* ]]; then
49+
pnpm publish:ci:alpha
50+
else
51+
pnpm publish:ci
52+
fi
53+
env:
54+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: typescript
2+
on:
3+
pull_request:
4+
paths:
5+
- 'sdks/typescript/**'
6+
- '.github/**'
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- 'sdks/typescript/**'
12+
- '.github/**'
13+
14+
defaults:
15+
run:
16+
working-directory: ./sdks/typescript
17+
18+
jobs:
19+
lint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
27+
- name: Install pnpm
28+
run: npm install -g pnpm@8
29+
30+
- name: Get pnpm store directory
31+
shell: bash
32+
run: |
33+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
34+
35+
- name: Setup pnpm cache
36+
uses: actions/cache@v4
37+
with:
38+
path: ${{ env.STORE_PATH }}
39+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
40+
restore-keys: |
41+
${{ runner.os }}-pnpm-store-
42+
43+
- name: Install dependencies
44+
run: pnpm install
45+
46+
- name: Lint
47+
run: pnpm lint:check
48+
49+
test-unit:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
with:
55+
submodules: recursive
56+
57+
- name: Install pnpm
58+
run: npm install -g pnpm@8
59+
60+
- name: Get pnpm store directory
61+
shell: bash
62+
run: |
63+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
64+
65+
- name: Setup pnpm cache
66+
uses: actions/cache@v4
67+
with:
68+
path: ${{ env.STORE_PATH }}
69+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
70+
restore-keys: |
71+
${{ runner.os }}-pnpm-store-
72+
73+
- name: Install dependencies
74+
run: pnpm install
75+
76+
- name: Unit tests
77+
run: pnpm test:unit
78+
79+
test-e2e:
80+
runs-on: ubuntu-latest
81+
timeout-minutes: 10
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
- name: Sync Submodule Branch
86+
shell: bash
87+
run: |
88+
./branch-sync.sh
89+
- name: Install Protoc
90+
uses: arduino/setup-protoc@v3
91+
with:
92+
version: '25.1'
93+
94+
- name: Install Task
95+
uses: arduino/setup-task@v2
96+
97+
- name: Setup Go
98+
uses: actions/setup-go@v5
99+
with:
100+
go-version: '1.21'
101+
102+
- name: Install pnpm
103+
run: npm install -g pnpm@8
104+
105+
- name: Install Atlas
106+
run: |
107+
curl -sSf https://atlasgo.sh | sh
108+
109+
- name: Get pnpm store directory
110+
shell: bash
111+
run: |
112+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
113+
114+
- name: Setup pnpm cache
115+
uses: actions/cache@v4
116+
with:
117+
path: ${{ env.STORE_PATH }}
118+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
119+
restore-keys: |
120+
${{ runner.os }}-pnpm-store-
121+
122+
- name: Compose
123+
working-directory: .
124+
run: docker compose up -d
125+
126+
- name: Install dependencies
127+
run: pnpm install
128+
129+
- name: Generate
130+
working-directory: .
131+
run: |
132+
export DATABASE_URL="postgresql://hatchet:[email protected]:5431/hatchet"
133+
go run ./cmd/hatchet-migrate
134+
task generate-go
135+
136+
- name: Setup
137+
working-directory: .
138+
run: |
139+
export SEED_DEVELOPMENT=true
140+
export SERVER_PORT=8080
141+
export SERVER_URL=http://localhost:8080
142+
export SERVER_AUTH_COOKIE_DOMAIN=localhost
143+
export SERVER_AUTH_COOKIE_INSECURE=true
144+
145+
go run ./cmd/hatchet-admin quickstart
146+
147+
go run ./cmd/hatchet-engine --config ./generated/ &
148+
go run ./cmd/hatchet-api --config ./generated/ &
149+
150+
sleep 30
151+
- name: E2E tests
152+
run: |
153+
cd ../..
154+
export HATCHET_CLIENT_TOKEN="$(go run ./cmd/hatchet-admin token create --config ./generated/ --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52)"
155+
156+
cd sdks/typescript
157+
export HATCHET_CLIENT_TLS_ROOT_CA_FILE=../../certs/ca.cert
158+
export NODE_TLS_REJECT_UNAUTHORIZED=0
159+
pnpm test:e2e
160+
161+
publish:
162+
runs-on: ubuntu-latest
163+
needs: [lint, test-unit, test-e2e]
164+
if: github.ref == 'refs/heads/main'
165+
steps:
166+
- name: Checkout
167+
uses: actions/checkout@v4
168+
with:
169+
submodules: recursive
170+
171+
- name: Install pnpm
172+
run: npm install -g pnpm@8
173+
174+
- uses: actions/setup-node@v4
175+
with:
176+
node-version: "20.x"
177+
registry-url: "https://registry.npmjs.org"
178+
179+
- name: Get pnpm store directory
180+
shell: bash
181+
run: |
182+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
183+
184+
- name: Setup pnpm cache
185+
uses: actions/cache@v4
186+
with:
187+
path: ${{ env.STORE_PATH }}
188+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
189+
restore-keys: |
190+
${{ runner.os }}-pnpm-store-
191+
192+
- name: Install dependencies
193+
run: pnpm install
194+
195+
- name: Build and Publish SDK
196+
run: |
197+
VERSION=$(jq '.version' package.json)
198+
199+
## If the version contains `alpha`, it's an alpha version
200+
## and we should tag it as such.=
201+
if [[ "$VERSION" == *alpha* ]]; then
202+
pnpm publish:ci:alpha
203+
else
204+
pnpm publish:ci
205+
fi
206+
env:
207+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Taskfile.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tasks:
1212
- task: set-env-all
1313
- task: seed-dev
1414
- task: copy-ca-to-sdks
15+
- task: docs
1516
set-env-db:
1617
cmds:
1718
- |
@@ -179,3 +180,7 @@ tasks:
179180
pre-commit-run:
180181
cmds:
181182
- pre-commit run --all-files || pre-commit run --all-files
183+
docs:
184+
cmds:
185+
- npx serve -l 4001 &
186+
- cd frontend/docs/ && pnpm run dev

0 commit comments

Comments
 (0)