Skip to content

Commit 591a1c9

Browse files
Merge branch 'master' into add-napi-v9-support
2 parents d178360 + 5157768 commit 591a1c9

File tree

35 files changed

+724
-236
lines changed

35 files changed

+724
-236
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ build:rbe --config=remote
4646
# Config for Google Cloud continuous integration that uses default credentials.
4747
build:ci --config=bes
4848

49+
4950
# This flag is needed to prevent the bazel cache from being invalidated when
5051
# running bazel via `yarn bazel`.
5152
# See https://github.com/angular/angular/issues/27514.

.github/workflows/tfjs-ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: TFJS Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: bazel-contrib/[email protected]
18+
with:
19+
# Avoid downloading Bazel every time.
20+
bazelisk-cache: true
21+
# Store build cache per workflow.
22+
disk-cache: ${{ github.workflow }}-cpu
23+
# Share repository cache between workflows.
24+
repository-cache: true
25+
- uses: actions/checkout@v4
26+
- name: Test TFJS CPU
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20.x
30+
cache: 'npm'
31+
- run: npm i -g yarn
32+
- run: yarn install
33+
- run: yarn test-cpu
34+
35+
test-gpu-mac:
36+
runs-on: macos-latest-xlarge # consumer gpu
37+
steps:
38+
- uses: bazel-contrib/[email protected]
39+
with:
40+
# Avoid downloading Bazel every time.
41+
bazelisk-cache: true
42+
# Store build cache per workflow.
43+
disk-cache: ${{ github.workflow }}-gpu-mac
44+
# Share repository cache between workflows.
45+
repository-cache: true
46+
- uses: actions/checkout@v4
47+
- name: Test TFJS GPU
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20.x
51+
cache: 'npm'
52+
- run: npm i -g yarn
53+
- run: yarn install
54+
- run: yarn test-gpu
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: TFJS Nightly Release and Publish Test
2+
3+
on:
4+
schedule:
5+
- cron: '0 5 * * *' # Runs daily at 5:00 AM UTC
6+
workflow_dispatch: # Allows manual triggering
7+
8+
permissions:
9+
contents: read # Default permissions, adjust if the script needs to write to the repo
10+
11+
jobs:
12+
nightly_release_verification:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bazel
19+
uses: bazel-contrib/[email protected]
20+
with:
21+
bazelisk-cache: true
22+
disk-cache: ${{ github.workflow }}-nightly-release
23+
repository-cache: true
24+
25+
- name: Setup Node.js and Yarn
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20.x # Using a current LTS version of Node.js
29+
cache: 'yarn'
30+
31+
- name: Install Yarn globally (if not already cached by setup-node with yarn cache)
32+
run: npm i -g yarn
33+
34+
- name: Install top-level dependencies
35+
run: yarn install --frozen-lockfile
36+
37+
- name: Run Nightly Verdaccio Test Script
38+
env:
39+
RELEASE: 'true' # Set RELEASE to true as in the original config
40+
run: |
41+
set -eEuo pipefail
42+
yarn release-tfjs --dry --guess-version release --use-local-changes --force
43+
# The original script changes directory to a temporary location created by the release script.
44+
# This assumes /tmp/ is accessible and the path structure is consistent.
45+
# If release-e2e.sh is relative to the checkout root after the release script prep, adjust path.
46+
if [ -d "/tmp/tfjs-release/tfjs/e2e/" ]; then
47+
cd /tmp/tfjs-release/tfjs/e2e/
48+
bash scripts/release-e2e.sh
49+
else
50+
echo "Error: Expected directory /tmp/tfjs-release/tfjs/e2e/ not found after release script."
51+
exit 1
52+
fi
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: TFJS Release Branch Publish Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'tfjs_**' # Matches branches starting with tfjs_, e.g., tfjs_1.2.3, tfjs_core
7+
workflow_dispatch: # Allows manual triggering
8+
9+
permissions:
10+
contents: read # Default permissions, adjust if the script needs to write to the repo
11+
12+
jobs:
13+
release_e2e_test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Bazel
20+
uses: bazel-contrib/[email protected]
21+
with:
22+
bazelisk-cache: true
23+
disk-cache: ${{ github.workflow }}-release-e2e
24+
repository-cache: true
25+
26+
- name: Setup Node.js and Yarn
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20.x
30+
cache: 'yarn' # Changed from 'npm' in example to 'yarn' as primary tool here
31+
32+
- name: Install Yarn globally (if not already cached by setup-node with yarn cache)
33+
run: npm i -g yarn
34+
35+
- name: Install top-level dependencies
36+
run: yarn install --frozen-lockfile
37+
38+
- name: Run E2E Release Script
39+
working-directory: ./e2e # Sets the directory for this step
40+
env:
41+
RELEASE: 'true' # Set RELEASE to true as requested
42+
run: bash ./scripts/release-e2e.sh

BUILD.bazel

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,31 @@ headless_flag(
4949
)
5050

5151
test_suite(
52-
name = "tests",
52+
name = "tests_cpu",
5353
tests = [
5454
"//tfjs-backend-cpu:tests",
5555
"//tfjs-backend-wasm:tests",
56-
"//tfjs-backend-webgl:tests",
5756
"//tfjs-converter:tests",
5857
"//tfjs-core:tests",
5958
"//tfjs-data:tests",
60-
"//tfjs-layers:tests",
6159
"//tfjs-tfdf:tests",
6260
"//tfjs-tflite:tests",
6361
],
6462
)
63+
64+
test_suite(
65+
name = "tests_gpu",
66+
tests = [
67+
"//tfjs-backend-webgl:tests",
68+
"//tfjs-backend-webgpu:tests",
69+
"//tfjs-layers:tests",
70+
],
71+
)
72+
73+
test_suite(
74+
name = "tests",
75+
tests = [
76+
":tests_cpu",
77+
":tests_gpu",
78+
],
79+
)

e2e/custom_module/blazeface/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@
366366
"@webassemblyjs/ast" "1.11.1"
367367
"@xtuc/long" "4.2.2"
368368

369-
"@webgpu/[email protected].30":
370-
version "0.1.30"
371-
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.30.tgz#b6406dc4a1c1e0d469028ceb30ddffbbd2fa706c"
372-
integrity sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==
369+
"@webgpu/[email protected].38":
370+
version "0.1.38"
371+
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
372+
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
373373

374374
"@webpack-cli/info@^1.1.0":
375375
version "1.1.0"

e2e/custom_module/dense_model/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@
305305
"@webassemblyjs/ast" "1.11.1"
306306
"@xtuc/long" "4.2.2"
307307

308-
"@webgpu/[email protected].30":
309-
version "0.1.30"
310-
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.30.tgz#b6406dc4a1c1e0d469028ceb30ddffbbd2fa706c"
311-
integrity sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==
308+
"@webgpu/[email protected].38":
309+
version "0.1.38"
310+
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
311+
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
312312

313313
"@webpack-cli/configtest@^1.1.1":
314314
version "1.1.1"

e2e/custom_module/universal_sentence_encoder/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@
305305
"@webassemblyjs/ast" "1.11.1"
306306
"@xtuc/long" "4.2.2"
307307

308-
"@webgpu/[email protected].30":
309-
version "0.1.30"
310-
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.30.tgz#b6406dc4a1c1e0d469028ceb30ddffbbd2fa706c"
311-
integrity sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==
308+
"@webgpu/[email protected].38":
309+
version "0.1.38"
310+
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
311+
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
312312

313313
"@webpack-cli/configtest@^1.1.1":
314314
version "1.1.1"

e2e/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ if (coverageEnabled) {
4040
}
4141

4242
const devConfig = {
43+
singleRun: true,
4344
frameworks: ['jasmine', 'karma-typescript'],
4445
files: [
4546
{pattern: './node_modules/@babel/polyfill/dist/polyfill.js'},
@@ -148,7 +149,7 @@ module.exports = function(config) {
148149
'spec',
149150
'jasmine-order',
150151
],
151-
browsers: ['Chrome'],
152+
browsers: ['ChromeHeadless'],
152153
browserStack: {
153154
username: process.env.BROWSERSTACK_USERNAME,
154155
accessKey: process.env.BROWSERSTACK_KEY,

e2e/script_tag_tests/tfjs-core-cpu/karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = function(config) {
2828

2929
const devConfig = {
3030
frameworks: ['jasmine'],
31+
singleRun: true,
3132
files: [
3233
{
3334
pattern: coreBundlePath,

0 commit comments

Comments
 (0)