From 085eda4a199c994bb8c1708fb8877b3d3838b1b4 Mon Sep 17 00:00:00 2001 From: Camille Scott Date: Fri, 29 Jan 2021 12:27:08 -0800 Subject: [PATCH 1/5] Add macos-latest to test matrix --- .github/workflows/tests.yml | 2 +- dammit/wrappers/download/wrapper.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2107406..2e5a1125 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04] + os: [ubuntu-18.04, macos-latest] py: [3.7, 3.8] defaults: run: diff --git a/dammit/wrappers/download/wrapper.py b/dammit/wrappers/download/wrapper.py index ed6fd2b0..46c52df1 100644 --- a/dammit/wrappers/download/wrapper.py +++ b/dammit/wrappers/download/wrapper.py @@ -3,6 +3,8 @@ __email__ = "cswel@ucdavis.edu" __license__ = "MIT" +import sys + from snakemake.shell import shell log = snakemake.log_fmt_shell(stdout=False, stderr=True) @@ -34,8 +36,11 @@ raise ValueError('Valid filetypes are "gz", "tar.gz", and "uncompressed"') if snakemake.params.get('md5'): - cmd.append('&& python -c "assert \'`md5sum {output} | ' - 'awk \'{{print $1}}\'`\' == \'{snakemake.params.md5}\', ' + if sys.platform == 'darwin': + md5cmd = "md5 {output} | awk '{{print $4}}'" + else: + md5cmd = "md5sum {output} | awk '{{print $1}}'" + cmd.append('&& python -c "assert \'`' + md5cmd + '`\' == \'{snakemake.params.md5}\', ' '\'MD5sum does not match\'"') cmd.append("{log}") From 4b22e762312f4ef27a283dea7fd614bedebf0933 Mon Sep 17 00:00:00 2001 From: Camille Scott Date: Fri, 29 Jan 2021 13:37:01 -0800 Subject: [PATCH 2/5] Attempt making paths portable --- .github/workflows/tests.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2107406..e5d4cfdf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: run: shell: bash -l {0} env: - DAMMIT_DB_DIR: /home/runner/databases - DAMMIT_CONDA_DIR: /home/runner/snakemake-envs-${{ matrix.os }} - DAMMIT_TESTING_TEMP_BASE_DIR: /home/runner/snakemake-envs-${{ matrix.os }} + DAMMIT_DB_DIR: $HOME/databases + DAMMIT_CONDA_DIR: $HOME/snakemake-envs-${{ matrix.os }} + DAMMIT_TESTING_TEMP_BASE_DIR: $HOME/snakemake-envs-${{ matrix.os }} steps: - uses: actions/checkout@v2 with: @@ -53,11 +53,11 @@ jobs: uses: actions/cache@v2 with: path: | - /home/runner/databases/Pfam-A.hmm - /home/runner/databases/Pfam-A.hmm.h3f - /home/runner/databases/Pfam-A.hmm.h3i - /home/runner/databases/Pfam-A.hmm.h3m - /home/runner/databases/Pfam-A.hmm.h3p + ${{ env.DAMMIT_DB_DIR }}/Pfam-A.hmm + ${{ env.DAMMIT_DB_DIR }}/Pfam-A.hmm.h3f + ${{ env.DAMMIT_DB_DIR }}/Pfam-A.hmm.h3i + ${{ env.DAMMIT_DB_DIR }}/Pfam-A.hmm.h3m + ${{ env.DAMMIT_DB_DIR }}/Pfam-A.hmm.h3p key: databases-${{ hashFiles('dammit/databases.yml') }} - name: setup databases @@ -68,7 +68,7 @@ jobs: uses: actions/cache@v2 with: path: | - /home/runner/snakemake-envs-${{ matrix.os }} + ~/snakemake-envs-${{ matrix.os }} key: ${{ matrix.os }}-snakemake-envs - name: run pytest From 2ff908e55ca812141da05bc5c06cbb2d3fb0be1f Mon Sep 17 00:00:00 2001 From: Camille Scott Date: Fri, 29 Jan 2021 13:55:41 -0800 Subject: [PATCH 3/5] Use env context --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e5d4cfdf..2ced7caf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: run: shell: bash -l {0} env: - DAMMIT_DB_DIR: $HOME/databases - DAMMIT_CONDA_DIR: $HOME/snakemake-envs-${{ matrix.os }} - DAMMIT_TESTING_TEMP_BASE_DIR: $HOME/snakemake-envs-${{ matrix.os }} + DAMMIT_DB_DIR: ${{ env.HOME }}/databases + DAMMIT_CONDA_DIR: ${{ env.HOME }}/snakemake-envs-${{ matrix.os }} + DAMMIT_TESTING_TEMP_BASE_DIR: ${{ env.HOME }}/snakemake-envs-${{ matrix.os }} steps: - uses: actions/checkout@v2 with: From 9fe86f7731d088c6fb29d01cefd230132145bcb7 Mon Sep 17 00:00:00 2001 From: Camille Scott Date: Fri, 29 Jan 2021 14:09:31 -0800 Subject: [PATCH 4/5] Try using runner.temp for dammit data --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2ced7caf..320c4f40 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: run: shell: bash -l {0} env: - DAMMIT_DB_DIR: ${{ env.HOME }}/databases - DAMMIT_CONDA_DIR: ${{ env.HOME }}/snakemake-envs-${{ matrix.os }} - DAMMIT_TESTING_TEMP_BASE_DIR: ${{ env.HOME }}/snakemake-envs-${{ matrix.os }} + DAMMIT_DB_DIR: ${{ runner.temp }}/databases + DAMMIT_CONDA_DIR: ${{ runner.temp }}/snakemake-envs-${{ matrix.os }} + DAMMIT_TESTING_TEMP_BASE_DIR: ${{ runner.temp }}/snakemake-envs-${{ matrix.os }} steps: - uses: actions/checkout@v2 with: @@ -68,7 +68,7 @@ jobs: uses: actions/cache@v2 with: path: | - ~/snakemake-envs-${{ matrix.os }} + ${{ env.DAMMIT_CONDA_DIR }} key: ${{ matrix.os }}-snakemake-envs - name: run pytest From 10126ed310bb79a55a681ef3e1a43e8d144c8758 Mon Sep 17 00:00:00 2001 From: Camille Scott Date: Fri, 29 Jan 2021 14:19:13 -0800 Subject: [PATCH 5/5] dammit how does this work --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 320c4f40..cf6fa140 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: run: shell: bash -l {0} env: - DAMMIT_DB_DIR: ${{ runner.temp }}/databases - DAMMIT_CONDA_DIR: ${{ runner.temp }}/snakemake-envs-${{ matrix.os }} - DAMMIT_TESTING_TEMP_BASE_DIR: ${{ runner.temp }}/snakemake-envs-${{ matrix.os }} + DAMMIT_DB_DIR: ${{ github.workspace }}/data/databases + DAMMIT_CONDA_DIR: ${{ github.workspace }}/data/snakemake-envs-${{ matrix.os }} + DAMMIT_TESTING_TEMP_BASE_DIR: ${{ github.workspace }}/data/snakemake-envs-${{ matrix.os }} steps: - uses: actions/checkout@v2 with: