diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2107406..84186393 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,15 +13,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04] + os: [ubuntu-18.04, macos-latest] py: [3.7, 3.8] defaults: 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: ${{ 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: @@ -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 }} + ${{ env.DAMMIT_CONDA_DIR }} key: ${{ matrix.os }}-snakemake-envs - name: run pytest 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}")