mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
github actions tests: initial (#4469)
* github actions tests: initial * build: tests: add codecov action
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
name: Tests build
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
DVC_TEST: "true"
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
SHELL: /bin/bash
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04, windows-2019, macos-10.15]
|
||||
pyv: [3.6, 3.7, 3.8]
|
||||
exclude:
|
||||
- os: windows-2019
|
||||
pyv: 3.8
|
||||
steps:
|
||||
- uses: actions/[email protected]
|
||||
- name: Set up Python
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
python-version: ${{ matrix.pyv }}
|
||||
- name: install
|
||||
run: |
|
||||
pip install ".[all,tests]"
|
||||
- name: setup git
|
||||
run: |
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "DVC Tester"
|
||||
- name: run tests
|
||||
run: python -m tests -n=2 --cov-report=xml
|
||||
- name: upload coverage report
|
||||
if: github.event.name == 'push'
|
||||
uses: codecov/[email protected]
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
fail_ci_if_error: true
|
||||
|
||||
|
||||
-26
@@ -32,32 +32,6 @@ jobs:
|
||||
before_install: bash ./scripts/ci/install.sh
|
||||
install:
|
||||
script: ./scripts/ci/check_patch.sh
|
||||
# test jobs
|
||||
- name: "3.7 on Windows"
|
||||
stage: test
|
||||
os: windows # Windows 10.0.17134 N/A Build 17134
|
||||
language: shell # 'language: python' is an error on Travis CI Windows
|
||||
env:
|
||||
- PYTHON_VERSION=3.7.5
|
||||
- PATH=/c/Python37:/c/Python37/Scripts:$PATH
|
||||
- name: "3.8 on Windows"
|
||||
os: windows # Windows 10.0.17134 N/A Build 17134
|
||||
language: shell # 'language: python' is an error on Travis CI Windows
|
||||
env:
|
||||
- PYTHON_VERSION=3.8.0
|
||||
- PATH=/c/Python38:/c/Python38/Scripts:$PATH
|
||||
- name: "3.6 on Linux"
|
||||
language: python
|
||||
python: 3.6
|
||||
- name: "3.7 on Linux"
|
||||
language: python
|
||||
python: 3.7
|
||||
- name: "3.8 on Linux"
|
||||
language: python
|
||||
python: 3.8
|
||||
- name: "3.7 on Mac"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
# build jobs
|
||||
- name: "Mac pkg"
|
||||
stage: build
|
||||
|
||||
@@ -107,6 +107,7 @@ tests_requirements = [
|
||||
"wheel>=0.31.1",
|
||||
# Test requirements:
|
||||
"pytest>=6.0.1",
|
||||
"pytest-cov",
|
||||
"pytest-docker>=0.7.2",
|
||||
"pytest-timeout>=1.3.3",
|
||||
"pytest-cov>=2.6.1",
|
||||
|
||||
@@ -208,9 +208,14 @@ def test_add_file_in_dir(tmp_dir, dvc):
|
||||
),
|
||||
(pytest.lazy_fixture("gs"), "md5", "8c7dd922ad47494fc02c388e12c00eac"),
|
||||
(
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("hdfs"),
|
||||
"checksum",
|
||||
"000002000000000000000000a86fe4d846edc1bf4c355cb6112f141e",
|
||||
marks=pytest.mark.xfail(
|
||||
reason="https://github.com/iterative/dvc/issues/4418"
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
indirect=["workspace"],
|
||||
|
||||
+20
-4
@@ -1,9 +1,10 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc import api
|
||||
from dvc.exceptions import FileMissingError, OutputNotFoundError
|
||||
from dvc.exceptions import DvcException, FileMissingError, OutputNotFoundError
|
||||
from dvc.path_info import URLInfo
|
||||
from dvc.utils.fs import remove
|
||||
from tests.unit.tree.test_repo import make_subrepo
|
||||
@@ -15,10 +16,16 @@ cloud_names = [
|
||||
"gdrive",
|
||||
"oss",
|
||||
"ssh",
|
||||
"hdfs",
|
||||
"http",
|
||||
]
|
||||
clouds = [pytest.lazy_fixture(cloud) for cloud in cloud_names]
|
||||
clouds = [pytest.lazy_fixture(cloud) for cloud in cloud_names] + [
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("hdfs"),
|
||||
marks=pytest.mark.xfail(
|
||||
reason="https://github.com/iterative/dvc/issues/4418"
|
||||
),
|
||||
)
|
||||
]
|
||||
all_clouds = [pytest.lazy_fixture("local_cloud")] + clouds
|
||||
|
||||
# `lazy_fixture` is confusing pylint, pylint: disable=unused-argument
|
||||
@@ -69,6 +76,7 @@ def test_open(tmp_dir, dvc, remote):
|
||||
@pytest.mark.parametrize(
|
||||
"cloud",
|
||||
[
|
||||
*[
|
||||
pytest.lazy_fixture(cloud)
|
||||
for cloud in [
|
||||
"real_s3", # NOTE: moto's s3 fails in some tests
|
||||
@@ -76,11 +84,19 @@ def test_open(tmp_dir, dvc, remote):
|
||||
"azure",
|
||||
"gdrive",
|
||||
"oss",
|
||||
"ssh",
|
||||
"hdfs",
|
||||
"http",
|
||||
]
|
||||
],
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("ssh"),
|
||||
marks=pytest.mark.xfail(
|
||||
raises=DvcException,
|
||||
condition=platform.system() == "Windows",
|
||||
reason="https://github.com/iterative/dvc/issues/4418",
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_open_external(erepo_dir, cloud):
|
||||
erepo_dir.add_remote(config=cloud.config)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import platform
|
||||
import stat
|
||||
|
||||
import configobj
|
||||
@@ -163,6 +164,10 @@ class TestCmdCacheDir(TestDvc):
|
||||
config = configobj.ConfigObj(self.dvc.config.files["repo"])
|
||||
self.assertEqual(config["cache"]["dir"], dname.replace("\\", "/"))
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.system() == "Darwin",
|
||||
reason="https://github.com/iterative/dvc/issues/4418",
|
||||
)
|
||||
def test_relative_path(self):
|
||||
tmpdir = self.mkdtemp()
|
||||
dname = relpath(tmpdir)
|
||||
|
||||
@@ -121,7 +121,12 @@ def test_import_url_with_no_exec(tmp_dir, dvc, erepo_dir):
|
||||
pytest.lazy_fixture("local_cloud"),
|
||||
pytest.lazy_fixture("s3"),
|
||||
pytest.lazy_fixture("gs"),
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("hdfs"),
|
||||
marks=pytest.mark.xfail(
|
||||
reason="https://github.com/iterative/dvc/issues/4418"
|
||||
),
|
||||
),
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("ssh"),
|
||||
marks=pytest.mark.skipif(
|
||||
|
||||
@@ -386,10 +386,15 @@ def test_run_overwrite_preserves_meta_and_comment(tmp_dir, dvc, run_copy):
|
||||
"37b51d194a7513e45b56f6524f2d51f2",
|
||||
),
|
||||
(
|
||||
pytest.param(
|
||||
pytest.lazy_fixture("hdfs"),
|
||||
"checksum",
|
||||
"0000020000000000000000003dba826b9be9c6a8e2f8310a770555c4",
|
||||
"00000200000000000000000075433c81259d3c38e364b348af52e84d",
|
||||
marks=pytest.mark.xfail(
|
||||
reason="https://github.com/iterative/dvc/issues/4418"
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
indirect=["workspace"],
|
||||
|
||||
@@ -6,7 +6,18 @@ from dvc.dvcfile import Dvcfile
|
||||
from tests.unit.tree.test_repo import make_subrepo
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cached", [True, False])
|
||||
@pytest.mark.parametrize(
|
||||
"cached",
|
||||
[
|
||||
True,
|
||||
pytest.param(
|
||||
False,
|
||||
marks=pytest.mark.skip(
|
||||
reason="https://github.com/iterative/dvc/issues/4418"
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_update_import(tmp_dir, dvc, erepo_dir, cached):
|
||||
gen = erepo_dir.dvc_gen if cached else erepo_dir.scm_gen
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ def docker():
|
||||
import os
|
||||
|
||||
# See https://travis-ci.community/t/docker-linux-containers-on-windows/301
|
||||
if os.environ.get("TRAVIS") and os.name == "nt":
|
||||
pytest.skip("disabled for Windows on Travis")
|
||||
if os.environ.get("CI") and os.name == "nt":
|
||||
pytest.skip("disabled for Windows on Github Actions")
|
||||
|
||||
try:
|
||||
subprocess.check_output("docker ps", shell=True)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.cache.local import LocalCache
|
||||
@@ -25,6 +27,10 @@ class TestLocalOutput(TestDvc):
|
||||
o.save()
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.system() == "Windows",
|
||||
reason="https://github.com/iterative/dvc/issues/4418",
|
||||
)
|
||||
def test_str_workdir_outside_repo(erepo_dir):
|
||||
stage = Stage(erepo_dir.dvc)
|
||||
output = LocalOutput(stage, "path", cache=False)
|
||||
|
||||
Reference in New Issue
Block a user