diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d89d43a9..93996800 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,13 +30,13 @@ jobs: - name: Run tests run: ./.tools/run_jvm_tests.sh - build-ts: + build-node: # prevent from running on forks if: github.repository_owner == 'restatedev' runs-on: ubuntu-latest strategy: matrix: - node-version: [19.x] + node-version: [20.x] steps: - uses: actions/checkout@v3 @@ -50,6 +50,33 @@ jobs: - name: Run tests run: ./.tools/run_node_tests.sh + build-altjs: + # prevent from running on forks + if: github.repository_owner == 'restatedev' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # We just need npm from Node + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Run tests + run: ./.tools/run_altjs_tests.sh + build-go: # prevent from running on forks if: github.repository_owner == 'restatedev' diff --git a/.tools/run_altjs_tests.sh b/.tools/run_altjs_tests.sh new file mode 100755 index 00000000..c60e7494 --- /dev/null +++ b/.tools/run_altjs_tests.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -eufx -o pipefail + +SELF_PATH=${BASH_SOURCE[0]:-"$(command -v -- "$0")"} +PROJECT_ROOT="$(dirname "$SELF_PATH")/.." + +function bun_install_check() { + pushd $1 + bun install + bun run build + popd +} + +function deno_install_check() { + pushd $1 + deno task build + popd +} + +function wrangler_install_check() { + pushd $1 + npm install + npm run build + npx wrangler deploy --dry-run --outdir dist + popd +} + +wrangler_install_check $PROJECT_ROOT/templates/cloudflare-worker +bun_install_check $PROJECT_ROOT/templates/bun +deno_install_check $PROJECT_ROOT/templates/deno diff --git a/.tools/run_node_tests.sh b/.tools/run_node_tests.sh index a80a87ce..ab8246a7 100755 --- a/.tools/run_node_tests.sh +++ b/.tools/run_node_tests.sh @@ -14,7 +14,6 @@ npm_install_check $PROJECT_ROOT/basics/basics-typescript npm_install_check $PROJECT_ROOT/templates/typescript npm_install_check $PROJECT_ROOT/templates/typescript-lambda-cdk npm_install_check $PROJECT_ROOT/templates/cloudflare-worker -#npm_install_check $PROJECT_ROOT/templates/bun npm_install_check $PROJECT_ROOT/templates/typescript-testing npm --prefix $PROJECT_ROOT/templates/typescript-testing run test diff --git a/templates/bun/package.json b/templates/bun/package.json index b63f44d0..fdf529dd 100644 --- a/templates/bun/package.json +++ b/templates/bun/package.json @@ -3,6 +3,7 @@ "type": "module", "version": "0.0.1", "scripts": { + "build": "bun build --target bun --outdir dist src/index.ts", "dev": "bun run --watch src/index.ts", "start": "bun run src/index.ts", "format": "prettier --write \"src/*.+(js|ts|json)\"" diff --git a/templates/deno/deno.jsonc b/templates/deno/deno.jsonc index 841d7663..1b6621e1 100644 --- a/templates/deno/deno.jsonc +++ b/templates/deno/deno.jsonc @@ -1,6 +1,7 @@ { "tasks": { + "build": "deno check main.ts", "dev": "deno run --allow-net --allow-env --watch main.ts", - "start": "deno run --allow-net --allow-env main.ts" - } + "start": "deno run --allow-net --allow-env main.ts", + }, }