Skip to content

Commit

Permalink
Merge pull request #73 from hexylena/hexylena-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena authored Mar 7, 2022
2 parents 5464275 + 778c34e commit 7116e29
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lint Code

on: [pull_request]

jobs:
lint-workflows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

# BEGIN Dependencies
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -U setuptools
pip install -U planemo
pip install -U flake8
pip install -U xmldiff
# END Dependencies

- name: Lint 🔍👁👁
run: |
python setup.py install
flake8 argparse2tool --ignore=E2,E3,E4,E5,W3,W505
PYTHONPATH=$(argparse2tool) python examples/example.py --generate_galaxy_xml > tmp.xml
xmldiff tmp.xml examples/example.xml
planemo lint --report_level all --fail_level error --xsd tmp.xml
# Galaxy tool generation for example with subparsers -- generating one large (invalid) tool
echo '<root>' > tmp-sub.xml # wrap in extra level
PYTHONPATH=$(argparse2tool) python examples/example-sub.py --generate_galaxy_xml >> tmp-sub.xml
echo '</root>' >> tmp-sub.xml
xmldiff tmp-sub.xml <(echo "<root>"; cat examples/example-sub.xml; echo "</root>")
# Galaxy tool generation for example with subparsers -- generating separate tools
PYTHONPATH=$(argparse2tool) python examples/example-sub.py --generate_galaxy_xml --command foo > tmp-sub-foo.xml
PYTHONPATH=$(argparse2tool) python examples/example-sub.py --generate_galaxy_xml --command bar > tmp-sub-bar.xml
xmldiff tmp-sub-foo.xml examples/example-sub-foo.xml
planemo lint --report_level all --fail_level error --xsd tmp-sub-foo.xml
xmldiff tmp-sub-bar.xml examples/example-sub-bar.xml
planemo lint --report_level all --fail_level error --xsd tmp-sub-bar.xml
PYTHONPATH=$(argparse2tool) python examples/example.py --generate_cwl_tool > tmp.cwl
PYTHONPATH=$(argparse2tool) python examples/example-sub.py --generate_cwl_tool > tmp-sub.cwl
sed -i 's/argparse2tool .*/argparse2tool/g' tmp.cwl tmp-sub.cwl
diff tmp.cwl examples/example.cwl
diff tmp-sub.cwl examples/example-sub.cwl
PYTHONPATH=$(argparse2tool) python examples/example-click.py --generate_cwl_tool > tmp-click.cwl
diff tmp-click.cwl examples/example-click.cwl
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish

on:
push:
branches:
- main

jobs:
lint-workflows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

# BEGIN Dependencies
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -U setuptools
pip install -U planemo
pip install -U flake8
pip install -U xmldiff
# END Dependencies

- name: Install dependencies
run: pip install wheel

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish a Python distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __gxtp_param_from_type(self, param, flag, label, num_dashes, gxparam_extra_k
gxparam = gxtp.DataParam(flag, label=label, num_dashes=num_dashes, **gxparam_extra_kwargs)
elif isinstance(param.type, FileType):
if 'w' in param.type._mode:
gxparam = gxtp.OutputParameter(
gxparam = gxtp.OutputData(
flag, format='data', default=default, label=label,
num_dashes=num_dashes, **gxparam_extra_kwargs
)
Expand Down

0 comments on commit 7116e29

Please sign in to comment.