From 83e1d22290e059760c68ec4caaf81ea17c26ff5e Mon Sep 17 00:00:00 2001 From: Hope2925 <90975536+Hope2925@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:56:34 -0600 Subject: [PATCH 1/7] Create classex_unittests.yml --- .github/workflows/classex_unittests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/classex_unittests.yml diff --git a/.github/workflows/classex_unittests.yml b/.github/workflows/classex_unittests.yml new file mode 100644 index 0000000..0edcc36 --- /dev/null +++ b/.github/workflows/classex_unittests.yml @@ -0,0 +1,18 @@ +name: Unit tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + # make a job name + unit_tests: + # configure the operating system 'environment' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + cd test/unit + python -m unittest test_utils.py From 55381c92f4767f99a1ce6f301f5b5ab9ece49121 Mon Sep 17 00:00:00 2001 From: Hope2925 <90975536+Hope2925@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:58:28 -0600 Subject: [PATCH 2/7] Update classex_unittests.yml --- .github/workflows/classex_unittests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/classex_unittests.yml b/.github/workflows/classex_unittests.yml index 0edcc36..70c94c3 100644 --- a/.github/workflows/classex_unittests.yml +++ b/.github/workflows/classex_unittests.yml @@ -14,5 +14,5 @@ jobs: steps: - uses: actions/checkout@v2 - run: | - cd test/unit - python -m unittest test_utils.py + cd test/unit + python -m unittest test_utils.py From 14b212fed6792b6325d05cb4ac02d61deaf50957 Mon Sep 17 00:00:00 2001 From: Hope2925 Date: Tue, 4 Oct 2022 11:12:54 -0600 Subject: [PATCH 3/7] add conda env --- environment.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 environment.yml diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..fe1d2c9 --- /dev/null +++ b/environment.yml @@ -0,0 +1,23 @@ +name: swe4s +channels: + - defaults +dependencies: + - bzip2=1.0.8=h1de35cc_0 + - ca-certificates=2022.07.19=hecd8cb5_0 + - certifi=2022.6.15=py310hecd8cb5_0 + - libcxx=12.0.0=h2f01273_0 + - libffi=3.3=hb1e8313_2 + - ncurses=6.3=hca72f7f_3 + - openssl=1.1.1q=hca72f7f_0 + - pip=22.1.2=py310hecd8cb5_0 + - pycodestyle=2.8.0=pyhd3eb1b0_0 + - python=3.10.4=hdfd78df_0 + - readline=8.1.2=hca72f7f_1 + - setuptools=63.4.1=py310hecd8cb5_0 + - sqlite=3.39.2=h707629a_0 + - tk=8.6.12=h5d9f67b_0 + - tzdata=2022a=hda174b7_0 + - wheel=0.37.1=pyhd3eb1b0_0 + - xz=5.2.5=hca72f7f_1 + - zlib=1.2.12=h4dc903c_2 +prefix: /Users/hopekirby/opt/anaconda3/envs/swe4s From 3a842ee75cc55b1c4356e83351776c0554034046 Mon Sep 17 00:00:00 2001 From: Hope2925 <90975536+Hope2925@users.noreply.github.com> Date: Tue, 4 Oct 2022 11:15:48 -0600 Subject: [PATCH 4/7] Update classex_unittests.yml --- .github/workflows/classex_unittests.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/classex_unittests.yml b/.github/workflows/classex_unittests.yml index 70c94c3..26cd718 100644 --- a/.github/workflows/classex_unittests.yml +++ b/.github/workflows/classex_unittests.yml @@ -1,4 +1,4 @@ -name: Unit tests +name: Tests on: push: @@ -7,12 +7,30 @@ on: branches: [main] jobs: - # make a job name + # make a job name: running unit tests unit_tests: # configure the operating system 'environment' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: swe4s + environment-file: environment.yml - run: | cd test/unit python -m unittest test_utils.py + + # job for running pycodestyle + code_style: + runs-on: ubuntu-latest + steps: + # checkout code again because independent jobs + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: swe4s + environment-file: environment.yml + # $() tells bash to do that command first + - run: pycodestyle $(git ls-files "*.py") + From 974c01fa6828a00ad8b8688381efb5e7dc95f227 Mon Sep 17 00:00:00 2001 From: Hope2925 <90975536+Hope2925@users.noreply.github.com> Date: Thu, 6 Oct 2022 10:08:21 -0600 Subject: [PATCH 5/7] Update classex_unittests.yml --- .github/workflows/classex_unittests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/classex_unittests.yml b/.github/workflows/classex_unittests.yml index 26cd718..84c0d1b 100644 --- a/.github/workflows/classex_unittests.yml +++ b/.github/workflows/classex_unittests.yml @@ -13,10 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: swe4s - environment-file: environment.yml - run: | cd test/unit python -m unittest test_utils.py @@ -24,6 +20,9 @@ jobs: # job for running pycodestyle code_style: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: # checkout code again because independent jobs - uses: actions/checkout@v2 From ab1f24094f51a17a4521dcd9905f11c6232440a0 Mon Sep 17 00:00:00 2001 From: Hope2925 Date: Thu, 6 Oct 2022 10:20:16 -0600 Subject: [PATCH 6/7] fixing search.py --- search.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/search.py b/search.py index ebf90d7..716d040 100644 --- a/search.py +++ b/search.py @@ -32,8 +32,8 @@ def main(): linear_search_total_time += toc - tic linear_search_mean_time = linear_search_total_time / args.num_searches - print('Linear search: ' \ - + '{:.5f}'.format(linear_search_mean_time) \ + print('Linear search: ' + + '{:.5f}'.format(linear_search_mean_time) + ' seconds') tic = time.perf_counter() @@ -42,8 +42,8 @@ def main(): bsearch_idx_time = toc - tic - print('Indexing: ' \ - + '{:.5f}'.format(bsearch_idx_time) \ + print('Indexing: ' + + '{:.5f}'.format(bsearch_idx_time) + ' seconds') bsearch_total_time = 0 @@ -55,11 +55,10 @@ def main(): bsearch_total_time += toc - tic bsearch_mean_time = bsearch_total_time / args.num_searches - print('Binary search: ' \ - + '{:.5f}'.format(bsearch_mean_time) \ + print('Binary search: ' + + '{:.5f}'.format(bsearch_mean_time) + ' seconds') - if __name__ == '__main__': main() From 983b5eb8654cacc9757b394c2e3036ee270e5fc7 Mon Sep 17 00:00:00 2001 From: Hope2925 Date: Thu, 6 Oct 2022 10:50:59 -0600 Subject: [PATCH 7/7] added functional test to yml --- .github/workflows/classex_unittests.yml | 23 ++++++++++++++++++++--- environment.yml | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/classex_unittests.yml b/.github/workflows/classex_unittests.yml index 84c0d1b..9697043 100644 --- a/.github/workflows/classex_unittests.yml +++ b/.github/workflows/classex_unittests.yml @@ -5,9 +5,9 @@ on: branches: [main] pull_request: branches: [main] - + +# make a job name: running unit tests jobs: - # make a job name: running unit tests unit_tests: # configure the operating system 'environment' runs-on: ubuntu-latest @@ -16,7 +16,24 @@ jobs: - run: | cd test/unit python -m unittest test_utils.py - + func_tests: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + # get to branch + - uses: actions/checkout@v2 + # get the proper environment + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: swe4s + environment-file: environment.yml + # run the functional tests + - run: | + cd ./test/func + bash test_search.sh + # job for running pycodestyle code_style: runs-on: ubuntu-latest diff --git a/environment.yml b/environment.yml index fe1d2c9..6b44aa0 100644 --- a/environment.yml +++ b/environment.yml @@ -1,6 +1,6 @@ name: swe4s channels: - - defaults + - conda-forge dependencies: - bzip2=1.0.8=h1de35cc_0 - ca-certificates=2022.07.19=hecd8cb5_0