Skip to content

Commit

Permalink
Merge pull request #60 from deel-ai/feat/ci_multiple_tf_versions
Browse files Browse the repository at this point in the history
CI updates (tox + Github workflows)
  • Loading branch information
thib-s authored Nov 3, 2022
2 parents 7f40676 + 341bae2 commit b4210f7
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 31 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/python-linters.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
name: deel-lip linters

on: [push, pull_request]
on:
push:
branches:
- master
- develop
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, "3.10"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: deel-lip tests

on: [push, pull_request]
on:
push:
branches:
- master
- develop
pull_request:
schedule:
- cron: "0 2 * * 0" # Run tests every Sunday at 2am

jobs:
checks:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
include:
- python-version: 3.7
tf-version: 2.3
- python-version: 3.9
tf-version: 2.7
- python-version: "3.10"
tf-version: latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)
- name: Test with tox (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .)
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ Before opening a pull request, please make sure you check your code and you run
unit tests:

```bash
# Using make:
$ make test

# Or using directly tox in your development environment:
$ tox
```

This command will:
- check your code with black PEP-8 formatter and flake8 linter.
- run `unittest` on the `tests/` folder with Python 3.6, 3.7 and 3.8.
> Note: If you do not have those 3 interpreters, the tests will only be only performed
with your current interpreter.
- run `unittest` on the `tests/` folder with different Python and TensorFlow versions.


## Submitting your changes
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include deel/lip/VERSION
include LICENSE
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ prepare-dev:
. deel_lip_dev_env/bin/activate && pip install -e .[docs]

test:
. deel_lip_dev_env/bin/activate && tox
. deel_lip_dev_env/bin/activate && tox -e py37-tf23
. deel_lip_dev_env/bin/activate && tox -e py39-tf27
. deel_lip_dev_env/bin/activate && tox -e py310-tflatest
. deel_lip_dev_env/bin/activate && tox -e py310-lint

test-disable-gpu:
. deel_lip_dev_env/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox
. deel_lip_dev_env/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox -e py37-tf23
. deel_lip_dev_env/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox -e py39-tf27
. deel_lip_dev_env/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox -e py310-tflatest
. deel_lip_dev_env/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox -e py310-lint

doc:
. deel_lip_dev_env/bin/activate && cd doc && make html && cd -
Expand Down
1 change: 1 addition & 0 deletions deel/lip/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.0
6 changes: 6 additions & 0 deletions deel/lip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# rights reserved. DEEL is a research program operated by IVADO, IRT Saint Exupéry,
# CRIAQ and ANITI - https://www.deel.ai/
# =====================================================================================

from os import path

with open(path.join(path.dirname(__file__), "VERSION")) as f:
__version__ = f.read().strip()

from . import activations
from . import callbacks
from . import constraints
Expand Down
6 changes: 4 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# import guzzle_sphinx_theme
import sphinx_rtd_theme
# import sphinx_rtd_theme
from deel.lip import __version__

# -- Project information -----------------------------------------------------

Expand All @@ -31,7 +32,8 @@
)

# The full version, including alpha/beta/rc tags
release = "1.3.0"
version = __version__
release = version

# -- General configuration ---------------------------------------------------

Expand Down
16 changes: 13 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ max-line-length = 88
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203, E231
per-file-ignores =
per-file-ignores =
*/__init__.py: F401

[tox:tox]
envlist = py{36,37,38},py{36,37,38}-lint
envlist = py{37,38,39,310}-tf{22,23,24,25,26,27,28,29,latest},py{37,38,39,310}-lint

[testenv]
deps =
packaging
tf22: protobuf == 3.20.3
tf22: tensorflow ~= 2.2.0
tf23: tensorflow ~= 2.3.0
tf24: tensorflow ~= 2.4.0
tf25: tensorflow ~= 2.5.0
tf26: tensorflow ~= 2.6.0
tf27: tensorflow ~= 2.7.0
tf28: tensorflow ~= 2.8.0
tf29: tensorflow ~= 2.9.0
commands =
python -m unittest

[testenv:py{36,37,38}-lint]
[testenv:py{37,38,39,310}-lint]
skip_install = true
deps =
black
Expand Down
13 changes: 9 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()

with open(path.join(this_directory, "deel/lip/VERSION")) as f:
version = f.read().strip()

dev_requires = [
"tox",
"black",
Expand All @@ -30,7 +33,7 @@

setuptools.setup(
name="deel-lip",
version="1.3.0",
version=version,
author=", ".join(["Mathieu SERRURIER", "Franck MAMALET", "Thibaut BOISSIN"]),
author_email=", ".join(
[
Expand All @@ -44,16 +47,18 @@
long_description_content_type="text/markdown",
url="https://github.com/deel-ai/deel-lip",
packages=setuptools.find_namespace_packages(include=["deel.*"]),
install_requires=["numpy", "tensorflow>=2,<3"],
include_package_data=True,
install_requires=["numpy", "tensorflow~=2.2"],
license="MIT",
extras_require={"dev": dev_requires, "docs": docs_requires},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
python_requires=">=3.7",
)
5 changes: 4 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""These tests assert that deel.lip Sequential and Model objects behave as expected."""

import warnings
from packaging import version
from unittest import TestCase
import numpy as np
import tensorflow as tf
Expand Down Expand Up @@ -98,11 +99,13 @@ def test_warning_unsupported_1Lip_layers(self):
kl.MaxPool2D(pool_size=3, strides=2),
kl.Add(),
kl.Concatenate(),
kl.Activation("gelu"),
kl.Dense(5),
kl.Conv2D(10, 3),
kl.UpSampling2D(),
]
if version.parse(tf.__version__) >= version.parse("2.4.0"):
unsupported_layers.append(kl.Activation("gelu"))

for lay in unsupported_layers:
with self.assertWarnsRegex(
Warning,
Expand Down

0 comments on commit b4210f7

Please sign in to comment.