Skip to content

Commit e2ebcba

Browse files
committed
enable CI
1 parent ea3a4e1 commit e2ebcba

File tree

4 files changed

+183
-5
lines changed

4 files changed

+183
-5
lines changed

.github/workflows/ci-tests.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Continous integration tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
tox:
12+
name: CI tests via Tox
13+
14+
runs-on: ubuntu-20.04
15+
16+
strategy:
17+
matrix:
18+
py-ver-major: [3]
19+
py-ver-minor: [6, 7, 8, 9, 10]
20+
step: [unit]
21+
# step: [lint, unit, mypy]
22+
23+
env:
24+
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}
25+
TOXENV: ${{ format('py{0}{1}-{2}', matrix.py-ver-major, matrix.py-ver-minor, matrix.step) }}
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: ${{ env.py-semver }}
34+
35+
- name: Cache for pip
36+
uses: actions/cache@v2
37+
with:
38+
path: ~/.cache/pip
39+
key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt', 'tox.ini') }}
40+
41+
- name: Upgrade setuptools and install tox
42+
run: |
43+
pip install -U pip setuptools wheel
44+
pip install tox tox-gh-actions
45+
46+
- name: MyPy cache
47+
if: ${{ matrix.step == 'mypy' }}
48+
uses: actions/cache@v2
49+
with:
50+
path: .mypy_cache/${{ env.py-semver }}
51+
key: mypy-${{ env.py-semver }}
52+
53+
- name: Test with tox
54+
run: tox
55+
56+
- name: Upload coverage to Codecov
57+
if: ${{ matrix.step == 'unit' }}
58+
uses: codecov/codecov-action@v1
59+
with:
60+
fail_ci_if_error: true
61+
62+
tox-style:
63+
name: CI linters via Tox
64+
65+
runs-on: ubuntu-20.04
66+
67+
strategy:
68+
matrix:
69+
step: [lint-readme]
70+
# step: [lint-readme, pydocstyle]
71+
72+
env:
73+
py-semver: 3.9
74+
TOXENV: ${{ format('py39-{0}', matrix.step) }}
75+
76+
steps:
77+
- uses: actions/checkout@v2
78+
with:
79+
fetch-depth: 0
80+
81+
- name: Set up Python
82+
uses: actions/setup-python@v2
83+
with:
84+
python-version: ${{ env.py-semver }}
85+
86+
- name: Cache for pip
87+
uses: actions/cache@v2
88+
with:
89+
path: ~/.cache/pip
90+
key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt') }}
91+
92+
- name: Upgrade setuptools and install tox
93+
run: |
94+
pip install -U pip setuptools wheel
95+
pip install tox tox-gh-actions
96+
97+
- if: ${{ matrix.step == 'pydocstyle' && github.event_name == 'pull_request'}}
98+
name: Create local branch for diff-quality for PRs
99+
run: git branch ${{github.base_ref}} origin/${{github.base_ref}}
100+
101+
- name: Test with tox
102+
run: tox
103+

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ install-dependencies: FORCE
5050
pip install --upgrade $(DEVPKGS)
5151
pip install -r requirements.txt
5252

53-
## install : install the ${MODULE} module and schema-salad-tool
53+
## install : install the ${MODULE} module and cwlprov
5454
install: FORCE
5555
pip install .
5656

@@ -113,7 +113,7 @@ pylint_report.txt: $(PYSOURCES)
113113
diff_pylint_report: pylint_report.txt
114114
diff-quality --violations=pylint pylint_report.txt
115115

116-
.coverage:
116+
.coverage: FORCE
117117
$(foreach RO,$(shell ls test),coverage run -m cwlprov.tool -d test/$(RO) validate && ) true
118118
$(foreach RO,$(shell ls test),coverage run -m cwlprov.tool -d test/$(RO) info && ) true
119119
$(foreach RO,$(shell ls test),coverage run -m cwlprov.tool -d test/$(RO) who && ) true
@@ -174,7 +174,7 @@ mypy3: mypy
174174
mypy: $(filter-out setup.py,$(PYSOURCES))
175175
mypy $^
176176

177-
pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES))
177+
pyupgrade: $(PYSOURCES)
178178
pyupgrade --exit-zero-even-if-changed --py36-plus $^
179179

180180
release-test: FORCE

requirements.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
wheel
2-
sphinx
1+
prov >= 1.5.1
2+
bdbag >= 1.4.1
3+
arcp >= 0.2.0
4+
rdflib-jsonld >= 0.4.0, < 0.6.2
5+
rdflib >= 4.2.2, <6.0

tox.ini

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[tox]
2+
envlist =
3+
py{36,37,38,39,310}-lint,
4+
py{36,37,38,39,310}-unit,
5+
py{36,37,38,39,310}-bandit,
6+
py{36,37,38,39,310}-mypy,
7+
py39-lint-readme,
8+
py39-pydocstyle
9+
10+
skipsdist = True
11+
skip_missing_interpreters = True
12+
13+
[gh-actions]
14+
python =
15+
3.6: py36
16+
3.7: py37
17+
3.8: py38
18+
3.9: py39
19+
3.10: py310
20+
21+
[testenv]
22+
description =
23+
py{36,37,38,39,310}-unit: Run the unit tests
24+
py{36,37,38,39,310}-lint: Lint the Python code
25+
py{36,37,38,39,310}-bandit: Search for common security issues
26+
py{36,37,38,39,310}-mypy: Check for type safety
27+
py39-pydocstyle: docstring style checker
28+
py39-lint-readme: Lint the README.rst->.md conversion
29+
30+
passenv =
31+
CI
32+
GITHUB_*
33+
deps =
34+
py{36,37,38,39,310}-{unit,lint,bandit,mypy}: -rrequirements.txt
35+
py{36,37,38,39,310}-{unit,mypy}: -rtest-requirements.txt
36+
py{36,37,38,39,310}-lint: flake8-bugbear
37+
py{36,37,38,39,310}-lint: black
38+
py{36,37,38,39,310}-bandit: bandit
39+
py{36,37,38,39,310}-mypy: -rmypy-requirements.txt
40+
41+
setenv =
42+
py{36,37,38,39,310}-unit: LC_ALL = C.UTF-8
43+
44+
commands =
45+
py{36,37,38,39,310}-unit: python -m pip install -U pip setuptools wheel
46+
py{36,37,38,39,310}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
47+
py{36,37,38,39,310}-bandit: bandit --recursive cwlprov
48+
py{36,37,38,39,310}-lint: make flake8
49+
py{36,37,38,39,310}-lint: make format-check
50+
py{36,37,38,39,310}-mypy: make mypy
51+
52+
whitelist_externals =
53+
py{36,37,38,39,310}-lint: flake8
54+
py{36,37,38,39,310}-lint: black
55+
py{36,37,38,39,310}-{mypy,shellcheck,lint,unit}: make
56+
57+
[testenv:py39-pydocstyle]
58+
whitelist_externals = make
59+
commands = make diff_pydocstyle_report
60+
deps =
61+
pydocstyle
62+
diff-cover
63+
64+
[testenv:py39-lint-readme]
65+
commands =
66+
python setup.py sdist
67+
python setup.py bdist_wheel
68+
twine check dist/*
69+
deps =
70+
twine
71+
wheel
72+
readme_renderer[md]

0 commit comments

Comments
 (0)