Skip to content

Commit

Permalink
Fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
BrikerMan committed Jul 4, 2021
1 parent 904f7a0 commit 1187bcd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ jobs:
strategy:
matrix:
group: [ 1, 2, 3, 4, 5, 6 ]
tensorflow_version:
- tensorflow>=2.2.0,<2.3.0
- tensorflow>=2.3.0,<2.4.0
- tensorflow>=2.4.0,<2.5.0
- tensorflow>=2.5.0,<2.6.0
tensorflow_version: [2.2, 2.3, 2.4, 2.5]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
Expand All @@ -49,8 +45,8 @@ jobs:
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install '${{ matrix.tensorflow_version }}'
python scripts/install_addons.py
python scripts/install_tf.py '${{ matrix.tensorflow_version }}'
python scripts/install_addons.py '${{ matrix.tensorflow_version }}'
pip install -r requirements.dev.txt
pip install -r requirements.txt
Expand Down
19 changes: 6 additions & 13 deletions scripts/install_addons.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import os
from distutils.version import LooseVersion
from importlib.metadata import version
import sys

tf_version = LooseVersion(version('tensorflow'))

print(f'TF version: {tf_version}')

addons_version = ''
tf_version = str(sys.argv[1])

# TF 2.0, 2.1
if tf_version < LooseVersion('2.2.0'):
if tf_version in ['2.0', '2.1']:
addons_version = '0.9.1'
# TF 2.2
elif tf_version < LooseVersion('2.3.0'):
elif tf_version == '2.2':
addons_version = '0.11.2'
# TF 2.3+
elif tf_version < LooseVersion('2.6.0'):
if tf_version in ['2.3', '2.4', '2.5']:
addons_version = '0.13.0'
else:
print(f'New Version, {tf_version}.')

if addons_version:
print(f'Should Install tensorflow-addons=={addons_version}')
os.system(f"pip install tensorflow-addons=={addons_version}")
os.system(f"pip install 'tensorflow-addons=={addons_version}'")
12 changes: 12 additions & 0 deletions scripts/install_tf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
import sys

tf_args = str(sys.argv[1])
major_version, minor_version = tf_args.split('.')

command = (
f"pip install 'tensorflow>={major_version}.{minor_version}.0,"
f"<{major_version}.{int(minor_version)+1}.0'"
)
print(command)
os.system(command)

0 comments on commit 1187bcd

Please sign in to comment.