Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add integration test for Deno
  • Loading branch information
mattt committed Jul 5, 2024
commit 06e9fa580b986bec8d6f39e6f39d65c2d6998cb0
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ jobs:
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
npm --prefix integration/${{ matrix.suite }} test


integration-bun:
needs: [test, build]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -172,6 +171,29 @@ jobs:
bun test && break || echo "Test failed, retrying..."
done

integration-deno:
needs: [test]
runs-on: ubuntu-latest

env:
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}

strategy:
matrix:
deno-version: [v1.x]
suite: [deno]

steps:
- uses: actions/checkout@v4

- name: Use Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- run: |
cd integration/deno
deno test --allow-env index.test.ts --allow-net

integration-nextjs:
needs: [test, build]
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions integration/deno/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"replicate": "npm:replicate"
}
}
88 changes: 88 additions & 0 deletions integration/deno/deno.lock

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

26 changes: 26 additions & 0 deletions integration/deno/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { assertEquals } from "jsr:@std/assert";
import main from "./index.ts";

// Verify exported types.
import type {
Status,
Visibility,
WebhookEventType,
ApiError,
Collection,
Hardware,
Model,
ModelVersion,
Prediction,
Training,
Page,
ServerSentEvent,
} from "replicate";

Deno.test({
name: "main",
async fn() {
const output = await main();
assertEquals({ output }, { output: "hello Deno the dinosaur" });
},
});
16 changes: 16 additions & 0 deletions integration/deno/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Replicate from "replicate";

const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_TOKEN"),
});

export default async function main() {
return await replicate.run(
"replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
{
input: {
text: "Deno the dinosaur",
},
}
);
}