Skip to content

Commit e00895d

Browse files
khaliqgantclaude
andcommitted
Add CI/CD workflows, SDK build config updates, and CI design doc
Adds dedicated GitHub Actions workflows for CI (tests + typecheck), npm publishing, and Go binary releases. Updates SDK package.json, tsconfig, and README. Adds CI/CD design doc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d90792b commit e00895d

File tree

8 files changed

+847
-107
lines changed

8 files changed

+847
-107
lines changed

.github/workflows/ci.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
go-test:
15+
name: Go Test
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
go-version:
20+
- "1.22"
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version: ${{ matrix.go-version }}
29+
cache: true
30+
31+
- name: Run tests
32+
run: go test ./...
33+
34+
go-build:
35+
name: Go Build
36+
runs-on: ubuntu-latest
37+
needs: go-test
38+
strategy:
39+
matrix:
40+
go-version:
41+
- "1.22"
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Setup Go
47+
uses: actions/setup-go@v5
48+
with:
49+
go-version: ${{ matrix.go-version }}
50+
cache: true
51+
52+
- name: Build all binaries
53+
run: make build
54+
55+
- name: Upload binaries
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: relayfile-binaries
59+
path: bin/
60+
if-no-files-found: error
61+
62+
sdk-typecheck:
63+
name: SDK Typecheck
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Node
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: "22"
73+
cache: npm
74+
cache-dependency-path: sdk/relayfile-sdk/package-lock.json
75+
76+
- name: Install SDK dependencies
77+
working-directory: sdk/relayfile-sdk
78+
run: npm ci
79+
80+
- name: Build SDK
81+
working-directory: sdk/relayfile-sdk
82+
run: npm run build
83+
84+
- name: Typecheck SDK
85+
working-directory: sdk/relayfile-sdk
86+
run: npx tsc --noEmit
87+
88+
e2e:
89+
name: E2E
90+
runs-on: ubuntu-latest
91+
needs:
92+
- go-build
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v4
96+
97+
- name: Setup Go
98+
uses: actions/setup-go@v5
99+
with:
100+
go-version: "1.22"
101+
cache: true
102+
103+
- name: Setup Node
104+
uses: actions/setup-node@v4
105+
with:
106+
node-version: "22"
107+
cache: npm
108+
cache-dependency-path: sdk/relayfile-sdk/package-lock.json
109+
110+
- name: Download binaries
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: relayfile-binaries
114+
path: bin
115+
116+
- name: Make binaries executable
117+
run: chmod +x bin/*
118+
119+
- name: Run E2E suite
120+
env:
121+
CI: "true"
122+
run: npx --yes tsx scripts/e2e.ts --ci
123+
124+
workers-typecheck:
125+
name: Workers Typecheck
126+
if: ${{ hashFiles('packages/server/tsconfig.json') != '' }}
127+
runs-on: ubuntu-latest
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v4
131+
132+
- name: Setup Node
133+
uses: actions/setup-node@v4
134+
with:
135+
node-version: "22"
136+
cache: npm
137+
cache-dependency-path: packages/server/package-lock.json
138+
139+
- name: Install worker dependencies
140+
working-directory: packages/server
141+
run: npm ci
142+
143+
- name: Typecheck workers
144+
working-directory: packages/server
145+
run: npx tsc --noEmit

.github/workflows/publish-npm.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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: sdk/relayfile-sdk/package-lock.json
62+
registry-url: "https://registry.npmjs.org"
63+
64+
- name: Install deps
65+
working-directory: sdk/relayfile-sdk
66+
run: npm ci
67+
68+
- name: Version bump
69+
id: version
70+
working-directory: sdk/relayfile-sdk
71+
run: |
72+
CUSTOM_VERSION="${{ github.event.inputs.custom_version }}"
73+
VERSION_TYPE="${{ github.event.inputs.version }}"
74+
75+
if [ -n "$CUSTOM_VERSION" ]; then
76+
npm version "$CUSTOM_VERSION" --no-git-tag-version --allow-same-version
77+
else
78+
npm version "$VERSION_TYPE" --no-git-tag-version
79+
fi
80+
81+
NEW_VERSION="$(node -p "require('./package.json').version")"
82+
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
83+
echo "tag_name=sdk-v$NEW_VERSION" >> "$GITHUB_OUTPUT"
84+
85+
- name: Build
86+
working-directory: sdk/relayfile-sdk
87+
run: npm run build
88+
89+
- name: Test
90+
working-directory: sdk/relayfile-sdk
91+
run: npx tsc --noEmit
92+
93+
- name: Dry run check
94+
if: github.event.inputs.dry_run == 'true'
95+
working-directory: sdk/relayfile-sdk
96+
env:
97+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
98+
run: npm publish --dry-run --access public --tag "${{ github.event.inputs.tag }}" --ignore-scripts
99+
100+
- name: Publish
101+
if: github.event.inputs.dry_run != 'true'
102+
working-directory: sdk/relayfile-sdk
103+
env:
104+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
105+
run: npm publish --access public --provenance --tag "${{ github.event.inputs.tag }}" --ignore-scripts
106+
107+
- name: Commit version bump and create git tag
108+
if: github.event.inputs.dry_run != 'true'
109+
run: |
110+
NEW_VERSION="${{ steps.version.outputs.new_version }}"
111+
TAG_NAME="${{ steps.version.outputs.tag_name }}"
112+
113+
git config user.name "GitHub Actions"
114+
git config user.email "actions@github.com"
115+
116+
git add sdk/relayfile-sdk/package.json sdk/relayfile-sdk/package-lock.json
117+
git commit -m "chore(sdk): release v${NEW_VERSION}"
118+
git tag -a "${TAG_NAME}" -m "SDK ${NEW_VERSION}"
119+
120+
git push origin HEAD:main
121+
git push origin "${TAG_NAME}"
122+
123+
- name: Create GitHub Release
124+
if: github.event.inputs.dry_run != 'true'
125+
uses: softprops/action-gh-release@v2
126+
with:
127+
tag_name: ${{ steps.version.outputs.tag_name }}
128+
name: ${{ steps.version.outputs.tag_name }}
129+
body: |
130+
## @relayfile/sdk ${{ steps.version.outputs.new_version }}
131+
132+
Install:
133+
```bash
134+
npm install @relayfile/sdk@${{ steps.version.outputs.new_version }}
135+
```
136+
137+
Dist-tag: `${{ github.event.inputs.tag }}`
138+
Provenance: enabled via `npm publish --provenance`
139+
generate_release_notes: true
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)