Skip to content

ci: build with deno v2 #2888

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 15 additions & 2 deletions .github/workflows/deno-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x.x
deno-version: v2.2.4

- name: 'Install dependencies'
run: npm ci

- name: Vendor Deno modules
run: deno vendor edge-runtime/vendor.ts --output=edge-runtime/vendor --force
run: deno --allow-import --vendor edge-runtime/vendor.ts

- name: Test
run: deno test -A edge-runtime/
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
deno-version: v2.2.4
- name: Extract tag and version
id: extract
run: |-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
deno-version: v2.2.4
- name: Build
run: npm run build
if: ${{ steps.release.outputs.release_created }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
deno-version: v2.2.4
- name: 'Install dependencies'
run: npm ci
- name: 'Prepare Netlify CLI'
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/edge-bundler/blob/e55f825bd985d3c92e21d1b765d71e70d5628fba/node/bridge.ts#L17
deno-version: v1.46.3
deno-version: v2.2.4
- name: 'Install dependencies'
run: npm ci
- name: 'Build'
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
deno-version: v2.2.4
- name: 'Install dependencies'
run: npm ci
- name: 'Build'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/size-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ jobs:
node-version: '18.x'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Install Deno
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
- run: npm ci
deno-version: v2.2.4

- name: 'Install dependencies'
run: npm ci

- name: Package size report
uses: pkg-size/action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
uses: denoland/setup-deno@v1
with:
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
deno-version: v1.46.3
deno-version: v2.2.4

- name: install runtime
run: npm install --ignore-scripts
Expand Down
3 changes: 1 addition & 2 deletions deno.json → edge-runtime/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
},
"imports": {
"@netlify/edge-functions": "https://edge.netlify.com/v1/index.ts"
},
"importMap": "./edge-runtime/vendor/import_map.json"
}
}
8 changes: 8 additions & 0 deletions edge-runtime/vendor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ import 'https://deno.land/x/path_to_regexp@v6.2.1/index.ts'
import 'https://deno.land/x/htmlrewriter@v1.0.0/src/index.ts'

import 'https://v1-7-0--edge-utils.netlify.app/logger/mod.ts'

// Types
import 'https://deno.land/std@0.175.0/node/_global.d.ts'
import 'https://deno.land/std@0.175.0/node/_events.d.ts'
import 'https://deno.land/std@0.175.0/node/_stream.d.ts'
import 'https://deno.land/std@0.175.0/node/internal/buffer.d.ts'
import 'https://deno.land/std@0.175.0/types.d.ts'
import 'https://deno.land/x/htmlrewriter@v1.0.0/src/types.d.ts'
5 changes: 2 additions & 3 deletions tools/build-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export async function vendorDeno({
}

console.log(`📦 Vendoring Deno modules for '${vendorSource}' into '${vendorDest}'...`)
// --output=${vendorDest}
await execaCommand(`deno vendor ${vendorSource} --force`, {
await execaCommand(`deno --allow-import --vendor ${vendorSource}`, {
cwd,
})

Expand All @@ -50,7 +49,7 @@ export async function vendorDeno({
// see https://github.com/denoland/deno/issues/14123
// to workaround this we copy the wasm files manually
// (note Deno 2 allows to vendor wasm files, but it also require modules to import them and not fetch and instantiate them
// se being able to drop downloading is dependent on implementation of wasm handling in external modules as well)
// so being able to drop downloading is dependent on implementation of wasm handling in external modules as well)
await Promise.all(
wasmFilesToDownload.map(async (urlString) => {
const url = new URL(urlString)
Expand Down
Loading