Skip to content

Commit

Permalink
Merge pull request #39 from hexylena/gha
Browse files Browse the repository at this point in the history
Extract GHA From #37
  • Loading branch information
hexylena authored Sep 19, 2023
2 parents 6a75716 + 2b1cb80 commit 9281659
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release (by Tag Push)

'on':
push:
tags:
- '*'

jobs:

deploy:
name: Deploy
needs: [lint, test]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v3
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}
- uses: casperdcl/deploy-pypi@v2
with:
password: ${{ secrets.PYPI_TOKEN }}
build: --sdist --wheel --outdir dist .
58 changes: 58 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test Pull Request

on: [pull_request]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v3
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}
- name: Install package
run: pip install -r requirements.txt black==23.3 flake8==6.0
- name: Flake8
run: flake8 --ignore=C901,W503
- name: Black
uses: psf/black@23.3.0

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache .cache/pip
uses: actions/cache@v3
id: cache-pip
with:
path: ~/.cache/pip
key: pip_cache_py_${{ matrix.python-version }}
- name: install package
run: python -m pip install .
- name: install packages for testing
run: pip install nose xmldiff
# TODO: replace with tox tests from #38
#- name: run nosetests
# run: nosetests --with-coverage --cover-package=galaxyxml

- name: Run smoke test on example
run: |
python examples/example.py > tmp.xml
xmldiff --check tmp.xml examples/tool.xml
python examples/example_macros.py > tmp.xml
xmldiff --check tmp.xml examples/example_macros.xml
4 changes: 2 additions & 2 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
outputs.append(param)
# Collection
collection = gxtp.OutputCollection("supercollection", label="a small label")
discover = gxtp.DiscoverDatasets("(?P<designation>.+)\.pdf.fasta", format="fasta")
discover = gxtp.DiscoverDatasets("(?P<designation>.+).pdf.fasta", format="fasta")
collection.append(discover)
outputs.append(collection)

Expand All @@ -111,7 +111,7 @@
rep_out.append(param)
test_a.append(rep_out)
test_coll = gxtp.TestOutputCollection(name="pdf_out")
test_elem = gxtp.TestOCElement(name="apdf",file="apdf",ftype="pdf")
test_elem = gxtp.TestOCElement(name="apdf", file="apdf", ftype="pdf")
test_coll.append(test_elem)
test_a.append(test_coll)
rep_out = gxtp.TestRepeat(name="output_repeat")
Expand Down
5 changes: 3 additions & 2 deletions examples/example_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import galaxyxml.tool.parameters as gxtp

# examplify the use of MacrosTool
#
#

tool = gxt.MacrosTool(
name="aragorn",
Expand Down Expand Up @@ -57,6 +57,7 @@
param_max.command_line_override = ""
param_min.space_between_arg = " "
param_max.space_between_arg = " "

inputs.append(param_min)
inputs.append(param_max)
inputs.append(posint)
Expand Down Expand Up @@ -84,7 +85,7 @@
outputs.append(param)
# Collection
collection = gxtp.OutputCollection("supercollection", label="a small label")
discover = gxtp.DiscoverDatasets("(?P<designation>.+)\.pdf.fasta", format="fasta")
discover = gxtp.DiscoverDatasets("(?P<designation>.+).pdf.fasta", format="fasta")
collection.append(discover)
outputs.append(collection)

Expand Down
7 changes: 4 additions & 3 deletions test/unit_test_import_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_stdio(self):
self.assertEqual(std.attrib["level"], "fatal")
self.assertEqual(std.attrib["range"], "1:")


class TestOverrides(TestImport):
def test_override(self):
co = "bash foo.sh > output1"
Expand Down Expand Up @@ -199,20 +200,20 @@ def test_collection_output(self):

def test_repeat(self):
repeat = self.tool.tests.children[0].node[3]
self.assertEqual(repeat.attrib["name"],"testrepeat")
self.assertEqual(repeat.attrib["name"], "testrepeat")
# test param within repeat
self.assertEqual(repeat[0].attrib["name"], "repeatchild")
self.assertEqual(repeat[0].attrib["value"], "foo")
# test output within repeat
output = self.tool.tests.children[0].node[4]
self.assertEqual(output.attrib["name"],"output_repeat")
self.assertEqual(output.attrib["name"], "output_repeat")
self.assertEqual(output[0].attrib["file"], "outputchild")
self.assertEqual(output[0].attrib["name"], "bar")

def test_ocr(self):
# test outputcollection within repeat - who knows...
output = self.tool.tests.children[0].node[5]
self.assertEqual(output.attrib["name"],"collection_repeat")
self.assertEqual(output.attrib["name"], "collection_repeat")
collection = output[0]
self.assertEqual(collection.attrib["name"], "collectionchild")
element = collection[0]
Expand Down

0 comments on commit 9281659

Please sign in to comment.