Skip to content

Commit

Permalink
feat: e2e ci tests (#135)
Browse files Browse the repository at this point in the history
Fixes OGBE-42
  • Loading branch information
NathanFlurry committed Mar 6, 2024
2 parents 8ab04d4 + 0759fe1 commit 7ededdf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: E2E
on:
- push

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

# Add private key to be able to access OpenGB repository
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }}

- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: "1.41.1"

- name: Build OpenGB
run: deno task cli:install

- name: Check Formatting
run: cd tests/test_project/ && opengb format --check

- name: Lint
run: cd tests/test_project/ && opengb lint

- name: Run Tests
run: cd tests/test_project/ && opengb test
3 changes: 1 addition & 2 deletions src/cli/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const lintCommand = new Command<GlobalOpts>()
const project = await initProject(opts);

const sourceFiles = await listSourceFiles(project, { localOnly: true });
console.log(sourceFiles);

const cmd = await new Deno.Command("deno", {
args: [
Expand All @@ -19,6 +18,6 @@ export const lintCommand = new Command<GlobalOpts>()
stderr: "inherit",
})
.output();
if (!cmd.success) throw new Error("Link failed");
if (!cmd.success) throw new Error("Lint failed");
},
);
7 changes: 5 additions & 2 deletions tests/test_project/backend.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
registries:
default:
git:
url: https://github.com/rivet-gg/open-game-services.git
branch: main
# TODO: Add back HTTP fetches if SSH isn't supported
# url: https://github.com/rivet-gg/open-game-services.git
# TODO: This may not work for Windows users
url: [email protected]:rivet-gg/opengb-registry.git
rev: f28b9c0ddbb69fcc092dfff12a18707065a69251
directory: ./modules
# default:
# local:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_project/modules/foo/tests/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test("e2e", async (ctx: TestContext) => {
identity: { guest: {} },
}) as any;

const { users: users, token: token2 } = await ctx.call("users", "get", {
const { users: users } = await ctx.call("users", "get", {
userIds: [user.id],
}) as any;
assertExists(users[0]);
Expand Down

0 comments on commit 7ededdf

Please sign in to comment.