Skip to content

Commit 53f70fb

Browse files
authored
feat: Adds Github actions for integration tests and fixes macos and integration tests (#762)
* Adds github action for integration tests * Increases file handles for OSX * Make homebrew verbose to hopefully help prevent timeouts * Bump version of tested osx
1 parent a5a95a7 commit 53f70fb

File tree

4 files changed

+77
-14
lines changed

4 files changed

+77
-14
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI-integration-tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test-linux-integration:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
max-parallel: 4
13+
matrix:
14+
python-version: [3.6, 3.7]
15+
steps:
16+
- uses: actions/checkout@master
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install -e .[nodocs]
25+
git config --global --add user.name "Renku @ SDSC"
26+
git config --global --add user.email "renku@datascience.ch"
27+
- name: Test with pytest
28+
run: pytest -m integration -v
29+
30+
test-macos-integration:
31+
runs-on: macos-latest
32+
strategy:
33+
max-parallel: 4
34+
matrix:
35+
python-version: [3.6, 3.7]
36+
steps:
37+
- uses: actions/checkout@master
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v1
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
- name: Install dependencies
43+
run: |
44+
brew update
45+
brew install git-lfs shellcheck node || brew link --overwrite node
46+
python -m pip install --upgrade pip
47+
python -m pip install -e .[all]
48+
git config --global --add user.name "Renku @ SDSC"
49+
git config --global --add user.email "renku@datascience.ch"
50+
- name: Test with pytest
51+
run: pytest -m integration -v

.travis.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ before_install:
6969
requirements-builder -e nodocs --level=pypi setup.py > .travis-release-requirements-nodocs.txt;
7070
requirements-builder -e nodocs --level=dev --req requirements-devel.txt setup.py > .travis-devel-requirements-nodocs.txt;
7171
elif [[ $TRAVIS_OS_NAME == 'osx' ]]; then
72+
ulimit -n 1024;
7273
brew update;
73-
brew upgrade python;
74+
brew upgrade -v python;
7475
brew unlink python;
7576
brew link python;
76-
brew install git-lfs jq node pipenv shellcheck;
77-
brew upgrade node;
77+
brew install -v git-lfs jq node pipenv shellcheck;
78+
travis_wait brew upgrade node;
7879
fi
7980

8081
install:
@@ -153,15 +154,15 @@ jobs:
153154
- REQUIREMENTS=lowest
154155
script: pytest -m integration -v
155156
- stage: test OSX
156-
if: branch = master
157157
language: generic
158158
sudo: true
159159
os: osx
160-
osx_image: xcode10.1
161-
- language: generic
160+
osx_image: xcode11.2
161+
- stage: test OSX
162+
language: generic
162163
sudo: true
163164
os: osx
164-
osx_image: xcode9.2
165+
osx_image: xcode10.1
165166

166167
- stage: publish 🐍
167168
python: 3.6
@@ -191,8 +192,8 @@ jobs:
191192
language: generic
192193
sudo: true
193194
os: osx
194-
osx_image: xcode10.2
195-
before_install: brew install jq
195+
osx_image: xcode11.2
196+
before_install: brew -v install jq
196197
install: python -m pip install requests
197198
script:
198199
- echo PY_BREW_VERSION=$(python setup.py --version)

conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,3 +465,14 @@ def doi_dataset():
465465
dataset_yaml = f.read()
466466

467467
return dataset_yaml
468+
469+
470+
@pytest.fixture()
471+
def sleep_after():
472+
"""Fixture that causes a delay after executing a test.
473+
474+
Prevents spamming external providers when used, in case of rate limits.
475+
"""
476+
import time
477+
yield
478+
time.sleep(0.5)

tests/cli/test_integration_datasets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}]
4141
)
4242
@pytest.mark.integration
43-
def test_dataset_import_real_doi(runner, project, doi):
43+
def test_dataset_import_real_doi(runner, project, doi, sleep_after):
4444
"""Test dataset import for existing DOI."""
4545
result = runner.invoke(
4646
cli, ['dataset', 'import', doi['doi']], input=doi['input']
@@ -88,7 +88,7 @@ def test_dataset_import_real_doi(runner, project, doi):
8888
]
8989
)
9090
@pytest.mark.integration
91-
def test_dataset_import_real_param(doi, runner, project):
91+
def test_dataset_import_real_param(doi, runner, project, sleep_after):
9292
"""Test dataset import and check metadata parsing."""
9393
result = runner.invoke(cli, ['dataset', 'import', doi[0]], input=doi[1])
9494

@@ -110,7 +110,7 @@ def test_dataset_import_real_param(doi, runner, project):
110110
]
111111
)
112112
@pytest.mark.integration
113-
def test_dataset_import_uri_404(doi, runner, project):
113+
def test_dataset_import_uri_404(doi, runner, project, sleep_after):
114114
"""Test dataset import and check that correct exception is raised."""
115115
result = runner.invoke(cli, ['dataset', 'import', doi[0]], input=doi[1])
116116
assert 2 == result.exit_code
@@ -120,7 +120,7 @@ def test_dataset_import_uri_404(doi, runner, project):
120120

121121

122122
@pytest.mark.integration
123-
def test_dataset_import_real_doi_warnings(runner, project):
123+
def test_dataset_import_real_doi_warnings(runner, project, sleep_after):
124124
"""Test dataset import for existing DOI and dataset"""
125125
result = runner.invoke(
126126
cli, ['dataset', 'import', '10.5281/zenodo.1438326'], input='y'
@@ -176,7 +176,7 @@ def test_dataset_import_fake_doi(runner, project, doi):
176176
]
177177
)
178178
@pytest.mark.integration
179-
def test_dataset_import_real_http(runner, project, url):
179+
def test_dataset_import_real_http(runner, project, url, sleep_after):
180180
"""Test dataset import through HTTPS."""
181181
result = runner.invoke(cli, ['dataset', 'import', url], input='y')
182182

0 commit comments

Comments
 (0)