Skip to content

Commit

Permalink
github actions tests: initial (iterative#4469)
Browse files Browse the repository at this point in the history
* github actions tests: initial

* build: tests: add codecov action
  • Loading branch information
pared authored Sep 22, 2020
1 parent 2b3c30c commit b31bd1c
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 51 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def run(self):
"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",
Expand Down
11 changes: 8 additions & 3 deletions tests/func/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,14 @@ def test_add_file_in_dir(tmp_dir, dvc):
),
(pytest.lazy_fixture("gs"), "md5", "8c7dd922ad47494fc02c388e12c00eac"),
(
pytest.lazy_fixture("hdfs"),
"checksum",
"000002000000000000000000a86fe4d846edc1bf4c355cb6112f141e",
pytest.param(
pytest.lazy_fixture("hdfs"),
"checksum",
"000002000000000000000000a86fe4d846edc1bf4c355cb6112f141e",
marks=pytest.mark.xfail(
reason="https://github.com/iterative/dvc/issues/4418"
),
)
),
],
indirect=["workspace"],
Expand Down
44 changes: 30 additions & 14 deletions tests/func/test_api.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,10 +16,16 @@
"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
Expand Down Expand Up @@ -69,17 +76,26 @@ 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
"gs",
"azure",
"gdrive",
"oss",
"ssh",
"hdfs",
"http",
]
*[
pytest.lazy_fixture(cloud)
for cloud in [
"real_s3", # NOTE: moto's s3 fails in some tests
"gs",
"azure",
"gdrive",
"oss",
"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):
Expand Down
5 changes: 5 additions & 0 deletions tests/func/test_cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import stat

import configobj
Expand Down Expand Up @@ -163,6 +164,10 @@ def test_abs_path(self):
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)
Expand Down
7 changes: 6 additions & 1 deletion tests/func/test_import_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.lazy_fixture("hdfs"),
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(
Expand Down
13 changes: 9 additions & 4 deletions tests/func/test_run_multistage.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,15 @@ def test_run_overwrite_preserves_meta_and_comment(tmp_dir, dvc, run_copy):
"37b51d194a7513e45b56f6524f2d51f2",
),
(
pytest.lazy_fixture("hdfs"),
"checksum",
"0000020000000000000000003dba826b9be9c6a8e2f8310a770555c4",
"00000200000000000000000075433c81259d3c38e364b348af52e84d",
pytest.param(
pytest.lazy_fixture("hdfs"),
"checksum",
"0000020000000000000000003dba826b9be9c6a8e2f8310a770555c4",
"00000200000000000000000075433c81259d3c38e364b348af52e84d",
marks=pytest.mark.xfail(
reason="https://github.com/iterative/dvc/issues/4418"
),
)
),
],
indirect=["workspace"],
Expand Down
13 changes: 12 additions & 1 deletion tests/func/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
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

Expand Down
4 changes: 2 additions & 2 deletions tests/remotes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/output/test_local.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import platform

import pytest
from mock import patch

from dvc.cache.local import LocalCache
Expand All @@ -25,6 +27,10 @@ def test_save_missing(self):
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)
Expand Down

0 comments on commit b31bd1c

Please sign in to comment.