From 813248702317964fb25c951eef40e7fef65a6c02 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:05:19 -0700 Subject: [PATCH 01/37] adding github action file --- .github/workflows/python-package.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..c71c354 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From c9c5f6a09c85922cf5a2e1e90d33b72ff7afe690 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:12:52 -0700 Subject: [PATCH 02/37] adding github action that does the same thing as travis --- .github/workflows/python-package.yml | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c71c354..d493bd3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,25 +15,30 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.8] steps: - - uses: actions/checkout@v2 + - name: Checking out code + uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install package and dependencies run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + python setup.py develop + - name: Dependencies needed for coverage and unit tests run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + conda install matplotlib + pip install tqdm + pip install tensorboardX cox requests + pip install advertorch copt + pip install git+https://github.com/RobustBench/robustbench + pip install coveralls coverage pytest-cov + - name: Dependencies needed for sphinx run: | - pytest + pip install sphinx sphinx-gallery + pip install memory_profiler + - name: Running unit tests + run: | + py.test -v --cov=chop From 417cd2d197a67a8561f74657e54b41985de9df52 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:16:52 -0700 Subject: [PATCH 03/37] adding dill dependency for testing --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d493bd3..619bb7e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,6 +31,7 @@ jobs: run: | conda install matplotlib pip install tqdm + pip install dill pip install tensorboardX cox requests pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench From 10d5971acab656c4cc3103ecb871ede1641ace61 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:19:22 -0700 Subject: [PATCH 04/37] adding code coverage --- .github/workflows/python-package.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 619bb7e..a8c0b2a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,7 +31,7 @@ jobs: run: | conda install matplotlib pip install tqdm - pip install dill + pip install pip install tensorboardX cox requests pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench @@ -43,3 +43,7 @@ jobs: - name: Running unit tests run: | py.test -v --cov=chop + - name: Publishing code coverage + run: | + coveralls + From 9e5ad24bfe1e894961eb4818c245a486e44a55b8 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:43:28 -0700 Subject: [PATCH 05/37] intalling miniconda --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a8c0b2a..7290ea5 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,6 +24,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Installing miniconda + uses: conda-incubator/setup-miniconda@v2 - name: Install package and dependencies run: | python setup.py develop From ba04b89e2d350577496e978ea1752aefe795670e Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:46:03 -0700 Subject: [PATCH 06/37] setting up conda env --- .github/workflows/python-package.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7290ea5..ab2a429 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,12 +20,11 @@ jobs: steps: - name: Checking out code uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - name: Installing miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v2\ + activate-environment: conda_env_${{ matrix.python-version }} + environment-file: etc/example-environment.yml + python-version: ${{ matrix.python-version }} - name: Install package and dependencies run: | python setup.py develop From 1f9daeea818a601cafc11ffccb3ada02714cf7ed Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:48:31 -0700 Subject: [PATCH 07/37] adding conda specific values --- .github/workflows/python-package.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ab2a429..a8427dd 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -21,10 +21,11 @@ jobs: - name: Checking out code uses: actions/checkout@v2 - name: Installing miniconda - uses: conda-incubator/setup-miniconda@v2\ - activate-environment: conda_env_${{ matrix.python-version }} - environment-file: etc/example-environment.yml - python-version: ${{ matrix.python-version }} + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: conda_env_${{ matrix.python-version }} + environment-file: etc/example-environment.yml + python-version: ${{ matrix.python-version }} - name: Install package and dependencies run: | python setup.py develop From 6c7a1a94644b836f346e9ff9e63ced21c62889cb Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:49:46 -0700 Subject: [PATCH 08/37] refering to correct env variable --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a8427dd..dfbf80e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -23,8 +23,8 @@ jobs: - name: Installing miniconda uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: conda_env_${{ matrix.python-version }} - environment-file: etc/example-environment.yml + activate-environment: chop # environment name is definded in environment.yml + environment-file: environment.yml python-version: ${{ matrix.python-version }} - name: Install package and dependencies run: | From 98c7e4cf2bc0554d0dea4cd77e1eeaabeeacee31 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 21:57:41 -0700 Subject: [PATCH 09/37] adding sudo --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index dfbf80e..2e6def4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install package and dependencies run: | - python setup.py develop + sudo python setup.py develop - name: Dependencies needed for coverage and unit tests run: | conda install matplotlib From 067fe28a63a8039ed84aea4fb0539974fdc3069a Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:05:10 -0700 Subject: [PATCH 10/37] adding cache and removing tqdm install --- .github/workflows/python-package.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2e6def4..8f04e41 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,6 +20,16 @@ jobs: steps: - name: Checking out code uses: actions/checkout@v2 + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if etc/example-environment.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('etc/example-environment.yml') }} - name: Installing miniconda uses: conda-incubator/setup-miniconda@v2 with: @@ -32,7 +42,6 @@ jobs: - name: Dependencies needed for coverage and unit tests run: | conda install matplotlib - pip install tqdm pip install pip install tensorboardX cox requests pip install advertorch copt From b30462c24d76582afcae1ab1b39862fd035b0bc6 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:10:48 -0700 Subject: [PATCH 11/37] adding cache --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8f04e41..4f098b0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,7 +29,7 @@ jobs: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('etc/example-environment.yml') }} + hashFiles('environment.yml') }} - name: Installing miniconda uses: conda-incubator/setup-miniconda@v2 with: From 2e4b0cfb1c69c536258ae0c10942a233d5892ecd Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:28:48 -0700 Subject: [PATCH 12/37] installing matplotlib with conda --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4f098b0..1e7a490 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,7 +41,7 @@ jobs: sudo python setup.py develop - name: Dependencies needed for coverage and unit tests run: | - conda install matplotlib + pip install matplotlib pip install pip install tensorboardX cox requests pip install advertorch copt From 37d9607f116097e2f34b21bbb91851aea72b8d3d Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:40:31 -0700 Subject: [PATCH 13/37] removing empty pip step --- .github/workflows/python-package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1e7a490..8944040 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -42,7 +42,6 @@ jobs: - name: Dependencies needed for coverage and unit tests run: | pip install matplotlib - pip install pip install tensorboardX cox requests pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench From b6c035479f2bca30112937bd2ade224b85108b3e Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:40:52 -0700 Subject: [PATCH 14/37] adding back tqdm --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8944040..5d42e8d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -42,6 +42,7 @@ jobs: - name: Dependencies needed for coverage and unit tests run: | pip install matplotlib + pip install tqdm pip install tensorboardX cox requests pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench From 268d5b19daac3dabc1679f69f1d092eb3b76335b Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:51:19 -0700 Subject: [PATCH 15/37] using pytest --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5d42e8d..7e33e6e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -53,7 +53,7 @@ jobs: pip install memory_profiler - name: Running unit tests run: | - py.test -v --cov=chop + pytest -v --cov=chop - name: Publishing code coverage run: | coveralls From ec19fbce2cfceef0a718c5eb413c66a9f38f5748 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 22:58:32 -0700 Subject: [PATCH 16/37] running pytest as a python module --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7e33e6e..7ca2a8a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -53,7 +53,7 @@ jobs: pip install memory_profiler - name: Running unit tests run: | - pytest -v --cov=chop + python -m pytest -v --cov=chop - name: Publishing code coverage run: | coveralls From 6428dae730b8b2d489fadea1daa4e03e9e0bddf0 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Mon, 22 Mar 2021 23:04:45 -0700 Subject: [PATCH 17/37] insalling dill --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7ca2a8a..e9f171f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -47,6 +47,7 @@ jobs: pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench pip install coveralls coverage pytest-cov + pip install dill - name: Dependencies needed for sphinx run: | pip install sphinx sphinx-gallery From 6933b8a7f22e9d4c581980e241282b5c0ff01e68 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 10:23:30 -0700 Subject: [PATCH 18/37] adding conda commands --- .github/workflows/python-package.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e9f171f..bef33ed 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,6 +30,13 @@ jobs: key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} + - name: Running conda commands + run: | + echo $CONDA_DEFAULT_ENV + conda env list + pwd + python --version + which python - name: Installing miniconda uses: conda-incubator/setup-miniconda@v2 with: From 484f7712d99adb323db3dae06cdb5eb2a3548185 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 10:24:57 -0700 Subject: [PATCH 19/37] conda commands --- .github/workflows/python-package.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bef33ed..78a7ab3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,6 +30,12 @@ jobs: key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} + - name: Installing miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: chop # environment name is definded in environment.yml + environment-file: environment.yml + python-version: ${{ matrix.python-version }} - name: Running conda commands run: | echo $CONDA_DEFAULT_ENV @@ -37,12 +43,6 @@ jobs: pwd python --version which python - - name: Installing miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: chop # environment name is definded in environment.yml - environment-file: environment.yml - python-version: ${{ matrix.python-version }} - name: Install package and dependencies run: | sudo python setup.py develop From 23f38e39596d2f42fc0a195db61535fd2bdee049 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 10:37:03 -0700 Subject: [PATCH 20/37] adding new steps --- .github/workflows/python-package.yml | 20 ++++++++++++++------ environment.yml | 6 +++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 78a7ab3..502ecf8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,11 +30,9 @@ jobs: key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} - - name: Installing miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: chop # environment name is definded in environment.yml - environment-file: environment.yml + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: python-version: ${{ matrix.python-version }} - name: Running conda commands run: | @@ -43,7 +41,17 @@ jobs: pwd python --version which python - - name: Install package and dependencies + - name: Installing environment and dependencies + run: | + $CONDA/bin/conda env update --file environment.yml --name base + - name: Running conda commands + run: | + echo $CONDA_DEFAULT_ENV + conda env list + pwd + python --version + which python + - name: Install package run: | sudo python setup.py develop - name: Dependencies needed for coverage and unit tests diff --git a/environment.yml b/environment.yml index fb0f216..c203a64 100644 --- a/environment.yml +++ b/environment.yml @@ -5,9 +5,9 @@ dependencies: - python=3 - numpy - pandas - - pytorch - - cudatoolkit - - torchvision +# - pytorch +# - cudatoolkit +# - torchvision - pip - pip: - tables From b5567561d6c193445df9854ce5c00738cb4238c9 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 10:40:53 -0700 Subject: [PATCH 21/37] removign debug steps --- .github/workflows/python-package.yml | 15 --------------- environment.yml | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 502ecf8..1158694 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,23 +34,9 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Running conda commands - run: | - echo $CONDA_DEFAULT_ENV - conda env list - pwd - python --version - which python - name: Installing environment and dependencies run: | $CONDA/bin/conda env update --file environment.yml --name base - - name: Running conda commands - run: | - echo $CONDA_DEFAULT_ENV - conda env list - pwd - python --version - which python - name: Install package run: | sudo python setup.py develop @@ -62,7 +48,6 @@ jobs: pip install advertorch copt pip install git+https://github.com/RobustBench/robustbench pip install coveralls coverage pytest-cov - pip install dill - name: Dependencies needed for sphinx run: | pip install sphinx sphinx-gallery diff --git a/environment.yml b/environment.yml index c203a64..fb0f216 100644 --- a/environment.yml +++ b/environment.yml @@ -5,9 +5,9 @@ dependencies: - python=3 - numpy - pandas -# - pytorch -# - cudatoolkit -# - torchvision + - pytorch + - cudatoolkit + - torchvision - pip - pip: - tables From 455f51d9766f3a2feee483ad99a2650632f705a6 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 10:48:17 -0700 Subject: [PATCH 22/37] adding env activation step --- .github/workflows/python-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1158694..f4ea3e6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,6 +37,9 @@ jobs: - name: Installing environment and dependencies run: | $CONDA/bin/conda env update --file environment.yml --name base + - name: Activating conda environment + run: | + conda activate base - name: Install package run: | sudo python setup.py develop From af8b0c289ada37f17fdbf88e29a34b0253cb5bcc Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:01:04 -0700 Subject: [PATCH 23/37] adding new step to activate environment --- .github/workflows/python-package.yml | 6 ++++-- environment.yml | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f4ea3e6..0e7d9d0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,12 +34,14 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Setting up -conda + uses: s-weigand/setup-conda@v1 - name: Installing environment and dependencies run: | $CONDA/bin/conda env update --file environment.yml --name base - - name: Activating conda environment + - name: Activating conda env run: | - conda activate base + conda activate base - name: Install package run: | sudo python setup.py develop diff --git a/environment.yml b/environment.yml index fb0f216..c203a64 100644 --- a/environment.yml +++ b/environment.yml @@ -5,9 +5,9 @@ dependencies: - python=3 - numpy - pandas - - pytorch - - cudatoolkit - - torchvision +# - pytorch +# - cudatoolkit +# - torchvision - pip - pip: - tables From 398a01623abdcb120ee2ce19b082b5cb8bd103ce Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:02:49 -0700 Subject: [PATCH 24/37] activating env with raw conda path --- .github/workflows/python-package.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0e7d9d0..b5cf818 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,14 +34,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Setting up -conda - uses: s-weigand/setup-conda@v1 - name: Installing environment and dependencies run: | $CONDA/bin/conda env update --file environment.yml --name base - name: Activating conda env run: | - conda activate base + $CONDA/bin/conda activate base - name: Install package run: | sudo python setup.py develop From 9e0953ff6dc700a8cce9775efc2f0bf44dd4b029 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:08:54 -0700 Subject: [PATCH 25/37] we cannot activate the env --- .github/workflows/python-package.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b5cf818..7c34ebc 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,9 +37,6 @@ jobs: - name: Installing environment and dependencies run: | $CONDA/bin/conda env update --file environment.yml --name base - - name: Activating conda env - run: | - $CONDA/bin/conda activate base - name: Install package run: | sudo python setup.py develop @@ -57,7 +54,7 @@ jobs: pip install memory_profiler - name: Running unit tests run: | - python -m pytest -v --cov=chop + $CONDA/bin/pytest -v --cov=chop - name: Publishing code coverage run: | coveralls From edc7b814ae0c2d1413331b1933d0474c87ed8fd4 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:13:13 -0700 Subject: [PATCH 26/37] use the pip in conda --- .github/workflows/python-package.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7c34ebc..35af307 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -42,12 +42,12 @@ jobs: sudo python setup.py develop - name: Dependencies needed for coverage and unit tests run: | - pip install matplotlib - pip install tqdm - pip install tensorboardX cox requests - pip install advertorch copt - pip install git+https://github.com/RobustBench/robustbench - pip install coveralls coverage pytest-cov + $CONDA/bin/pip install matplotlib + $CONDA/bin/pip install tqdm + $CONDA/bin/pip install tensorboardX cox requests + $CONDA/bin/pip install advertorch copt + $CONDA/bin/pip install git+https://github.com/RobustBench/robustbench + $CONDA/bin/pip install coveralls coverage pytest-cov - name: Dependencies needed for sphinx run: | pip install sphinx sphinx-gallery From cbc63d94e7e88e512b9c35b306166bf2a7efb2e8 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:16:35 -0700 Subject: [PATCH 27/37] using conda pip everywhere --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 35af307..4a9d26c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -50,12 +50,12 @@ jobs: $CONDA/bin/pip install coveralls coverage pytest-cov - name: Dependencies needed for sphinx run: | - pip install sphinx sphinx-gallery - pip install memory_profiler + $CONDA/bin/pip install sphinx sphinx-gallery + $CONDA/bin/pip install memory_profiler - name: Running unit tests run: | $CONDA/bin/pytest -v --cov=chop - name: Publishing code coverage run: | - coveralls + $CONDA/bin/coveralls From eaebcbe944a10311cde7e7625776225d31616a85 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:20:27 -0700 Subject: [PATCH 28/37] adding coverall github action --- .github/workflows/python-package.yml | 7 ++++--- environment.yml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4a9d26c..2336d0e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -55,7 +55,8 @@ jobs: - name: Running unit tests run: | $CONDA/bin/pytest -v --cov=chop - - name: Publishing code coverage - run: | - $CONDA/bin/coveralls + - name: Publishing coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/environment.yml b/environment.yml index c203a64..fb0f216 100644 --- a/environment.yml +++ b/environment.yml @@ -5,9 +5,9 @@ dependencies: - python=3 - numpy - pandas -# - pytorch -# - cudatoolkit -# - torchvision + - pytorch + - cudatoolkit + - torchvision - pip - pip: - tables From 07914e1bec52d33a61ce9847e2b33ac243bb9ce3 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:29:02 -0700 Subject: [PATCH 29/37] removing coveralls step --- .github/workflows/python-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2336d0e..1e04f76 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -55,8 +55,8 @@ jobs: - name: Running unit tests run: | $CONDA/bin/pytest -v --cov=chop - - name: Publishing coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + # - name: Publishing coveralls + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} From 128e8f655ed663f044d3924c69da9b886904d5f1 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Tue, 23 Mar 2021 11:35:52 -0700 Subject: [PATCH 30/37] adding matrix job for all python version back --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1e04f76..795837f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - name: Checking out code From c791d0343e7e5f5d255a4b10d64168f9c0ab5273 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 20:38:36 -0700 Subject: [PATCH 31/37] adding a step to build the docs --- .github/workflows/python-package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 795837f..9bbc1d0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.8] steps: - name: Checking out code @@ -55,6 +55,12 @@ jobs: - name: Running unit tests run: | $CONDA/bin/pytest -v --cov=chop + - name: Building the documentation + working-directory: doc/ + run: | + make html + + # - name: Publishing coveralls # uses: coverallsapp/github-action@master # with: From d2299549673f699440cce761f04d68c2da3df12f Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 20:41:49 -0700 Subject: [PATCH 32/37] adding a test gcloud command --- .github/workflows/python-package.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9bbc1d0..693d143 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,6 +18,11 @@ jobs: python-version: [3.8] steps: + - name: Uploading docs to gcs + uses: actions-hub/gcloud@master + with: + args: ls gs://openo.pt/chop + cli: gsutil - name: Checking out code uses: actions/checkout@v2 - name: Cache conda From ed92d15aa4cc09d00febc9601f6371b8e8c4093a Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 20:43:39 -0700 Subject: [PATCH 33/37] adding fake credentials for gsutil --- .github/workflows/python-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 693d143..4557ab2 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,6 +20,9 @@ jobs: steps: - name: Uploading docs to gcs uses: actions-hub/gcloud@master + env: + PROJECT_ID: test + APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} with: args: ls gs://openo.pt/chop cli: gsutil From c219e4744c306dc84613f35a3bd05b1e901f3a84 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 21:16:03 -0700 Subject: [PATCH 34/37] adding step to push to gcs --- .github/workflows/python-package.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4557ab2..4b25439 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,14 +18,6 @@ jobs: python-version: [3.8] steps: - - name: Uploading docs to gcs - uses: actions-hub/gcloud@master - env: - PROJECT_ID: test - APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - with: - args: ls gs://openo.pt/chop - cli: gsutil - name: Checking out code uses: actions/checkout@v2 - name: Cache conda @@ -67,6 +59,14 @@ jobs: working-directory: doc/ run: | make html + - name: Uploading docs to gcs + - uses: actions-hub/gcloud@master + env: + PROJECT_ID: test # This is a placeholder value that is only needed for the action to succeed, it's not an optional parameter + APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + with: + args: -m doc/rsync -r _build/html gs://openo.pt/chop + cli: gsutil # - name: Publishing coveralls From 4847f974f64fbfffad950f4dde8963126684afc7 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 21:17:06 -0700 Subject: [PATCH 35/37] using sphinx build installed by conda --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4b25439..00d72da 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -58,8 +58,8 @@ jobs: - name: Building the documentation working-directory: doc/ run: | - make html - - name: Uploading docs to gcs + $CONDA/bin/sphinx-build -M html "." "_build" + - name: Uploading docs to gcs - uses: actions-hub/gcloud@master env: PROJECT_ID: test # This is a placeholder value that is only needed for the action to succeed, it's not an optional parameter From 9c9e1a6235f34518646f26ce6b704828b364f92a Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 21:18:05 -0700 Subject: [PATCH 36/37] removing step --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 00d72da..979d7b1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -60,7 +60,7 @@ jobs: run: | $CONDA/bin/sphinx-build -M html "." "_build" - name: Uploading docs to gcs - - uses: actions-hub/gcloud@master + uses: actions-hub/gcloud@master env: PROJECT_ID: test # This is a placeholder value that is only needed for the action to succeed, it's not an optional parameter APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} From 383a8b9652d26d188093b71d427aac8d41a9bd33 Mon Sep 17 00:00:00 2001 From: Thomas Vetterli Date: Thu, 25 Mar 2021 21:24:19 -0700 Subject: [PATCH 37/37] adding a separate action that builds the documentatiuon only when pushed to master (i.e after a PR is merged) --- .github/workflows/publish_documentation.yml | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/publish_documentation.yml diff --git a/.github/workflows/publish_documentation.yml b/.github/workflows/publish_documentation.yml new file mode 100644 index 0000000..0aab350 --- /dev/null +++ b/.github/workflows/publish_documentation.yml @@ -0,0 +1,57 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Publish Documentation + +on: + push: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + + steps: + - name: Checking out code + uses: actions/checkout@v2 + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if etc/example-environment.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: + ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('environment.yml') }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Installing environment and dependencies + run: | + $CONDA/bin/conda env update --file environment.yml --name base + - name: Install package + run: | + sudo python setup.py develop + - name: Dependencies needed for sphinx + run: | + $CONDA/bin/pip install sphinx sphinx-gallery + $CONDA/bin/pip install memory_profiler + - name: Building the documentation + working-directory: doc/ + run: | + $CONDA/bin/sphinx-build -M html "." "_build" + - name: Uploading docs to gcs + uses: actions-hub/gcloud@master + env: + PROJECT_ID: test # This is a placeholder value that is only needed for the action to succeed, it's not an optional parameter + APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + with: + args: -m doc/rsync -r _build/html gs://openo.pt/chop + cli: gsutil +