diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..1cd15a7 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,63 @@ +name: Python package + +on: [push, pull_request] + +jobs: + test: + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.12.3" # Specify the version of Python to use + + - name: Cache conda + uses: actions/cache@v2 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} + restore-keys: | + ${{ runner.os }}-conda- + + - name: Install Miniconda + shell: bash + run: | + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh + bash miniconda.sh -b -p $HOME/miniconda + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda config --set always_yes yes --set changeps1 no + conda config --add pkgs_dirs ~/conda_pkgs_dir + conda update -q conda + + - name: Add conda channels + shell: bash + run: | + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda config --add channels conda-forge + + - name: Create and activate conda environment + shell: bash + run: | + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda env create -f environment.yml + conda activate protein-prediction + env: + CONDA_PKGS_DIRS: ~/conda_pkgs_dir + + - name: Check Python version + shell: bash + run: | + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate protein-prediction + python --version + + - name: Run tests + shell: bash + run: | + source "$HOME/miniconda/etc/profile.d/conda.sh" + conda activate protein-prediction + pytest diff --git a/environment.yml b/environment.yml index 9e4db18..590db31 100644 --- a/environment.yml +++ b/environment.yml @@ -1,75 +1,78 @@ name: protein-prediction channels: + - conda-forge - defaults - - https://conda.anaconda.org/gurobi dependencies: - - blas=1.0=openblas - - bottleneck=1.3.7=py312h32608ca_0 - - brotli=1.0.9=h6c40b1e_8 - - brotli-bin=1.0.9=h6c40b1e_8 - - bzip2=1.0.8=h6c40b1e_6 - - ca-certificates=2024.3.11=hecd8cb5_0 - - colorama=0.4.6=py312hecd8cb5_0 - - contourpy=1.2.0=py312ha357a0b_0 - - cycler=0.11.0=pyhd3eb1b0_0 - - expat=2.6.2=hcec6c5f_0 - - fonttools=4.51.0=py312h6c40b1e_0 - - freetype=2.12.1=hd8bbffd_0 - - intel-openmp=2023.1.0=ha357a0b_43548 - - joblib=1.4.0=py312hecd8cb5_0 - - jpeg=9e=h6c40b1e_1 - - kiwisolver=1.4.4=py312hcec6c5f_0 - - lcms2=2.12=hf1fd2bf_0 - - lerc=3.0=he9d5cce_0 - - libbrotlicommon=1.0.9=h6c40b1e_8 - - libbrotlidec=1.0.9=h6c40b1e_8 - - libbrotlienc=1.0.9=h6c40b1e_8 - - libcxx=14.0.6=h9765a3e_0 - - libdeflate=1.17=hb664fd8_1 - - libffi=3.4.4=hecd8cb5_1 - - libgfortran=5.0.0=11_3_0_hecd8cb5_28 - - libgfortran5=11.3.0=h9dfd629_28 - - libopenblas=0.3.21=h54e7dc3_0 - - libpng=1.6.39=h6c40b1e_0 - - libtiff=4.5.1=hcec6c5f_0 - - libwebp-base=1.3.2=h6c40b1e_0 - - llvm-openmp=14.0.6=h0dcd299_0 - - lz4-c=1.9.4=hcec6c5f_1 - - matplotlib=3.8.4=py312hecd8cb5_0 - - matplotlib-base=3.8.4=py312h7f12edd_0 - - mkl=2023.1.0=h8e150cf_43560 - - mkl-service=2.4.0=py312h6c40b1e_1 - - ncurses=6.4=hcec6c5f_0 - - networkx=3.1=py312hecd8cb5_0 - - numexpr=2.8.7=py312h7d6adbd_0 - - numpy=1.26.4=py312h7d6adbd_0 - - numpy-base=1.26.4=py312hbb3573c_0 - - openjpeg=2.4.0=h66ea3da_0 - - openssl=3.0.13=hca72f7f_1 - - packaging=23.2=py312hecd8cb5_0 - - pandas=2.2.1=py312he282a81_0 - - pathlib=1.0.1=pyhd3eb1b0_1 - - pillow=10.3.0=py312h6c40b1e_0 - - pip=24.0=py312hecd8cb5_0 - - pybind11-abi=5=hd3eb1b0_0 - - pyparsing=3.0.9=py312hecd8cb5_0 - - python=3.12.3=hd58486a_1 - - python-dateutil=2.9.0post0=py312hecd8cb5_0 - - python-tzdata=2023.3=pyhd3eb1b0_0 - - pytz=2024.1=py312hecd8cb5_0 - - readline=8.2=hca72f7f_0 - - scikit-learn=1.4.2=py312he282a81_1 - - scipy=1.13.0=py312hba6221a_0 - - setuptools=69.5.1=py312hecd8cb5_0 - - six=1.16.0=pyhd3eb1b0_1 - - sqlite=3.45.3=h6c40b1e_0 - - tbb=2021.8.0=ha357a0b_0 - - threadpoolctl=2.2.0=pyh0d69192_0 - - tk=8.6.14=h4d00af3_0 - - tornado=6.3.3=py312h6c40b1e_0 - - tzdata=2024a=h04d1e81_0 - - unicodedata2=15.1.0=py312h6c40b1e_0 - - wheel=0.43.0=py312hecd8cb5_0 - - xz=5.4.6=h6c40b1e_1 - - zlib=1.2.13=h4b97444_1 - - zstd=1.5.5=hc035e20_2 \ No newline at end of file + - brotli=1.1.0=h0dc2134_1 + - brotli-bin=1.1.0=h0dc2134_1 + - bzip2=1.0.8=h10d778d_5 + - ca-certificates=2024.6.2=h8857fd0_0 + - certifi=2024.2.2=pyhd8ed1ab_0 + - colorama=0.4.6=pyhd8ed1ab_0 + - contourpy=1.2.1=py312h9230928_0 + - cycler=0.12.1=pyhd8ed1ab_0 + - exceptiongroup=1.2.0=pyhd8ed1ab_2 + - fonttools=4.53.0=py312hbd25219_0 + - freetype=2.12.1=h60636b9_2 + - iniconfig=2.0.0=pyhd8ed1ab_0 + - joblib=1.4.2=pyhd8ed1ab_0 + - kiwisolver=1.4.5=py312h49ebfd2_1 + - lcms2=2.16=ha2f27b4_0 + - lerc=4.0.0=hb486fe8_0 + - libblas=3.9.0=22_osx64_openblas + - libbrotlicommon=1.1.0=h0dc2134_1 + - libbrotlidec=1.1.0=h0dc2134_1 + - libbrotlienc=1.1.0=h0dc2134_1 + - libcblas=3.9.0=22_osx64_openblas + - libcxx=17.0.6=h88467a6_0 + - libdeflate=1.20=h49d49c5_0 + - libexpat=2.6.2=h73e2aa4_0 + - libffi=3.4.2=h0d85af4_5 + - libgfortran=5.0.0=13_2_0_h97931a8_3 + - libgfortran5=13.2.0=h2873a65_3 + - libjpeg-turbo=3.0.0=h0dc2134_1 + - liblapack=3.9.0=22_osx64_openblas + - libopenblas=0.3.27=openmp_hfef2a42_0 + - libpng=1.6.43=h92b6c6a_0 + - libsqlite=3.45.3=h92b6c6a_0 + - libtiff=4.6.0=h129831d_3 + - libwebp-base=1.4.0=h10d778d_0 + - libxcb=1.15=hb7f2c08_0 + - libzlib=1.3.1=h87427d6_1 + - llvm-openmp=18.1.6=h15ab845_0 + - matplotlib=3.8.4=py312hb401068_2 + - matplotlib-base=3.8.4=py312hb6d62fa_2 + - munkres=1.1.4=pyh9f0ad1d_0 + - ncurses=6.5=h5846eda_0 + - networkx=3.3=pyhd8ed1ab_1 + - numpy=1.26.4=py312he3a82b2_0 + - openjpeg=2.5.2=h7310d3a_0 + - openssl=3.3.1=h87427d6_0 + - packaging=24.0=pyhd8ed1ab_0 + - pandas=2.2.2=py312h1171441_1 + - pillow=10.3.0=py312h0c923fa_0 + - pip=24.0=pyhd8ed1ab_0 + - pluggy=1.5.0=pyhd8ed1ab_0 + - pthread-stubs=0.4=hc929b4f_1001 + - pyparsing=3.1.2=pyhd8ed1ab_0 + - pytest=8.2.2=pyhd8ed1ab_0 + - python=3.12.3=h1411813_0_cpython + - python-dateutil=2.9.0=pyhd8ed1ab_0 + - python-tzdata=2024.1=pyhd8ed1ab_0 + - python_abi=3.12=4_cp312 + - pytz=2024.1=pyhd8ed1ab_0 + - readline=8.2=h9e318b2_1 + - scikit-learn=1.5.0=py312hc214ba5_1 + - scipy=1.13.1=py312hb9702fa_0 + - setuptools=70.0.0=pyhd8ed1ab_0 + - six=1.16.0=pyh6c4a22f_0 + - threadpoolctl=3.5.0=pyhc1e730c_0 + - tk=8.6.13=h1abcd95_1 + - tomli=2.0.1=pyhd8ed1ab_0 + - tornado=6.4=py312h41838bb_0 + - tzdata=2024a=h0c530f3_0 + - wheel=0.43.0=pyhd8ed1ab_1 + - xorg-libxau=1.0.11=h0dc2134_0 + - xorg-libxdmcp=1.1.3=h35c211d_0 + - xz=5.2.6=h775f41a_0 + - zstd=1.5.6=h915ae27_0 diff --git a/tests/test_pytest.py b/tests/test_pytest.py index 20acc85..38c3dd9 100644 --- a/tests/test_pytest.py +++ b/tests/test_pytest.py @@ -14,6 +14,8 @@ import_graph_from_pickle, ) from tools.workflow import run_workflow +import os + def test_algorithm_attributes(): @@ -47,6 +49,15 @@ def test_algorithm_inherits_class(): def test_algorithm_workflow(): + if not os.path.exists("output"): + os.makedirs("output") + if not os.path.exists("output/dataset"): + os.makedirs("output/dataset") + if not os.path.exists("output/data"): + os.makedirs("output/data") + if not os.path.exists("output/images"): + os.makedirs("output/images") + output_data_path = Path("./output/data/") output_image_path = Path("./output/images/") input_directory_path = Path("./tests/testing-dataset/")