diff --git a/.appveyor.yml b/.appveyor.yml index d552bb7ec..560516cfb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -5,11 +5,13 @@ branches: platform: x86 environment: - my_variable: aws_access_key_id: secure: veTfhOrd4wUpG7NlRsvS3tufuaFfST8i7SZa2HVH6Vc= aws_secret_access_key: secure: nCQcN/Mzce0erwcNOU3yAuWgF6ZuTvPBEqTF3XFp1poGcDbSIg+s67eVxsxWCXQj + GOOGLE_APPLICATION_CREDENTIALS: gcp-creds.json + GCP_CREDS: + secure: 96fJ3r2i2GohbXHwnSs5N4EplQ7q8YmLpPWM0AC+f4s= matrix: @@ -42,6 +44,8 @@ install: - cinst graphviz - cinst wget - cinst awscli + - cinst gsutil + - cinst openssl.light - wget --no-check-certificate https://github.com/dpinney/omf/raw/master/omf/static/pygraphviz-1.3.1-cp27-none-win32.whl - pip install pygraphviz-1.3.1-cp27-none-win32.whl - pip install -r requirements.txt @@ -52,6 +56,7 @@ build: false before_test: - aws configure set aws_access_key_id "%aws_access_key_id%" - aws configure set aws_secret_access_key "%aws_secret_access_key%" + - openssl enc -d -aes-256-cbc -md md5 -k "%GCP_CREDS%" -in scripts\ci\gcp-creds.json.enc -out scripts\ci\gcp-creds.json & exit 0 - pip install -r test-requirements.txt test_script: diff --git a/scripts/ci/gcp-creds.json.enc b/scripts/ci/gcp-creds.json.enc new file mode 100644 index 000000000..d18531f9d Binary files /dev/null and b/scripts/ci/gcp-creds.json.enc differ diff --git a/scripts/ci/install.sh b/scripts/ci/install.sh index 693c45dce..b84e58568 100644 --- a/scripts/ci/install.sh +++ b/scripts/ci/install.sh @@ -21,3 +21,4 @@ printf "[default]\n" > ~/.aws/credentials printf "aws_access_key_id = $AWS_ACCESS_KEY_ID\n" >> ~/.aws/credentials printf "aws_secret_access_key = $AWS_SECRET_ACCESS_KEY\n" >> ~/.aws/credentials printf "[default]\n" > ~/.aws/config +openssl enc -d -aes-256-cbc -md md5 -k $GCP_CREDS -in scripts/ci/gcp-creds.json.enc -out scripts/ci/gcp-creds.json || true diff --git a/tests/basic_env.py b/tests/basic_env.py index 4101b9494..68ed97a89 100644 --- a/tests/basic_env.py +++ b/tests/basic_env.py @@ -8,6 +8,7 @@ from dvc.project import Project class TestDir(TestCase): + GCP_CREDS_FILE = os.path.abspath(os.path.join('scripts', 'ci', 'gcp-creds.json')) DATA_DIR = 'data_dir' DATA_SUB_DIR = os.path.join(DATA_DIR, 'data_sub_dir') DATA = os.path.join(DATA_DIR, 'data') diff --git a/tests/test_data_cloud.py b/tests/test_data_cloud.py index d47c5f314..508fea7be 100644 --- a/tests/test_data_cloud.py +++ b/tests/test_data_cloud.py @@ -128,24 +128,29 @@ class TestDataCloudAWS(TestDataCloudBase): class TestDataCloudGCP(TestDataCloudBase): - TEST_REPO_GCP = 'dvc-test/myrepo' + TEST_REPO_GCP_BUCKET = 'dvc-test' TEST_REPO_GCP_PROJECT='dvc-project' def _should_test(self): if os.getenv("DVC_TEST_GCP") == "true": return True + if os.getenv("GOOGLE_APPLICATION_CREDENTIALS") and os.getenv("GCP_CREDS"): + return True + return False def _setup_cloud(self): if not self._should_test(): return - # Cleanup - os.system("gsutil rm -rf gs://{}/".format(self.TEST_REPO_GCP)) + if os.getenv("GOOGLE_APPLICATION_CREDENTIALS") and os.getenv("GCP_CREDS"): + shutil.copyfile(self.GCP_CREDS_FILE, os.getenv("GOOGLE_APPLICATION_CREDENTIALS")) + + repo = self.TEST_REPO_GCP_BUCKET + '/' + str(uuid.uuid4()) # Setup cloud - config = {'StoragePath': self.TEST_REPO_GCP, + config = {'StoragePath': repo, 'Region': self.TEST_REPO_GCP_PROJECT} cloud_settings = CloudSettings(self.dvc.cache.cache_dir, None, config) self.cloud = DataCloudGCP(cloud_settings)