Skip to content

Commit

Permalink
feat(ci): add release script and fix github publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
Dam-Buty committed Jul 18, 2024
1 parent 6640786 commit e62d773
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
needs: [tests]
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '19.x'
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@literalai/client",
"version": "0.0.510",
"version": "0.0.511",
"description": "",
"exports": {
".": {
Expand All @@ -15,7 +15,8 @@
"scripts": {
"build": "tsup ./src",
"test": "jest --detectOpenHandles --runInBand --watchAll=false",
"prepare": "husky install"
"prepare": "husky install",
"release": "./release.sh"
},
"author": "Literal AI",
"license": "Apache-2.0",
Expand Down
27 changes: 27 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/sh

GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'

echo "🪜 Incrementing version number"
npm version patch

NEW_VERSION=$(npm pkg get version | tr -d '"')

echo "🌿 Creating release branch for v$NEW_VERSION"
git checkout -b release/$NEW_VERSION
git add .
git commit -m "chore: bump to $NEW_VERSION"
git push origin release/$NEW_VERSION

echo
echo
echo -e "----------------------------------------"
echo -e "|| ${GREEN} Your release is ready for review ${NC} ||"
echo -e "----------------------------------------"
echo -e "1️⃣ Go to ${YELLOW}https://github.com/Chainlit/typescript-client/compare/main...release/$NEW_VERSION${NC}"
echo -e "2️⃣ Create a pull request and merge it to main"
echo -e "3️⃣ Go to ${YELLOW}https://github.com/Chainlit/typescript-client/actions/workflows/publish.yaml${NC}"
echo -e "4️⃣ Click on 'Run workflow'"
echo -e "5️⃣ Rock'n'roll 🎸"
6 changes: 6 additions & 0 deletions tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ describe('End to end tests for the SDK', function () {
})
.send();

await new Promise((resolve) => setTimeout(resolve, 1000));

const fetchedStep = await client.api.getStep(step.id!);
expect(fetchedStep?.id).toBe(step.id);
expect(fetchedStep?.error).toBe('test');
Expand Down Expand Up @@ -214,6 +216,8 @@ describe('End to end tests for the SDK', function () {
})
.send();

await new Promise((resolve) => setTimeout(resolve, 1000));

const fetchedStep = await client.api.getStep(step.id!);
expect(fetchedStep?.id).toBe(step.id);
expect(fetchedStep?.error).toBe('test');
Expand Down Expand Up @@ -241,6 +245,8 @@ describe('End to end tests for the SDK', function () {
throw new Error('Step id is null');
}

await new Promise((resolve) => setTimeout(resolve, 1000));

const steps = await client.api.getSteps({
filters: [
{
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/openai.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ describe('OpenAI Instrumentation', () => {
});
});

await new Promise((resolve) => setTimeout(resolve, 1000));

const {
data: [step]
} = await client.api.getSteps({
Expand All @@ -305,7 +307,7 @@ describe('OpenAI Instrumentation', () => {

expect(step?.threadId).toBe(threadId);
expect(step?.parentId).toBe(parentId);
});
}, 30_000);

it("doesn't mix up threads and steps", async () => {
const testId = uuidv4();
Expand Down Expand Up @@ -399,6 +401,6 @@ describe('OpenAI Instrumentation', () => {
expect(firstGeneration?.parentId).toEqual(firstStep?.id);
expect(secondGeneration?.threadId).toEqual(secondThreadId);
expect(secondGeneration?.parentId).toEqual(secondStep?.id);
}, 30000);
}, 30_000);
});
});

0 comments on commit e62d773

Please sign in to comment.