Skip to content

Commit 35bf2e9

Browse files
authored
Merge pull request #4 from AgentWorkforce/prep-for-usage
Prep for usage: bulk API, export, WebSocket, mount hardening, E2E
2 parents cac6b4f + b472680 commit 35bf2e9

81 files changed

Lines changed: 17679 additions & 1566 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
go-test:
15+
name: Go Test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version-file: go.mod
25+
cache: true
26+
27+
- name: Run tests
28+
run: go test ./...
29+
30+
go-build:
31+
name: Go Build
32+
runs-on: ubuntu-latest
33+
needs: go-test
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version-file: go.mod
42+
cache: true
43+
44+
- name: Build all binaries
45+
run: make build
46+
47+
- name: Upload binaries
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: relayfile-binaries
51+
path: bin/
52+
if-no-files-found: error
53+
54+
sdk-typecheck:
55+
name: SDK Typecheck
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Setup Node
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: "22"
65+
66+
- name: Install SDK dependencies
67+
working-directory: packages/relayfile-sdk
68+
run: npm ci
69+
70+
- name: Build SDK
71+
working-directory: packages/relayfile-sdk
72+
run: npm run build
73+
74+
- name: Typecheck SDK
75+
working-directory: packages/relayfile-sdk
76+
run: npx tsc --noEmit
77+
78+
e2e:
79+
name: E2E
80+
runs-on: ubuntu-latest
81+
needs: go-build
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
86+
- name: Setup Go
87+
uses: actions/setup-go@v5
88+
with:
89+
go-version-file: go.mod
90+
cache: true
91+
92+
- name: Setup Node
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: "22"
96+
97+
- name: Download binaries
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: relayfile-binaries
101+
path: bin
102+
103+
- name: Make binaries executable
104+
run: chmod +x bin/*
105+
106+
- name: Run E2E suite
107+
env:
108+
CI: "true"
109+
run: npx --yes tsx scripts/e2e.ts --ci

.github/workflows/contract.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
node-version: "20"
2929

3030
- name: Install SDK deps
31-
working-directory: sdk/relayfile-sdk
31+
working-directory: packages/relayfile-sdk
3232
run: npm ci
3333

3434
- name: Build SDK
35-
working-directory: sdk/relayfile-sdk
35+
working-directory: packages/relayfile-sdk
3636
run: npm run build
3737

3838
- name: Validate contract surface

.github/workflows/publish-npm.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: Publish NPM Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version bump type"
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
- prerelease
15+
default: patch
16+
custom_version:
17+
description: "Custom version (optional, overrides version type)"
18+
required: false
19+
type: string
20+
dry_run:
21+
description: "Dry run (do not actually publish)"
22+
required: false
23+
type: boolean
24+
default: false
25+
tag:
26+
description: "NPM dist-tag"
27+
required: false
28+
type: choice
29+
options:
30+
- latest
31+
- next
32+
- beta
33+
- alpha
34+
default: latest
35+
36+
concurrency:
37+
group: publish-npm
38+
cancel-in-progress: false
39+
40+
permissions:
41+
contents: write
42+
id-token: write
43+
44+
jobs:
45+
publish-sdk:
46+
name: Publish @relayfile/sdk
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Setup Node 22
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: "22"
60+
cache: npm
61+
cache-dependency-path: packages/relayfile-sdk/package-lock.json
62+
registry-url: "https://registry.npmjs.org"
63+
64+
- name: Update npm to latest
65+
run: npm install -g npm@latest
66+
67+
- name: Install deps
68+
working-directory: packages/relayfile-sdk
69+
run: npm ci
70+
71+
- name: Version bump
72+
id: version
73+
working-directory: packages/relayfile-sdk
74+
run: |
75+
CUSTOM_VERSION="${{ github.event.inputs.custom_version }}"
76+
VERSION_TYPE="${{ github.event.inputs.version }}"
77+
78+
if [ -n "$CUSTOM_VERSION" ]; then
79+
npm version "$CUSTOM_VERSION" --no-git-tag-version --allow-same-version
80+
else
81+
npm version "$VERSION_TYPE" --no-git-tag-version
82+
fi
83+
84+
NEW_VERSION="$(node -p "require('./package.json').version")"
85+
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
86+
echo "tag_name=sdk-v$NEW_VERSION" >> "$GITHUB_OUTPUT"
87+
88+
- name: Build
89+
working-directory: packages/relayfile-sdk
90+
run: npm run build
91+
92+
- name: Test
93+
working-directory: packages/relayfile-sdk
94+
run: npx tsc --noEmit
95+
96+
- name: Dry run check
97+
if: github.event.inputs.dry_run == 'true'
98+
working-directory: packages/relayfile-sdk
99+
run: npm publish --dry-run --access public --tag "${{ github.event.inputs.tag }}" --ignore-scripts
100+
101+
- name: Publish
102+
if: github.event.inputs.dry_run != 'true'
103+
working-directory: packages/relayfile-sdk
104+
run: npm publish --access public --provenance --tag "${{ github.event.inputs.tag }}" --ignore-scripts
105+
106+
- name: Commit version bump and create git tag
107+
if: github.event.inputs.dry_run != 'true'
108+
run: |
109+
NEW_VERSION="${{ steps.version.outputs.new_version }}"
110+
TAG_NAME="${{ steps.version.outputs.tag_name }}"
111+
112+
git config user.name "GitHub Actions"
113+
git config user.email "actions@github.com"
114+
115+
git add packages/relayfile-sdk/package.json packages/relayfile-sdk/package-lock.json
116+
git commit -m "chore(sdk): release v${NEW_VERSION}"
117+
git tag -a "${TAG_NAME}" -m "SDK ${NEW_VERSION}"
118+
119+
git push origin HEAD:main
120+
git push origin "${TAG_NAME}"
121+
122+
- name: Create GitHub Release
123+
if: github.event.inputs.dry_run != 'true'
124+
uses: softprops/action-gh-release@v2
125+
with:
126+
tag_name: ${{ steps.version.outputs.tag_name }}
127+
name: ${{ steps.version.outputs.tag_name }}
128+
body: |
129+
## @relayfile/sdk ${{ steps.version.outputs.new_version }}
130+
131+
Install:
132+
```bash
133+
npm install @relayfile/sdk@${{ steps.version.outputs.new_version }}
134+
```
135+
136+
Dist-tag: `${{ github.event.inputs.tag }}`
137+
Provenance: enabled via `npm publish --provenance`
138+
generate_release_notes: true
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
142+
publish-cli:
143+
name: Publish relayfile (CLI)
144+
runs-on: ubuntu-latest
145+
needs: publish-sdk
146+
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v4
150+
151+
- name: Setup Node 22
152+
uses: actions/setup-node@v4
153+
with:
154+
node-version: "22"
155+
registry-url: "https://registry.npmjs.org"
156+
157+
- name: Update npm to latest
158+
run: npm install -g npm@latest
159+
160+
- name: Sync version with SDK
161+
working-directory: packages/relayfile
162+
run: |
163+
SDK_VERSION="$(node -p "require('../relayfile-sdk/package.json').version")"
164+
npm version "$SDK_VERSION" --no-git-tag-version --allow-same-version
165+
166+
- name: Dry run check
167+
if: github.event.inputs.dry_run == 'true'
168+
working-directory: packages/relayfile
169+
run: npm publish --dry-run --access public --tag "${{ github.event.inputs.tag }}"
170+
171+
- name: Publish
172+
if: github.event.inputs.dry_run != 'true'
173+
working-directory: packages/relayfile
174+
run: npm publish --access public --provenance --tag "${{ github.event.inputs.tag }}"

.github/workflows/publish-sdk.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ jobs:
7373
registry-url: "https://registry.npmjs.org"
7474

7575
- name: Install deps
76-
working-directory: sdk/relayfile-sdk
76+
working-directory: packages/relayfile-sdk
7777
run: npm ci
7878

7979
- name: Version bump
8080
id: bump
81-
working-directory: sdk/relayfile-sdk
81+
working-directory: packages/relayfile-sdk
8282
run: |
8383
CUSTOM_VERSION="${{ github.event.inputs.custom_version }}"
8484
VERSION_TYPE="${{ github.event.inputs.version }}"
@@ -105,16 +105,16 @@ jobs:
105105
fi
106106
107107
- name: Build
108-
working-directory: sdk/relayfile-sdk
108+
working-directory: packages/relayfile-sdk
109109
run: npm run build
110110

111111
- name: Upload build artifacts
112112
uses: actions/upload-artifact@v4
113113
with:
114114
name: sdk-build
115115
path: |
116-
sdk/relayfile-sdk/package.json
117-
sdk/relayfile-sdk/dist/
116+
packages/relayfile-sdk/package.json
117+
packages/relayfile-sdk/dist/
118118
retention-days: 1
119119

120120
publish:
@@ -136,13 +136,13 @@ jobs:
136136
uses: actions/download-artifact@v4
137137
with:
138138
name: sdk-build
139-
path: sdk/relayfile-sdk
139+
path: packages/relayfile-sdk
140140

141141
- name: Update npm for OIDC support
142142
run: npm install -g npm@latest
143143

144144
- name: Verify build artifacts
145-
working-directory: sdk/relayfile-sdk
145+
working-directory: packages/relayfile-sdk
146146
run: |
147147
echo "=== Verifying dist/ contents ==="
148148
if [ ! -d "dist" ]; then
@@ -163,14 +163,14 @@ jobs:
163163
164164
- name: Dry run check
165165
if: github.event.inputs.dry_run == 'true'
166-
working-directory: sdk/relayfile-sdk
166+
working-directory: packages/relayfile-sdk
167167
run: |
168168
echo "Dry run - would publish @relayfile/sdk@${{ needs.build.outputs.new_version }}"
169169
npm publish --dry-run --access public --tag ${{ github.event.inputs.tag }} --ignore-scripts
170170
171171
- name: Publish with provenance
172172
if: github.event.inputs.dry_run != 'true'
173-
working-directory: sdk/relayfile-sdk
173+
working-directory: packages/relayfile-sdk
174174
run: npm publish --access public --provenance --tag ${{ github.event.inputs.tag }} --ignore-scripts
175175

176176
create-tag:
@@ -190,7 +190,7 @@ jobs:
190190
uses: actions/download-artifact@v4
191191
with:
192192
name: sdk-build
193-
path: sdk/relayfile-sdk
193+
path: packages/relayfile-sdk
194194

195195
- name: Commit and tag
196196
run: |
@@ -199,7 +199,7 @@ jobs:
199199
200200
NEW_VERSION="${{ needs.build.outputs.new_version }}"
201201
202-
git add sdk/relayfile-sdk/package.json
202+
git add packages/relayfile-sdk/package.json
203203
if ! git diff --staged --quiet; then
204204
git commit -m "chore(sdk): v${NEW_VERSION}"
205205
git push origin HEAD:main

0 commit comments

Comments
 (0)