From 0e36c83be0aa605f0ce6348974559d021bbd8eb0 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:39:28 +0100 Subject: [PATCH 01/20] Add github workflow for conda and pytest --- .github/ci.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/ci.yaml diff --git a/.github/ci.yaml b/.github/ci.yaml new file mode 100644 index 0000000..1c5d5bb --- /dev/null +++ b/.github/ci.yaml @@ -0,0 +1,27 @@ +name: Conda Environment and Pytest + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: .env + environment-file: environment.yaml + auto-activate-base: false + + - name: Install Dependencies + run: | + conda env create -f environment.yaml + source activate .env + + - name: Run Pytest + run: | + pytest tests/ From 369cf760c4f3fa22ac342dfa418143d34aebe995 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:42:17 +0100 Subject: [PATCH 02/20] Move config to correct folder --- .github/{ => workflows}/ci.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/ci.yaml (100%) diff --git a/.github/ci.yaml b/.github/workflows/ci.yaml similarity index 100% rename from .github/ci.yaml rename to .github/workflows/ci.yaml From 0eb44ae241ced82378dafaec8c4c67eda17d6340 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:44:57 +0100 Subject: [PATCH 03/20] Change env name in ci --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1c5d5bb..86d1e37 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,14 +13,14 @@ jobs: - name: Setup Miniconda uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: .env + activate-environment: myenv environment-file: environment.yaml auto-activate-base: false - name: Install Dependencies run: | conda env create -f environment.yaml - source activate .env + source activate myenv - name: Run Pytest run: | From 21c5deef882f71c28563b310652a3b3f02784719 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:51:41 +0100 Subject: [PATCH 04/20] Use code from README --- .github/workflows/ci.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86d1e37..094e434 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,14 +13,17 @@ jobs: - name: Setup Miniconda uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: myenv + activate-environment: .env environment-file: environment.yaml auto-activate-base: false - name: Install Dependencies run: | - conda env create -f environment.yaml - source activate myenv + conda create --prefix .env + conda activate .env/ + conda env update --file environment.yaml --prefix .env + + pip install -e . - name: Run Pytest run: | From e28ff19ed6caf8b24fa89aca82abe09e392ed2ef Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:53:08 +0100 Subject: [PATCH 05/20] Fix SyntaxError --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 094e434..234b8fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,6 @@ jobs: conda create --prefix .env conda activate .env/ conda env update --file environment.yaml --prefix .env - pip install -e . - name: Run Pytest From 5aebe063866bad6d496a49d0fbd6fff3b2c8f7cf Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 21:55:53 +0100 Subject: [PATCH 06/20] Again --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 234b8fb..43735a2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,10 +19,10 @@ jobs: - name: Install Dependencies run: | - conda create --prefix .env - conda activate .env/ - conda env update --file environment.yaml --prefix .env - pip install -e . + conda create --prefix .env + source activate .env/ + conda env update --file environment.yaml --prefix .env + pip install -e . - name: Run Pytest run: | From d7d088a0720dbab5bde5ffcf90e6d6451362680b Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:00:02 +0100 Subject: [PATCH 07/20] Try different env path --- .github/workflows/ci.yaml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 43735a2..45a53e7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,17 +10,18 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: .env - environment-file: environment.yaml - auto-activate-base: false + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-activate-base: false - - name: Install Dependencies - run: | - conda create --prefix .env - source activate .env/ + - name: Install Dependencies + run: | + echo "Initialize Conda" + source $CONDA/etc/profile.d/conda.sh + echo "Activating Conda environment" + conda activate /home/runner/work/edugrad/edugrad/.env + echo "Environment activated" conda env update --file environment.yaml --prefix .env pip install -e . From 5e754127ece7e5ab871d3e805bdef914656ad739 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:01:32 +0100 Subject: [PATCH 08/20] Fix bug --- .github/workflows/ci.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45a53e7..0ebfd65 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,18 +10,18 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - auto-activate-base: false + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-activate-base: false - - name: Install Dependencies - run: | - echo "Initialize Conda" - source $CONDA/etc/profile.d/conda.sh - echo "Activating Conda environment" - conda activate /home/runner/work/edugrad/edugrad/.env - echo "Environment activated" + - name: Install Dependencies + run: | + echo "Initialize Conda" + source $CONDA/etc/profile.d/conda.sh + echo "Activating Conda environment" + conda activate /home/runner/work/edugrad/edugrad/.env + echo "Environment activated" conda env update --file environment.yaml --prefix .env pip install -e . From beb808c798195dfe8f422dc3e15591dd3808b609 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:07:17 +0100 Subject: [PATCH 09/20] Try again --- .github/workflows/ci.yaml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0ebfd65..7eb1be2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Conda Environment and Pytest +name: Edugrad CI on: [push, pull_request] @@ -7,24 +7,23 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v2 + with: + repository: 'tostenzel/edugrad' + ref: 'main' - - name: Setup Miniconda + - name: Setup Conda Environment uses: conda-incubator/setup-miniconda@v2 with: + activate-environment: '.env' + environment-file: 'environment.yaml' auto-activate-base: false - - name: Install Dependencies + - name: Install Edugrad run: | - echo "Initialize Conda" - source $CONDA/etc/profile.d/conda.sh - echo "Activating Conda environment" - conda activate /home/runner/work/edugrad/edugrad/.env - echo "Environment activated" - conda env update --file environment.yaml --prefix .env pip install -e . - - name: Run Pytest + - name: Run Tests run: | - pytest tests/ + pytest tests From 648972451fd4e80f9589384d22a4202f0a0822d6 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:10:52 +0100 Subject: [PATCH 10/20] Add pytest as dependency --- environment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/environment.yaml b/environment.yaml index 7cb20fc..3ccaa9a 100644 --- a/environment.yaml +++ b/environment.yaml @@ -3,3 +3,6 @@ channels: - defaults dependencies: - numpy + + # tests + - pytest From f49d64b242ee4e500d5e05e10894458d1e626b51 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:14:42 +0100 Subject: [PATCH 11/20] Again --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7eb1be2..dbda520 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,4 +26,5 @@ jobs: - name: Run Tests run: | + conda list pytest tests From 356846ee25e4b7aab9fb207daf7718bc2c83d5a5 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:18:07 +0100 Subject: [PATCH 12/20] Again --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbda520..9c18ccb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,5 +26,6 @@ jobs: - name: Run Tests run: | + conda activate .env conda list pytest tests From 2244f3a6fd30aa06caa1a818db060b63aba76f5e Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:20:03 +0100 Subject: [PATCH 13/20] Again --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c18ccb..ff7a336 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,5 +27,4 @@ jobs: - name: Run Tests run: | conda activate .env - conda list pytest tests From 52c3222f1e65f0097d4a3da8520c5ef17bba48ef Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:22:16 +0100 Subject: [PATCH 14/20] Again --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ff7a336..8ba70c4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,7 @@ jobs: pip install -e . - name: Run Tests + shell: bash -l {0} run: | - conda activate .env - pytest tests + conda list + pytest tests \ No newline at end of file From bedf3ce28c47be5e22de4b9eea45ede9b118ad95 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:28:32 +0100 Subject: [PATCH 15/20] Again --- .github/workflows/ci.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8ba70c4..4e016ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,11 +7,9 @@ jobs: runs-on: ubuntu-latest steps: + # checkout the code at the commit (incl. branch) that triggered the workflow - name: Checkout Repository uses: actions/checkout@v2 - with: - repository: 'tostenzel/edugrad' - ref: 'main' - name: Setup Conda Environment uses: conda-incubator/setup-miniconda@v2 From e2339ae21db7020a2979cecee7f94fddaa2b5ceb Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:34:01 +0100 Subject: [PATCH 16/20] Add dummy test --- tests/test_dummy.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/test_dummy.py diff --git a/tests/test_dummy.py b/tests/test_dummy.py new file mode 100644 index 0000000..e7565d6 --- /dev/null +++ b/tests/test_dummy.py @@ -0,0 +1,3 @@ + +def test_dummy(): + True == True \ No newline at end of file From 9ba17ace483ee66d94f4a2c1ed53dff6990decf6 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:34:16 +0100 Subject: [PATCH 17/20] Fix bug --- tests/test_dummy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_dummy.py b/tests/test_dummy.py index e7565d6..e7bfc24 100644 --- a/tests/test_dummy.py +++ b/tests/test_dummy.py @@ -1,3 +1,3 @@ def test_dummy(): - True == True \ No newline at end of file + assert True == True \ No newline at end of file From 38ae949dcd9e6e6d8fb99b3b63ca6ba48a419fdc Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:37:44 +0100 Subject: [PATCH 18/20] Can I leave that out? --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4e016ad..c8d87c1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - # checkout the code at the commit (incl. branch) that triggered the workflow + + # checkout the code at the commit (incl. branch) that triggered the workflow - name: Checkout Repository uses: actions/checkout@v2 @@ -23,7 +24,7 @@ jobs: pip install -e . - name: Run Tests - shell: bash -l {0} + #shell: bash -l {0} run: | conda list pytest tests \ No newline at end of file From 82b8f819cac24a3f99b0b6ed750918228cc80820 Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:42:09 +0100 Subject: [PATCH 19/20] Finalize Tests CI --- .github/workflows/ci.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c8d87c1..b95cfa1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Edugrad CI +name: Tests on: [push, pull_request] @@ -8,10 +8,12 @@ jobs: steps: - # checkout the code at the commit (incl. branch) that triggered the workflow + # Checkout the code at the commit (incl. branch) that triggered the workflow - name: Checkout Repository uses: actions/checkout@v2 + # ------------------------------------------------------------------------------------------------------------------ + # Resemble installation section in README.md - name: Setup Conda Environment uses: conda-incubator/setup-miniconda@v2 with: @@ -19,12 +21,13 @@ jobs: environment-file: 'environment.yaml' auto-activate-base: false - - name: Install Edugrad + - name: Install edugrad run: | pip install -e . + # ------------------------------------------------------------------------------------------------------------------ - name: Run Tests - #shell: bash -l {0} + # Execute the commands in a bash login shell, ensuring that the shell's environment is fully initialized. + shell: bash -l {0} run: | - conda list pytest tests \ No newline at end of file From 6035d8fe1fa2806d44805d6d64c090c61857dabf Mon Sep 17 00:00:00 2001 From: tostenzel Date: Mon, 1 Jan 2024 22:42:54 +0100 Subject: [PATCH 20/20] Rename ci file --- .github/workflows/{ci.yaml => Tests.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yaml => Tests.yaml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/Tests.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/Tests.yaml