From 6412fc11ba4873d2d17c9236265d7f98d4467ba1 Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 19:56:13 +0100 Subject: [PATCH 1/8] added docker ci action --- .github/workflows/docker_ci_main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/docker_ci_main.yml diff --git a/.github/workflows/docker_ci_main.yml b/.github/workflows/docker_ci_main.yml new file mode 100644 index 0000000..5910fec --- /dev/null +++ b/.github/workflows/docker_ci_main.yml @@ -0,0 +1,16 @@ + +name: CI - Main +on: + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build and test with Docker + run: | + docker build -t example_python_package_image . + docker run --rm example_python_package_image /bin/bash -c "bash run_tests.sh" \ No newline at end of file From 14552857e1da68a9ee155f83b88e41fa6b3b4922 Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 19:58:18 +0100 Subject: [PATCH 2/8] updated compile cores --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4bdd877..d996bbc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM continuumio/miniconda3:4.9.2 -ARG compile_cores=6 +ARG compile_cores=1 RUN apt-get --yes update && apt-get --yes upgrade From d3f529fcfb811ebfa41c344fd36a6d1f1b42634c Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:03:41 +0100 Subject: [PATCH 3/8] added run test script --- run_tests.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 run_tests.sh diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..82a1260 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +pytest tests/test_multiplication.py \ No newline at end of file From 7fa1505d9807e7cd4ad204ae2bfffde91439cefc Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:08:14 +0100 Subject: [PATCH 4/8] added test running script to dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d996bbc..3c4e897 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,6 @@ RUN conda install -c conda-forge -c python python=3.8 && \ pip install jupyter-cadquery==2.1.0 && \ # change to clone repo and pip install locally pip install paramak && \ - conda clean -afy \ No newline at end of file + conda clean -afy + +COPY run_tests.sh run_tests.sh \ No newline at end of file From 048d169cd85a461cd0e2cdd166f03f017f7872d5 Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:14:44 +0100 Subject: [PATCH 5/8] copied tests folder into dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3c4e897..791094c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,5 @@ RUN conda install -c conda-forge -c python python=3.8 && \ pip install paramak && \ conda clean -afy -COPY run_tests.sh run_tests.sh \ No newline at end of file +COPY run_tests.sh run_tests.sh +COPY tests tests/ \ No newline at end of file From 287eccf66012075887d9ca41db766f92409586cc Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:19:53 +0100 Subject: [PATCH 6/8] added package to ci --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 791094c..8cd5ba1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,9 @@ RUN conda install -c conda-forge -c python python=3.8 && \ conda clean -afy COPY run_tests.sh run_tests.sh -COPY tests tests/ \ No newline at end of file +COPY tests tests/ + +COPY example_python_package example_python_package/ +COPY setup.py setup.py + +RUN python setup.py install \ No newline at end of file From 41275e4861e8b22b15826587f33013148f013ef9 Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:24:46 +0100 Subject: [PATCH 7/8] added README to docker image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 8cd5ba1..fca0e3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ RUN conda install -c conda-forge -c python python=3.8 && \ COPY run_tests.sh run_tests.sh COPY tests tests/ +COPY README.md README.md COPY example_python_package example_python_package/ COPY setup.py setup.py From 3115c25bf5081e323d01e4cf164f9c00d62c3a17 Mon Sep 17 00:00:00 2001 From: billingsley-john Date: Wed, 30 Jun 2021 20:28:31 +0100 Subject: [PATCH 8/8] updated test to intentionally fail --- tests/test_multiplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_multiplication.py b/tests/test_multiplication.py index b928bda..2492a21 100644 --- a/tests/test_multiplication.py +++ b/tests/test_multiplication.py @@ -7,4 +7,4 @@ def test_multiplication_small_numbers(): def test_multiplication_large_numbers(): result = multiply_two_numbers(100, 300) - assert result == 30000 \ No newline at end of file + assert result == None \ No newline at end of file