Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit d063608

Browse files
committed
feat(CI): Create CI for testing all modules based on a known-good engine commit
1 parent cd58433 commit d063608

File tree

3 files changed

+59
-7
lines changed

3 files changed

+59
-7
lines changed

.github/workflows/test-all.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test all modules E2E
2+
on:
3+
- push
4+
5+
env:
6+
CURRENT_WORKING_ENGINE_COMMIT: f30e8f5c9829c017deaa319e29449e10fa88971b
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
# Checkout registry repo
13+
- name: Checkout registry Repo
14+
uses: actions/checkout@v4
15+
with:
16+
path: opengb-registry
17+
18+
# Get engine repo to test against
19+
- name: Fetch engine repo
20+
uses: actions/checkout@v4
21+
with:
22+
repository: rivet-gg/opengb
23+
ssh-key: ${{ secrets.GH_DEPLOY_KEY }}
24+
path: opengb
25+
26+
- name: Checkout to working commit
27+
run: cd opengb/ && git checkout $CURRENT_WORKING_ENGINE_COMMIT
28+
29+
# Install Deno to run OpenGB
30+
- name: Install Deno
31+
uses: denoland/setup-deno@v1
32+
with:
33+
deno-version: "1.41.1"
34+
35+
- name: Install OpenGB
36+
run: cd opengb/ && deno task cli:install
37+
38+
- name: Setup OpenGB databases for registry
39+
run: cd ./opengb-registry/tests/test_project && opengb db dev
40+
41+
- name: Run Tests for all modules
42+
run: cd ./opengb-registry/tests/test_project && opengb test

modules/tokens/tests/validate.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ test(
3434
test(
3535
"validate token expired",
3636
async (ctx: TestContext) => {
37-
const { token } = await ctx.call("tokens", "create", {
37+
const { token } = await ctx.modules.tokens.create({
3838
type: "test",
3939
meta: { foo: "bar" },
40-
expireAt: new Date(Date.now() + 100).toISOString(),
41-
}) as any;
40+
expireAt: new Date(Date.now() + 1000).toISOString(),
41+
});
4242

4343
// Token should be valid
44-
let validateRes = await ctx.call("tokens", "validate", {
44+
const validateRes = await ctx.modules.tokens.validate({
4545
token: token.token,
46-
}) as any;
46+
});
4747
assertEquals(token.id, validateRes.token.id);
4848

4949
// Wait for token to expire
50-
await new Promise((resolve) => setTimeout(resolve, 200));
50+
await new Promise((resolve) => setTimeout(resolve, 1100));
5151

5252
const error = await assertRejects(async () => {
53-
await ctx.call("tokens", "validate", { token: token.token }) as any;
53+
await ctx.modules.tokens.validate({ token: token.token });
5454
}, RuntimeError);
5555
assertEquals(error.code, "TOKEN_EXPIRED");
5656
},

tests/test_project/backend.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
registries:
2+
default:
3+
local:
4+
directory: ../../modules
5+
modules:
6+
currency: {}
7+
friends: {}
8+
rate_limit: {}
9+
tokens: {}
10+
users: {}

0 commit comments

Comments
 (0)