From 0e21b1b4e29101bd9d2463d8831f8250500efe93 Mon Sep 17 00:00:00 2001 From: Tobias Date: Tue, 2 Jan 2024 12:05:44 +0100 Subject: [PATCH] Add CI #2 (#8) * Add basic files * Use environment.yaml and simplify verification script * Add github workflow for conda and pytest * Move config to correct folder * Change env name in ci * Use code from README * Fix SyntaxError * Again * Try different env path * Fix bug * Try again * Add pytest as dependency * Again * Again * Again * Again * Again * Add dummy test * Fix bug * Can I leave that out? * Finalize Tests CI * Rename ci file --- .github/workflows/Tests.yaml | 33 +++++++++++++++++++++++++++++++++ environment.yaml | 3 +++ tests/test_dummy.py | 3 +++ 3 files changed, 39 insertions(+) create mode 100644 .github/workflows/Tests.yaml create mode 100644 tests/test_dummy.py diff --git a/.github/workflows/Tests.yaml b/.github/workflows/Tests.yaml new file mode 100644 index 0000000..b95cfa1 --- /dev/null +++ b/.github/workflows/Tests.yaml @@ -0,0 +1,33 @@ +name: Tests + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + # 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: + activate-environment: '.env' + environment-file: 'environment.yaml' + auto-activate-base: false + + - name: Install edugrad + run: | + pip install -e . + # ------------------------------------------------------------------------------------------------------------------ + + - name: Run Tests + # Execute the commands in a bash login shell, ensuring that the shell's environment is fully initialized. + shell: bash -l {0} + run: | + pytest tests \ No newline at end of file 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 diff --git a/tests/test_dummy.py b/tests/test_dummy.py new file mode 100644 index 0000000..e7bfc24 --- /dev/null +++ b/tests/test_dummy.py @@ -0,0 +1,3 @@ + +def test_dummy(): + assert True == True \ No newline at end of file