From 55ac442fa5c3df5aa1a0824b69b9913bdd5215c8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 30 Sep 2021 20:58:03 +0200 Subject: [PATCH 1/5] Test different python versions GitHub CI now has singularity. --- .github/workflows/main.yml | 25 +++++++++++++++++++++++++ spython/tests/test_client.py | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea9b343..fe5b6fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,3 +28,28 @@ jobs: export PATH="/usr/share/miniconda/bin:$PATH" source activate black pyflakes spython/oci spython/image spython/instance spython/main + + pytest: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - uses: eWaterCycle/setup-singularity@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + sudo ln -s $SINGULARITY_ROOT/bin/singularity /usr/bin/ + python -m pip install --upgrade pip + pip install pytest semver pytest-runner requests + + - name: Run unit tests + run: | + COLUMNS=256 python3 setup.py pytest diff --git a/spython/tests/test_client.py b/spython/tests/test_client.py index 5a5e352..7b2aba5 100644 --- a/spython/tests/test_client.py +++ b/spython/tests/test_client.py @@ -43,12 +43,16 @@ def test_docker_pull(docker_container): def test_execute(docker_container): result = Client.execute(docker_container[1], "ls /") print(result) + if isinstance(result, list): + result = "".join(result) assert "tmp\nusr\nvar" in result def test_execute_with_return_code(docker_container): result = Client.execute(docker_container[1], "ls /", return_result=True) print(result) + if isinstance(result["message"], list): + result["message"] = "".join(result["message"]) assert "tmp\nusr\nvar" in result["message"] assert result["return_code"] == 0 From 61a91928869ba83ddc1b77fbf24af20d24e59584 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 1 Oct 2021 11:35:05 +0200 Subject: [PATCH 2/5] specify version better be careful with actions not under control of GitHub or any other trusted source --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe5b6fc..e3ae8f6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: eWaterCycle/setup-singularity@v6 + - uses: eWaterCycle/setup-singularity@1631b12cf3878381179be0eab9624219bc12979e # v6 release - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 From abae48db2e9504d847d69069b7744533234733b9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 2 Oct 2021 00:02:20 +0200 Subject: [PATCH 3/5] standard invocation --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3ae8f6..7be4cef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,4 +52,4 @@ jobs: - name: Run unit tests run: | - COLUMNS=256 python3 setup.py pytest + COLUMNS=256 pytest From 86c7155864976502453ea92b069988f01f33a411 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 2 Oct 2021 00:05:53 +0200 Subject: [PATCH 4/5] failure in one python version does not cancel the others https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7be4cef..2cb2db8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,7 @@ jobs: pytest: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: [3.7, 3.8, 3.9] From cbd0901489d051fba09ba664ee2db0aec60f6b36 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 2 Oct 2021 00:44:03 +0200 Subject: [PATCH 5/5] use default number of columns --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2cb2db8..b63bb40 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,4 +53,4 @@ jobs: - name: Run unit tests run: | - COLUMNS=256 pytest + pytest