Skip to content

Commit

Permalink
refactor(tensorflow-cpu): use variable for py version
Browse files Browse the repository at this point in the history
Signed-off-by: Massimiliano Giovagnoli <[email protected]>
  • Loading branch information
maxgio92 committed Jan 8, 2025
1 parent bcc0aa4 commit 9b9c7df
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions tensorflow-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ package:
- build-base
- curl
- pkgconf
- py3.11-pip
- python-3.11
- py${{vars.py-version}}-pip
- python-${{vars.py-version}}-dev
- unzip

vars:
pypi-package: tensorflow
py-version: 3.11
pypi-package: tensorflow-cpu
prefix: /usr

environment:
contents:
packages:
- build-base
- busybox
- py3.11-pip
- python-3.11
- py${{vars.py-version}}-pip
- python-${{vars.py-version}}
environment:
# This is needed to work around the error "ValueError: ZIP does not support timestamps before 1980"
SOURCE_DATE_EPOCH: 315532800
Expand All @@ -44,21 +45,21 @@ pipeline:
pipeline:
- name: Install cpu requirements
runs: |
python3 -m pip install \
pip${{vars.py-version}} install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
-r cpu.requirements.txt
- name: Install Tensorflow
runs: |
python3 -m pip install \
pip${{vars.py-version}} install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
${{vars.pypi-package}}
- name: Install jupyter requirements
runs: |
python3 -m pip install \
pip${{vars.py-version}} install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
Expand All @@ -83,8 +84,10 @@ test:
- curl
pipeline:
- name: Test import of IPython kernel for Jupyter
runs: |
python3 -m ipykernel.kernelspec
uses: python/import
with:
imports: |
import ipykernel.kernelspec
- name: Test Tensorflow library
runs: |
cat <<"EOF" >test.py
Expand All @@ -105,14 +108,15 @@ test:
c = tf.add(a, b)
print("Result of addition:", c.numpy())
EOF
python test.py
python${{vars.py-version}} test.py
- name: Test Juputer notebook run
runs: |
jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root >/dev/null 2>&1 &
pid=$!
sleep 5
curl --fail --location --request GET --head --silent localhost:8888
kill $pid
- runs: python${{vars.py-version}} -m pip --version

update:
enabled: true
Expand Down

0 comments on commit 9b9c7df

Please sign in to comment.