[7.x] Split CI into Jenkins and GitHub Actions

This commit is contained in:
Seth Michael Larson
2020-05-27 16:42:40 -05:00
committed by GitHub
parent 1773bd17be
commit 1bfb1113d3
5 changed files with 66 additions and 20 deletions
+1
View File
@@ -37,6 +37,7 @@ docker run \
--env "ELASTICSEARCH_HOST=${ELASTICSEARCH_URL}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--env "TEST_TYPE=server" \
--name elasticsearch-py \
--rm \
--volume `pwd`:/code/elasticsearch-py \
+22
View File
@@ -53,3 +53,25 @@ jobs:
python3.7 -m pip install tox
- name: Build the docs
run: tox -e docs
test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
steps:
- name: Checkout Repository
uses: actions/checkout@v1
- name: Set Up Python - ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install -r dev-requirements.txt
- name: Run Tests
run: |
python setup.py test
+27 -4
View File
@@ -63,8 +63,9 @@ def fetch_es_repo():
def run_all(argv=None):
sys.exitfunc = lambda: sys.stderr.write("Shutting down....\n")
# fetch yaml tests
fetch_es_repo()
# fetch yaml tests anywhere that's not GitHub Actions
if "GITHUB_ACTION" not in environ:
fetch_es_repo()
# always insert coverage when running tests
if argv is None:
@@ -80,10 +81,32 @@ def run_all(argv=None):
"-vv",
]
ignores = []
# Python 3.6+ is required for async
if sys.version_info < (3, 6):
argv.append("--ignore=test_elasticsearch/test_async/")
ignores.append("test_elasticsearch/test_async/")
argv.append(abspath(dirname(__file__)),)
# GitHub Actions, run non-server tests
if "GITHUB_ACTION" in environ:
ignores.extend(
[
"test_elasticsearch/test_server/",
"test_elasticsearch/test_async/test_server/",
]
)
if ignores:
argv.extend(["--ignore=%s" % ignore for ignore in ignores])
# Jenkins, only run server tests
if environ.get("TEST_TYPE") == "server":
test_dir = abspath(dirname(__file__))
argv.append(join(test_dir, "test_server"))
if sys.version_info >= (3, 6):
argv.append(join(test_dir, "test_async/test_server"))
# Not in CI, run all tests specified.
else:
argv.append(abspath(dirname(__file__)))
exit_code = 0
try:
@@ -200,11 +200,11 @@ def async_runner(async_client):
return AsyncYamlRunner(async_client)
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
async def test_rest_api_spec(test_spec, async_runner):
if not RUN_ASYNC_REST_API_TESTS:
pytest.skip("Skipped running async REST API tests")
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
async_runner.use_spec(test_spec)
await async_runner.run()
if RUN_ASYNC_REST_API_TESTS:
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
async def test_rest_api_spec(test_spec, async_runner):
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
async_runner.use_spec(test_spec)
await async_runner.run()
@@ -424,11 +424,11 @@ def sync_runner(sync_client):
return YamlRunner(sync_client)
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
def test_rest_api_spec(test_spec, sync_runner):
if RUN_ASYNC_REST_API_TESTS:
pytest.skip("Skipped running sync REST API tests")
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
sync_runner.use_spec(test_spec)
sync_runner.run()
if not RUN_ASYNC_REST_API_TESTS:
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
def test_rest_api_spec(test_spec, sync_runner):
if test_spec.get("skip", False):
pytest.skip("Manually skipped in 'SKIP_TESTS'")
sync_runner.use_spec(test_spec)
sync_runner.run()