Skip to content

Commit 27b7c80

Browse files
committed
Update releasing instructions
1 parent 89fa9ff commit 27b7c80

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

RELEASING.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Note that any crate not mentioned here (e.g. tensorflow-proto-codegen, tensorflo
3636
1. Bump the version for `tensorflow-internal-macros` in the root `Cargo.toml`
3737
1. Bump the version number in `Cargo.toml`
3838
1. Bump the version number in `README.md`
39-
1. Run `./test-all`
39+
1. Inside a virtualenv, run `./test-all`. (See "Running in a virtualenv" section.)
4040
1. Double-check that addition.py is built using the version of TensorFlow being linked against. (See "Upgrading TensorFlow" section.)
4141
1. Run `./run-valgrind`
4242
1. Commit and push the changes. (Push before publishing to ensure that the changes being published are up to date.)
@@ -56,13 +56,12 @@ Note that any crate not mentioned here (e.g. tensorflow-proto-codegen, tensorflo
5656
## Upgrading TensorFlow
5757

5858
1. Update version and tag in tensorflow-sys/build.rs
59-
1. Update version in run-valgrind
60-
1. Run `python examples/addition/addition.py` using the version of TensorFlow being linked against.
61-
(Use pip in a virtualenv, see https://www.tensorflow.org/install/pip#2-create-a-virtual-environment-recommended)
62-
1. Run `virtualenv --system-site-packages -p python3 ~/tensorflow-${TENSORFLOW_VERSION?}`
63-
1. Run `source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate` to activate the virtualenv
64-
1. Run `pip install --upgrade pip`
65-
1. Run `pip install --upgrade tensorflow==${TENSORFLOW_VERSION?}`
66-
1. Run `pip install tf_keras` (required for examples/mobilenetv3)
67-
1. Run `python examples/addition/addition.py`
68-
1. Run `deactivate` to exit the virtualenv
59+
1. Update version in .github/workflow/requirements.txt
60+
1. Inside a virtualenv using the version of TensorFlow being linked against, run `python examples/addition/addition.py`. (See "Running in a virtualenv" section.)
61+
62+
## Running in a virtualenv
63+
64+
1. If you haven't set it up, run `./create-virtualenv ${TENSORFLOW_VERSION?}`
65+
1. Run `source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate` to activate the virtualenv
66+
1. Do whatever you need to do in the virtual env
67+
1. Run `deactivate` to exit the virtualenv

create-virtualenv

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# See https://www.tensorflow.org/install/pip#2-create-a-virtual-environment-recommended
4+
5+
set -euo pipefail
6+
7+
if [ "$#" -lt 1 ]; then
8+
echo "Expected first argument to be TensorFlow version"
9+
exit 1
10+
fi
11+
TENSORFLOW_VERSION="$1"
12+
13+
function run {
14+
echo "----------------------------------------------------------------------"
15+
echo "Running: $@"
16+
"$@"
17+
echo
18+
}
19+
20+
run virtualenv --system-site-packages -p python3 ~/tensorflow-${TENSORFLOW_VERSION?}
21+
run source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate
22+
run pip install --upgrade pip
23+
run pip install --upgrade tensorflow==${TENSORFLOW_VERSION?}
24+
run pip install tf_keras # required for examples/mobilenetv3
25+
run deactivate

run-valgrind

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ function run {
1919
echo
2020
}
2121

22-
tensorflow_version=2.16.1
23-
2422
valgrind_log=valgrind.log
2523
truncate --size=0 "$valgrind_log"
2624

test-all

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ function run {
1212
# Make sure the Tensorflow version in the -sys build script matches the one in
1313
# the run-valgrind script.
1414
version_build_script=`grep "const VERSION" tensorflow-sys/build.rs | sed 's|.*"\([^"]*\)";|\1|g'`
15-
version_run_valgrind=`grep "tensorflow_version=" run-valgrind | sed "s|.*=\(.*\)|\1|g"`
1615
version_requirements=`grep "tensorflow\s*=" .github/workflows/requirements.txt | sed "s|.*== \(.*\)|\1|g"`
17-
if [[ "${version_build_script}" != "${version_run_valgrind}" || \
18-
"${version_build_script}" != "${version_requirements}" ]]; then
19-
echo "ERROR: Tensorflow version specified in build script does not match the one in the"
20-
echo " valgrind run script."
16+
if [[ "${version_build_script}" != "${version_requirements}" ]]; then
17+
echo "ERROR: TensorFlow version specified in build script does not match the one in the"
18+
echo " GitHub requirements."
2119
echo " tensorflow-sys/build.rs: ${version_build_script}"
22-
echo " run-valgrind: ${version_run_valgrind}"
2320
echo " .github/workflows/requirements.txt: ${version_requirements}"
2421
exit 1
2522
fi

0 commit comments

Comments
 (0)