Skip to content

Commit

Permalink
Merge pull request #16 from rabix/fix/git-ref-local-file
Browse files Browse the repository at this point in the history
Fix/git ref local file
  • Loading branch information
bogdang989 authored Oct 7, 2021
2 parents 78f59df + 80da426 commit 8f20575
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
pip install pytest
pip install pipx
pipx install cwltool
pipx install cwltool>=3.0
pipx ensurepath
# Need a new shell so that ensurepath takes
- name: Test with pytest
Expand Down
13 changes: 13 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@ You can have several profiles on the same platform if, for example, you
are an enterprise user and you belong to several divisions. Please refer
to the API documentation for more detail.

### Reading credentials from env variables

Instead of using the credentials file, you can specify environment variables
`SB_API_ENDPOINT` and `SB_AUTH_TOKEN`. To use the env variables in `sbpack` simply
specify profile `.` in the command, e.g.

```bash
sbpack . kghosesbg/sbpla-31744/ATAC-seq-pipeline-se https://raw.githubusercontent.com/Duke-GCB/GGR-cwl/master/v1.0/ATAC-seq_pipeline/pipeline-se.cwl
```

By specifying `.` profile, `sbpack` will use env variables. If these are not found, the default profile
from the credentials file is used.

### Running the test suite

The pulling test requires two environment variables to be set
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ruamel.yaml >= 0.16
sevenbridges-python >= 2.0
cwlformat
4 changes: 1 addition & 3 deletions sbpack/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
import enum

from ruamel.yaml import YAML

import sevenbridges as sbg
import sevenbridges.errors as sbgerr

import sbpack.schemadef as schemadef
import sbpack.lib as lib

from .version import __version__
from sbpack.version import __version__

import logging

Expand Down
2 changes: 1 addition & 1 deletion sbpack/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2020.10.05"
__version__ = "2021.10.07"
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2020 Seven Bridges. See LICENSE

import pathlib
import os
from datetime import datetime
from setuptools import setup, find_packages

Expand All @@ -11,18 +12,15 @@
now = datetime.utcnow()
desc_path = pathlib.Path(current_path, "Readme.md")
long_description = desc_path.open("r").read()
requirements = os.path.join(current_path, 'requirements.txt')

setup(
name=name,
version=version,
packages=find_packages(),
platforms=['POSIX', 'MacOS', 'Windows'],
python_requires='>=3.6',
install_requires=[
"ruamel.yaml >= 0.16.12",
"sevenbridges-python >= 0.20.2",
"cwlformat"
],
install_requires=open(requirements).read().splitlines(),
entry_points={
'console_scripts': [
'sbpack = sbpack.pack:main',
Expand Down
3 changes: 3 additions & 0 deletions tests/test_validation_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ def cwl_is_valid(fname):
('f',),
[("tools/clt1.cwl",), ("tools/clt2.cwl",), ("tools/clt3.cwl",),
("workflows/wf1.cwl",), ("workflows/wf2.cwl",), ("workflows/wf4.cwl",),
("workflows/wf-with-git.cwl",),
("https://raw.githubusercontent.com/rabix/sbpack/master/tests/workflows/wf1.cwl",),
("https://raw.githubusercontent.com/rabix/sbpack/master/tests/workflows/wf2.cwl",),
("https://raw.githubusercontent.com/rabix/sbpack/master/tests/workflows/wf4.cwl",),
("remote-cwl/tool1.cwl",), ("remote-cwl/tool2.cwl",), ("remote-cwl/wf1.cwl",)
]
)
@pytest.mark.skipif(sys.platform == 'win32',
reason='Skip on windows due to errors in cwltool with import pwd')
def test_local_packing_with_validation(f):
url = urllib.parse.urlparse(f)
packed_name = pathlib.Path(url.path).stem + "-packed.cwl"
Expand Down
13 changes: 13 additions & 0 deletions tests/workflows/wf-with-git.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class: Workflow
cwlVersion: v1.2
inputs:
in: File
steps:
git:
in:
- id: file1
source: in
out:
- id: output_file
run: https://raw.githubusercontent.com/common-workflow-language/cwl-v1.2/main/tests/cat3-tool-docker.cwl

0 comments on commit 8f20575

Please sign in to comment.