diff --git a/.github/workflows/test_core.yml b/.github/workflows/test_core.yml new file mode 100644 index 00000000..482dc07e --- /dev/null +++ b/.github/workflows/test_core.yml @@ -0,0 +1,23 @@ +name: Test Core + +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/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }} + + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: "1.41.1" + + - name: Test + run: deno task test:core diff --git a/.github/workflows/e2e.yml b/.github/workflows/test_project.yml similarity index 97% rename from .github/workflows/e2e.yml rename to .github/workflows/test_project.yml index 6e34647f..732c45d6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/test_project.yml @@ -1,4 +1,5 @@ -name: E2E +name: Test Project + on: - push diff --git a/deno.jsonc b/deno.jsonc index 47a43e03..01413297 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -12,7 +12,11 @@ // Generates schema "artifacts:build:all": "deno task artifacts:build:schema && deno task artifacts:build:runtime_archive", "artifacts:build:schema": "deno run --allow-env --allow-read --allow-write src/artifacts/build_schema.ts", - "artifacts:build:runtime_archive": "deno run --allow-env --allow-read --allow-write src/artifacts/build_runtime_archive.ts" + "artifacts:build:runtime_archive": "deno run --allow-env --allow-read --allow-write src/artifacts/build_runtime_archive.ts", + + // Runs tests + "test:core": "deno task artifacts:build:all && deno test -A src/", + "test:project": "deno task cli:run test" }, "lint": { "include": ["src/"], diff --git a/deno.lock b/deno.lock index 63b64e8d..26e8f8a3 100644 --- a/deno.lock +++ b/deno.lock @@ -609,8 +609,11 @@ } }, "redirects": { + "https://esm.sh/@prisma/adapter-pg@^5.9.1": "https://esm.sh/@prisma/adapter-pg@5.10.2", "https://esm.sh/ajv-formats@^2.1.1": "https://esm.sh/ajv-formats@2.1.1", - "https://esm.sh/ajv@^8.12.0": "https://esm.sh/ajv@8.12.0" + "https://esm.sh/ajv@^8.12.0": "https://esm.sh/ajv@8.12.0", + "https://esm.sh/pg@^8.11.3": "https://esm.sh/pg@8.11.3", + "https://esm.sh/v135/@types/pg@^8/index.d.ts": "https://esm.sh/v135/@types/pg@8.11.2/index.d.ts" }, "remote": { "https://deno.land/std@0.140.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", @@ -1149,13 +1152,39 @@ "https://deno.land/x/postgres@v0.17.2/utils/utils.ts": "ca47193ea03ff5b585e487a06f106d367e509263a960b787197ce0c03113a738", "https://deno.land/x/wasmbuild@0.14.1/cache.ts": "89eea5f3ce6035a1164b3e655c95f21300498920575ade23161421f5b01967f4", "https://deno.land/x/wasmbuild@0.14.1/loader.ts": "d98d195a715f823151cbc8baa3f32127337628379a02d9eb2a3c5902dbccfc02", + "https://esm.sh/@prisma/adapter-pg@5.10.2": "b5a8f6779bf3a5cde5d6400c05f43bf9f0c3d78314053abdfe5b85624addc573", "https://esm.sh/ajv-formats@2.1.1": "575b3830618970ddc3aba96310bf4df7358bb37fcea101f58b36897ff3ac2ea7", "https://esm.sh/ajv@8.12.0": "cc1a73af661466c7f4e6a94d93ece78542d700f2165bdb16a531e9db8856c5aa", + "https://esm.sh/pg@8.11.3": "a925969eca94312f88e3f525a0b7e6b6c4ed2e92e09ad76afd80c8faac720018", + "https://esm.sh/v135/@prisma/adapter-pg@5.10.2/denonext/adapter-pg.mjs": "752e2cc7ca8ce5d52b993ea1d1369beacb42703b5ff13d1b1f460dbf9ac75e11", + "https://esm.sh/v135/@prisma/debug@5.10.2/denonext/debug.mjs": "cab0a6f1eb5df296ddf9b9590519e6bdc851bfad482961b7bd25e5bfe1cc428c", + "https://esm.sh/v135/@prisma/driver-adapter-utils@5.10.2/denonext/driver-adapter-utils.mjs": "2266fc26eebd8821b502bb0ada2488062259b3b4d8188cd5692e13f14caa174c", "https://esm.sh/v135/ajv-formats@2.1.1/denonext/ajv-formats.mjs": "06092e00b42202633ae6dab4b53287c133af882ddb14c6707277cdb237634967", "https://esm.sh/v135/ajv@8.12.0/denonext/ajv.mjs": "4645df9093d0f8be0e964070a4a7aea8adea06e8883660340931f7a3f979fc65", "https://esm.sh/v135/ajv@8.12.0/denonext/dist/compile/codegen.js": "d981238e5b1e78217e1c6db59cbd594369279722c608ed630d08717ee44edd84", + "https://esm.sh/v135/bindings@1.5.0/denonext/bindings.mjs": "2c1381e3242c652aae9c89b542b579d84c550f768e62794407c419c610c15e2b", "https://esm.sh/v135/fast-deep-equal@3.1.3/denonext/fast-deep-equal.mjs": "6313b3e05436550e1c0aeb2a282206b9b8d9213b4c6f247964dd7bb4835fb9e5", + "https://esm.sh/v135/file-uri-to-path@1.0.0/denonext/file-uri-to-path.mjs": "495c3338c228fbb003b0201a78c474821dcac34f90e92eb9b7b786cd56aeeb08", "https://esm.sh/v135/json-schema-traverse@1.0.0/denonext/json-schema-traverse.mjs": "c5da8353bc014e49ebbb1a2c0162d29969a14c325da19644e511f96ba670cc45", - "https://esm.sh/v135/uri-js@4.4.1/denonext/uri-js.mjs": "901d462f9db207376b39ec603d841d87e6b9e9568ce97dfaab12aa77d0f99f74" + "https://esm.sh/v135/libpq@1.8.12/denonext/libpq.mjs": "20f0a88f038e848b7034c3cd6157a158a7c4bb035e7dee0a3b751d7be0b293ef", + "https://esm.sh/v135/pg-cloudflare@1.1.1/denonext/pg-cloudflare.mjs": "29b4734678266346a8f4e1f89b7fc7f37afd23c5bd9101e6428407ae5a1749d4", + "https://esm.sh/v135/pg-connection-string@2.6.2/denonext/pg-connection-string.mjs": "ab6673e250529e7f57f4481db5d941f56ad7b60cb48eb7668beb060001b13b74", + "https://esm.sh/v135/pg-int8@1.0.1/denonext/pg-int8.mjs": "f3fe9fdae61f2e18c837d453867a82ea7f0e0aed0756810c873fae518bf12a91", + "https://esm.sh/v135/pg-native@3.0.1/denonext/pg-native.mjs": "9ce61eeac94f7ac1a73f5720e1d6fee2581d58e110c30b567e9b24d8959aa858", + "https://esm.sh/v135/pg-pool@3.6.1/denonext/pg-pool.mjs": "b367bbdb06297a543f7dfa7538f8caf8618a4e9a7a449ee4e83ea2a9ed402540", + "https://esm.sh/v135/pg-protocol@1.6.0/denonext/pg-protocol.mjs": "bef203e1ab866502d7e82bea04e66a2c62f540eb1860fa4efa2190aeef36fbed", + "https://esm.sh/v135/pg-types@1.13.0/denonext/pg-types.mjs": "4b214d0b38089ac9f65f7ff289eb79b9c71e07a33f77878a5a6fe992049534ea", + "https://esm.sh/v135/pg-types@2.2.0/denonext/pg-types.mjs": "813e9399b0f4472d8b565af47d26a2e20ad260722352c409667d92a36eac3059", + "https://esm.sh/v135/pg@8.11.3/denonext/pg.mjs": "860d69952b1e80cd1a9f6562ad0d2e8af6402aa57a17cb8ac9dd7683cdd397ae", + "https://esm.sh/v135/pgpass@1.0.5/denonext/pgpass.mjs": "be6e8a975ee7792c1fd9d876b455781347736c462c47e5d6d46b54f814b0fdcf", + "https://esm.sh/v135/postgres-array@1.0.3/denonext/postgres-array.mjs": "6e1727abeb3d025d82e07f062dc48184ae8994335213dc9a210e0f7dc53163c9", + "https://esm.sh/v135/postgres-array@2.0.0/denonext/postgres-array.mjs": "aeca4a7848e999e55f22bce594bb18e926470ad5e2eee6a06958a15c169072a4", + "https://esm.sh/v135/postgres-array@3.0.2/denonext/postgres-array.mjs": "52b71e002995214ed2309513661ae136f3abe65716dd47a99631b84fc3e0e7a0", + "https://esm.sh/v135/postgres-bytea@1.0.0/denonext/postgres-bytea.mjs": "0e47221a250d94e290032252780836c3ca3c73d76c9cbd718ed893c315bcbf7a", + "https://esm.sh/v135/postgres-date@1.0.7/denonext/postgres-date.mjs": "51eccbdd7a6fb693d5cc179811fe0606399a4b80b3901edffebf60f28738cf61", + "https://esm.sh/v135/postgres-interval@1.2.0/denonext/postgres-interval.mjs": "bf0c29cb850cd9ca6105c527a6892fe160c0111d5acdcfbf91d101e6b7fad6af", + "https://esm.sh/v135/split2@4.2.0/denonext/split2.mjs": "c0275bb556d479d6e7062fbff1727187eac3d9de3758a4677f947b3d7a9ff361", + "https://esm.sh/v135/uri-js@4.4.1/denonext/uri-js.mjs": "901d462f9db207376b39ec603d841d87e6b9e9568ce97dfaab12aa77d0f99f74", + "https://esm.sh/v135/xtend@4.0.2/denonext/mutable.js": "30c73b4d9a16c098c8b88cc66a720e5b5a92fb007cdd758ab96b66b031cf8bd2" } } diff --git a/src/template/template_test.ts b/src/template/template_test.ts index 71d14f99..e4d72df9 100644 --- a/src/template/template_test.ts +++ b/src/template/template_test.ts @@ -5,18 +5,26 @@ import { templateModule } from "./module.ts"; import { templateProject } from "./project.ts"; import { templateScript } from "./script.ts"; -Deno.test("e2e", async () => { - const path = await Deno.makeTempDir(); +Deno.test({ + name: "e2e", - await templateProject(path); + // TODO: https://github.com/rivet-gg/open-game-services-engine/issues/35 + sanitizeOps: false, + sanitizeResources: false, - await templateModule(await loadProject({ path }), "module_a"); + async fn() { + const path = await Deno.makeTempDir(); - await templateScript(await loadProject({ path }), "module_a", "script_a"); + await templateProject(path); - await build(await loadProject({ path }), { - format: Format.Native, - runtime: Runtime.Deno, - dbDriver: DbDriver.NodePostgres, - }); + await templateModule(await loadProject({ path }), "module_a"); + + await templateScript(await loadProject({ path }), "module_a", "script_a"); + + await build(await loadProject({ path }), { + format: Format.Native, + runtime: Runtime.Deno, + dbDriver: DbDriver.NodePostgres, + }); + }, });