Skip to content

Commit 5157768

Browse files
Move nightly publishing tests and release branch tests to github actions (#8555)
[Example nightly release and publish test](https://github.com/mattsoulanille/tfjs/actions/runs/14672995746/job/41183624273) [Example release PR test](https://github.com/mattsoulanille/tfjs/actions/runs/14674243426/job/41187438555?pr=1)
1 parent dc72617 commit 5157768

File tree

19 files changed

+534
-208
lines changed

19 files changed

+534
-208
lines changed

.bazelrc

+1
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.
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
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

e2e/custom_module/blazeface/yarn.lock

+4-4
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

+4-4
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

+4-4
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

+2-1
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

+1
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,

e2e/script_tag_tests/tfjs/karma.conf.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = function(config) {
2424

2525
const devConfig = {
2626
frameworks: ['jasmine'],
27+
singleRun: true,
2728
files: [
2829
{
2930
pattern: tfjsBundlePath,

e2e/scripts/create-python-models.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ cd integration_tests
2323

2424
source ../scripts/setup-py-env.sh --dev
2525

26-
parallel ::: 'echo "Load equivalent keras models and generate outputs." && python create_save_predict.py' \
27-
'echo "Create saved models and convert." && python convert_predict.py' \
28-
'echo "Convert model with user defined metadata." && python metadata.py'
26+
echo "Load equivalent keras models and generate outputs."
27+
python create_save_predict.py
28+
29+
echo "Create saved models and convert."
30+
python convert_predict.py
31+
32+
echo "Convert model with user defined metadata."
33+
python metadata.py
2934

3035
# Cleanup python env.
3136
source ../scripts/cleanup-py-env.sh

e2e/scripts/run-browserstack-tests.sh

-53
This file was deleted.

e2e/scripts/run-custom-builds.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@
1515
# limitations under the License.
1616
# ==============================================================================
1717

18+
set -e
19+
1820
# Start in scripts/ even if run from root directory
1921
cd "$(dirname "$0")"
2022

23+
2124
# Go to e2e root
2225
cd ..
2326

24-
parallel ::: 'cd custom_module/blazeface && ./build.sh' \
25-
'cd custom_module/dense_model && ./build.sh' \
26-
'cd custom_module/universal_sentence_encoder && ./build.sh'
27+
echo "Building blazeface..."
28+
(cd custom_module/blazeface && ./build.sh)
29+
30+
echo "Building dense_model..."
31+
(cd custom_module/dense_model && ./build.sh)
32+
33+
echo "Building universal_sentence_encoder..."
34+
(cd custom_module/universal_sentence_encoder && ./build.sh)

e2e/scripts/setup-py-env.sh

+4-7
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ if [[ -z "${DEV_VERSION}" ]]; then
3737
fi
3838

3939
VENV_DIR="$(mktemp -d)_venv"
40-
echo "Creating virtualenv at ${VENV_DIR} ..."
41-
PLATFORM="$(python -m platform)"
42-
if [[ $PLATFORM =~ "Windows" ]]
43-
then
44-
python -m virtualenv -p python3 "${VENV_DIR}"
45-
source "${VENV_DIR}/Scripts/activate"
40+
echo "Creating venv at ${VENV_DIR} ..."
41+
if ! which virtualenv > /dev/null 2>&1; then
42+
python3 -m venv "${VENV_DIR}"
4643
else
4744
virtualenv -p python3 "${VENV_DIR}"
48-
source "${VENV_DIR}/bin/activate"
4945
fi
46+
source "${VENV_DIR}/bin/activate"
5047

5148
# Install python packages.
5249
if [[ "${DEV_VERSION}" == "stable" ]]; then

e2e/scripts/test-ci.sh

+15-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@
1414
# limitations under the License.
1515
# ==============================================================================
1616

17-
set -e
17+
set -euxo pipefail
1818

1919
# Generate custom bundle files and model files for tests
20-
parallel ::: ./scripts/run-custom-builds.sh \
21-
./scripts/create-python-models.sh
20+
./scripts/run-custom-builds.sh
21+
./scripts/create-python-models.sh
2222

23-
# Run browserstack tests (and webpack test)
24-
parallel ::: ./scripts/run-browserstack-tests.sh \
25-
"cd webpack_test && yarn --mutex network && yarn build"
23+
TAGS='#SMOKE,#REGRESSION,#GOLDEN'
24+
25+
# Test with smoke/regression tests.
26+
yarn karma start --single-run --tags "${TAGS}"
27+
28+
# Test script tag bundles
29+
# Temporarily disabled
30+
# yarn karma start --single-run ./script_tag_tests/tfjs/karma.conf.js --testBundle tf.min.js --tags "${TAGS}"
31+
# yarn karma start --single-run ./script_tag_tests/tfjs-core-cpu/karma.conf.js --tags "${TAGS}"
32+
33+
# Test webpack
34+
(cd webpack_test && yarn --mutex network && yarn build)

e2e/webpack_test/yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@
222222
"@webassemblyjs/ast" "1.11.1"
223223
"@xtuc/long" "4.2.2"
224224

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

230230
"@webpack-cli/configtest@^1.0.4":
231231
version "1.0.4"

0 commit comments

Comments
 (0)