Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bun / Deno / Wrangler tests #172

Merged
merged 6 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 29 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
31 changes: 31 additions & 0 deletions .tools/run_altjs_tests.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .tools/run_node_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions templates/bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)\""
Expand Down
5 changes: 3 additions & 2 deletions templates/deno/deno.jsonc
Original file line number Diff line number Diff line change
@@ -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",
},
}
Loading