Skip to content

Commit b837e28

Browse files
committed
Switch to Github Actions
1 parent c7308ef commit b837e28

15 files changed

+223
-180
lines changed

.github/workflows/ci-tests.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Continous integration tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
singularity_version: 3.6.4
12+
13+
jobs:
14+
15+
tox:
16+
name: CI tests via Tox
17+
18+
runs-on: ubuntu-20.04
19+
20+
strategy:
21+
matrix:
22+
py-ver-major: [3]
23+
py-ver-minor: [6, 7, 8, 9]
24+
step: [lint, unit, mypy]
25+
26+
env:
27+
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}
28+
TOXENV: ${{ format('py{0}{1}-{2}', matrix.py-ver-major, matrix.py-ver-minor, matrix.step) }}
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Set up Singularity
36+
if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }}
37+
uses: eWaterCycle/setup-singularity@v6
38+
with:
39+
singularity-version: ${{ env.singularity_version }}
40+
41+
- name: Give the test runner user a name to make provenance happy.
42+
if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }}
43+
run: sudo usermod -c 'CI Runner' $(whoami)
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: ${{ env.py-semver }}
49+
50+
- name: Cache for pip
51+
uses: actions/cache@v2
52+
with:
53+
path: ~/.cache/pip
54+
key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt', 'tox.ini') }}
55+
56+
- name: Upgrade setuptools and install tox
57+
run: |
58+
pip install -U pip setuptools wheel
59+
pip install tox tox-gh-actions
60+
61+
- name: MyPy cache
62+
if: ${{ matrix.step == 'mypy' }}
63+
uses: actions/cache@v2
64+
with:
65+
path: .mypy_cache/${{ env.py-semver }}
66+
key: mypy-${{ env.py-semver }}
67+
68+
- name: Test with tox
69+
run: tox
70+
71+
- name: Upload coverage to Codecov
72+
if: ${{ matrix.step == 'unit' }}
73+
uses: codecov/codecov-action@v1
74+
with:
75+
fail_ci_if_error: true
76+
77+
tox-style:
78+
name: CI linters via Tox
79+
80+
runs-on: ubuntu-20.04
81+
82+
strategy:
83+
matrix:
84+
step: [lint-readme, pydocstyle]
85+
86+
env:
87+
py-semver: 3.9
88+
TOXENV: ${{ format('py39-{0}', matrix.step) }}
89+
90+
steps:
91+
- uses: actions/checkout@v2
92+
with:
93+
fetch-depth: 0
94+
95+
- name: Set up Python
96+
uses: actions/setup-python@v2
97+
with:
98+
python-version: ${{ env.py-semver }}
99+
100+
- name: Cache for pip
101+
uses: actions/cache@v2
102+
with:
103+
path: ~/.cache/pip
104+
key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt') }}
105+
106+
- name: Upgrade setuptools and install tox
107+
run: |
108+
pip install -U pip setuptools wheel
109+
pip install tox tox-gh-actions
110+
111+
- if: ${{ matrix.step == 'pydocstyle' && github.event_name == 'pull_request'}}
112+
name: Create local branch for diff-quality for PRs
113+
run: git branch ${{github.base_ref}} origin/${{github.base_ref}}
114+
115+
- name: Test with tox
116+
run: tox
117+
118+
119+
release_test:
120+
name: cwl-utils release test
121+
122+
runs-on: ubuntu-20.04
123+
124+
steps:
125+
- uses: actions/checkout@v2
126+
127+
- name: Set up Singularity
128+
uses: eWaterCycle/setup-singularity@v6
129+
with:
130+
singularity-version: ${{ env.singularity_version }}
131+
132+
- name: Set up Python
133+
uses: actions/setup-python@v2
134+
with:
135+
python-version: 3.9
136+
137+
- name: Give the test runner user a name to make provenance happy.
138+
run: sudo usermod -c 'CI Runner' $(whoami)
139+
140+
- name: Cache for pip
141+
uses: actions/cache@v2
142+
with:
143+
path: ~/.cache/pip
144+
key: ${{ runner.os }}-pip-release-${{ hashFiles('requirements.txt', 'test-requirements.txt') }}
145+
146+
- name: Install packages
147+
run: |
148+
pip install -U pip setuptools wheel
149+
pip install virtualenv
150+
151+
- name: Release test
152+
env:
153+
RELEASE_SKIP: head
154+
run: ./release-test.sh
155+
156+
- name: Publish package
157+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
158+
uses: pypa/gh-action-pypi-publish@release/v1
159+
with:
160+
user: __token__
161+
password: ${{ secrets.PYPI_API_TOKEN }}
162+
packages_dir: testenv3_3/dist

.travis.singularity_key.txt

Lines changed: 0 additions & 70 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ dist: dist/${MODULE}-$(VERSION).tar.gz
6969
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
7070
./setup.py sdist bdist_wheel
7171

72+
## docs : make the docs
73+
docs: FORCE
74+
cd docs && $(MAKE) html
75+
7276
## clean : clean up all temporary / machine-generated files
7377
clean: FORCE
7478
rm -f ${MODILE}/*.pyc tests/*.pyc
@@ -161,12 +165,7 @@ mypy: $(filter-out setup.py,${PYSOURCES})
161165
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
162166
typeshed/ruamel/ ; \
163167
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
164-
MYPYPATH=$$MYPYPATH:typeshed/ mypy --disallow-untyped-calls \
165-
--warn-redundant-casts \
166-
$^
167-
168-
mypyc: ${PYSOURCES}
169-
MYPYPATH=typeshed/ CWLTOOL_USE_MYPYC=1 pip install --verbose -e . && pytest --basetemp ./tmp
168+
MYPYPATH=$$MYPYPATH:typeshed mypy $^
170169

171170
release-test: FORCE
172171
git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@ To regenerate install the `schema_salad` package and run:
105105
### Release
106106

107107
To release CWLUtils, bump the version in `cwl_utils/__meta__.py`, and tag that
108-
commit with the new version. TravisCI should release that tag.
108+
commit with the new version. The [gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish)
109+
should release that tag.

cwl_utils/cwl_expression_refactor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def run(args: argparse.Namespace) -> int:
139139
output_filehandle.write(
140140
"#!/usr/bin/env cwl-runner\n"
141141
) # TODO: teach the codegen to do this?
142-
yaml.round_trip_dump(result_json, output_filehandle)
142+
yaml.main.round_trip_dump(result_json, output_filehandle)
143143
return 0
144144

145145

cwl_utils/cwl_v1_0_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ def param_for_source_id(
638638
raise WorkflowException(
639639
"param {} not found in {}\n or\n {}.".format(
640640
sourcename,
641-
yaml.round_trip_dump(cwl.save(process)),
642-
yaml.round_trip_dump(cwl.save(parent)),
641+
yaml.main.round_trip_dump(cwl.save(process)),
642+
yaml.main.round_trip_dump(cwl.save(parent)),
643643
)
644644
)
645645

cwl_utils/cwl_v1_1_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ def param_for_source_id(
638638
raise WorkflowException(
639639
"param {} not found in {}\n or\n {}.".format(
640640
sourcename,
641-
yaml.round_trip_dump(cwl.save(process)),
642-
yaml.round_trip_dump(cwl.save(parent)),
641+
yaml.main.round_trip_dump(cwl.save(process)),
642+
yaml.main.round_trip_dump(cwl.save(parent)),
643643
)
644644
)
645645

cwl_utils/cwl_v1_2_expression_refactor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ def param_for_source_id(
638638
raise WorkflowException(
639639
"param {} not found in {}\n or\n {}.".format(
640640
sourcename,
641-
yaml.round_trip_dump(cwl.save(process)),
642-
yaml.round_trip_dump(cwl.save(parent)),
641+
yaml.main.round_trip_dump(cwl.save(process)),
642+
yaml.main.round_trip_dump(cwl.save(parent)),
643643
)
644644
)
645645

cwl_utils/graph_split.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import argparse
99
import json
1010
import os
11-
from typing import Any, IO, MutableMapping, Set, Text, Union, cast
11+
from typing import IO, Any, MutableMapping, Set, Text, Union, cast
1212

1313
from cwlformat.formatter import stringify_dict
1414
from ruamel import yaml
@@ -199,7 +199,9 @@ def rewrite_schemadef(document: MutableMapping[str, Any]) -> Set[str]:
199199
field["name"] = field["name"].split("/")[2]
200200
rewrite_types(field, entry_file, True)
201201
with open(entry_file[1:], "a", encoding="utf-8") as entry_handle:
202-
yaml.dump([entry], entry_handle, Dumper=yaml.RoundTripDumper)
202+
yaml.main.dump(
203+
[entry], entry_handle, Dumper=yaml.dumper.RoundTripDumper
204+
)
203205
entry["$import"] = entry_file[1:]
204206
del entry["name"]
205207
del entry["type"]

0 commit comments

Comments
 (0)