Skip to content

Commit 1f36bf7

Browse files
authored
refactor: add deno_lockfile, deno_npm, and eszip to repo (#32085)
1 parent fee3dd9 commit 1f36bf7

File tree

134 files changed

+35320
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+35320
-77
lines changed

.dprint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"cli/tools/doc/prism.js",
4242
"ext/node/polyfills/deps",
4343
"ext/websocket/autobahn/reports",
44+
"libs/eszip/testdata",
4445
"gh-pages",
4546
"libs/config/testdata",
4647
"target",

.github/workflows/ci.generate.ts

Lines changed: 103 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#!/usr/bin/env -S deno run --allow-write=. --lock=./tools/deno.lock.json
1+
#!/usr/bin/env -S deno run --allow-write=. --allow-read=. --lock=./tools/deno.lock.json
22
// Copyright 2018-2026 the Deno authors. MIT license.
33
import { stringify } from "jsr:@std/yaml@^0.221/stringify";
4+
import { parse as parseToml } from "jsr:@std/toml";
45

56
// Bump this number when you want to purge the cache.
67
// Note: the tools/release/01_bump_crate_versions.ts script will update this version
@@ -69,6 +70,31 @@ const Runners = {
6970
},
7071
} as const;
7172

73+
// discover all non-binary, non-test workspace members for the libs test job
74+
const rootCargoToml = parseToml(
75+
Deno.readTextFileSync(new URL("../../Cargo.toml", import.meta.url)),
76+
) as { workspace: { members: string[] } };
77+
78+
const libPackages: string[] = [];
79+
for (const member of rootCargoToml.workspace.members) {
80+
// test crates depend on the deno binary at runtime
81+
if (member.startsWith("tests")) continue;
82+
83+
const cargoToml = parseToml(
84+
Deno.readTextFileSync(
85+
new URL(`../../${member}/Cargo.toml`, import.meta.url),
86+
),
87+
) as { package: { name: string }; bin?: unknown[] };
88+
89+
// skip binary crates (they need their own build step)
90+
if (cargoToml.bin) continue;
91+
92+
libPackages.push(cargoToml.package.name);
93+
}
94+
95+
const libTestPackageArgs = libPackages.map((p) => `-p ${p}`).join(" ");
96+
const libExcludeArgs = libPackages.map((p) => `--exclude ${p}`).join(" ");
97+
7298
const prCacheKeyPrefix =
7399
`${cacheVersion}-cargo-target-\${{ matrix.os }}-\${{ matrix.arch }}-\${{ matrix.profile }}-\${{ matrix.job }}-`;
74100
const prCacheKey = `${prCacheKeyPrefix}\${{ github.sha }}`;
@@ -196,6 +222,25 @@ const submoduleStep = (submodule: string) => ({
196222
const installRustStep = {
197223
uses: "dsherret/rust-toolchain-file@v1",
198224
};
225+
const installLldStep = {
226+
name: "Install macOS aarch64 lld",
227+
if: `matrix.os == 'macos' && matrix.arch == 'aarch64'`,
228+
env: {
229+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
230+
},
231+
run: [
232+
"./tools/install_prebuilt.js ld64.lld",
233+
].join("\n"),
234+
};
235+
const updatePrebuiltGithubPath = {
236+
if: `matrix.os == 'macos'`,
237+
env: {
238+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
239+
},
240+
run: [
241+
"echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH",
242+
].join("\n"),
243+
};
199244
const installPythonSteps = [{
200245
name: "Install Python",
201246
uses: "actions/setup-python@v6",
@@ -560,31 +605,30 @@ const ci = {
560605
name: "Load 'vsock_loopback; kernel module",
561606
run: "sudo modprobe vsock_loopback",
562607
},
563-
{
564-
if:
565-
"(matrix.job == 'test' || matrix.job == 'bench') && !(matrix.os == 'windows' && matrix.arch == 'aarch64')",
566-
...installDenoStep,
567-
},
608+
withCondition(
609+
installDenoStep,
610+
"(matrix.job == 'test' || matrix.job == 'bench') && !(matrix.os == 'windows' && matrix.arch == 'aarch64')",
611+
),
568612
...installPythonSteps.map((s) =>
569613
withCondition(
570614
s,
571615
"matrix.os != 'linux' || matrix.arch != 'aarch64'",
572616
)
573617
),
574-
{
575-
if: "matrix.job == 'bench' || matrix.job == 'test'",
576-
...installNodeStep,
577-
},
578-
{
579-
if: [
618+
withCondition(
619+
installNodeStep,
620+
"matrix.job == 'bench' || matrix.job == 'test'",
621+
),
622+
withCondition(
623+
authenticateWithGoogleCloud,
624+
[
580625
"matrix.profile == 'release' &&",
581626
"matrix.job == 'test' &&",
582627
"github.repository == 'denoland/deno' &&",
583628
"(github.ref == 'refs/heads/main' ||",
584629
"startsWith(github.ref, 'refs/tags/'))",
585630
].join("\n"),
586-
...authenticateWithGoogleCloud,
587-
},
631+
),
588632
{
589633
name: "Setup gcloud (unix)",
590634
if: [
@@ -643,27 +687,16 @@ const ci = {
643687
].join("\n"),
644688
if: `matrix.os == 'macos'`,
645689
},
646-
{
647-
name: "Install macOS aarch64 lld",
648-
env: {
649-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
650-
},
651-
run: [
652-
"./tools/install_prebuilt.js ld64.lld",
653-
].join("\n"),
654-
if: `matrix.os == 'macos' && matrix.arch == 'aarch64'`,
655-
},
690+
installLldStep,
656691
{
657692
name: "Install rust-codesign",
658693
env: {
659694
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
660695
},
661-
run: [
662-
"./tools/install_prebuilt.js rcodesign",
663-
"echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH",
664-
].join("\n"),
696+
run: "./tools/install_prebuilt.js rcodesign",
665697
if: `matrix.os == 'macos'`,
666698
},
699+
updatePrebuiltGithubPath,
667700
{
668701
name: "Log versions",
669702
run: [
@@ -955,7 +988,8 @@ const ci = {
955988
// Run full tests only on Linux.
956989
"matrix.os == 'linux'",
957990
].join("\n"),
958-
run: "cargo test --locked --features=panic-trace",
991+
run:
992+
`cargo test --workspace --locked ${libExcludeArgs} --features=panic-trace`,
959993
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
960994
},
961995
{
@@ -968,8 +1002,8 @@ const ci = {
9681002
run: [
9691003
// Run unit then integration tests. Skip doc tests here
9701004
// since they are sometimes very slow on Mac.
971-
"cargo test --locked --lib --features=panic-trace",
972-
"cargo test --locked --tests --features=panic-trace",
1005+
`cargo test --workspace --locked ${libExcludeArgs} --lib --features=panic-trace`,
1006+
`cargo test --workspace --locked ${libExcludeArgs} --tests --features=panic-trace`,
9731007
].join("\n"),
9741008
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
9751009
},
@@ -982,7 +1016,8 @@ const ci = {
9821016
"github.repository == 'denoland/deno' &&",
9831017
"!startsWith(github.ref, 'refs/tags/')))",
9841018
].join("\n"),
985-
run: "cargo test --release --locked --features=panic-trace",
1019+
run:
1020+
`cargo test --workspace --release --locked ${libExcludeArgs} --features=panic-trace`,
9861021
},
9871022
{
9881023
name: "Ensure no git changes",
@@ -1291,31 +1326,60 @@ const ci = {
12911326
],
12921327
},
12931328
libs: {
1294-
name: "build libs",
1329+
name: "libs ${{ matrix.profile }} ${{ matrix.os }}-${{ matrix.arch }}",
12951330
needs: ["pre_build"],
12961331
if: "${{ needs.pre_build.outputs.skip_build != 'true' }}",
1297-
"runs-on": ubuntuX86Runner,
1332+
"runs-on": "${{ matrix.runner }}",
12981333
"timeout-minutes": 30,
1334+
strategy: {
1335+
matrix: {
1336+
include: [{
1337+
...Runners.linuxX86,
1338+
profile: "debug",
1339+
job: "libs",
1340+
}, {
1341+
...Runners.macosArm,
1342+
profile: "debug",
1343+
job: "libs",
1344+
}, {
1345+
...Runners.windowsX86,
1346+
profile: "debug",
1347+
job: "libs",
1348+
}],
1349+
},
1350+
},
12991351
steps: skipJobsIfPrAndMarkedSkip([
13001352
...cloneRepoSteps,
1353+
submoduleStep("./tests/util/std"),
1354+
cacheCargoHomeStep,
13011355
installRustStep,
1356+
{
1357+
if: "matrix.os == 'macos'",
1358+
...installDenoStep,
1359+
},
1360+
installLldStep,
1361+
updatePrebuiltGithubPath,
13021362
{
13031363
name: "Install wasm target",
1364+
if: "matrix.os == 'linux'",
13041365
run: "rustup target add wasm32-unknown-unknown",
13051366
},
13061367
// we want these crates to be Wasm compatible
13071368
{
13081369
name: "Cargo check (deno_resolver)",
1370+
if: "matrix.os == 'linux'",
13091371
run:
13101372
"cargo check --target wasm32-unknown-unknown -p deno_resolver && cargo check --target wasm32-unknown-unknown -p deno_resolver --features graph && cargo check --target wasm32-unknown-unknown -p deno_resolver --features graph --features deno_ast",
13111373
},
13121374
{
13131375
name: "Cargo check (deno_npm_installer)",
1376+
if: "matrix.os == 'linux'",
13141377
run:
13151378
"cargo check --target wasm32-unknown-unknown -p deno_npm_installer",
13161379
},
13171380
{
13181381
name: "Cargo check (deno_config)",
1382+
if: "matrix.os == 'linux'",
13191383
run: [
13201384
"cargo check --no-default-features -p deno_config",
13211385
"cargo check --no-default-features --features workspace -p deno_config",
@@ -1325,6 +1389,11 @@ const ci = {
13251389
"cargo check -p deno --features=lsp-tracing",
13261390
].join("\n"),
13271391
},
1392+
{
1393+
name: "Test libs",
1394+
run: `cargo test --locked ${libTestPackageArgs}`,
1395+
env: { CARGO_PROFILE_DEV_DEBUG: 0 },
1396+
},
13281397
]),
13291398
},
13301399
"publish-canary": {

0 commit comments

Comments
 (0)