Skip to content

Commit

Permalink
chore: Migrate from Travis to AppVeyor for Linux builds (aws#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanathkr authored and viksrivat committed Aug 14, 2019
1 parent 824f3a7 commit 9e515ae
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 85 deletions.
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

69 changes: 45 additions & 24 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,69 @@
version: 1.0.{build}
image: Visual Studio 2017
build: off
image:
- Ubuntu
- Visual Studio 2017

environment:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: 1

matrix:

- PYTHON_HOME: "C:\\Python27-x64"
PYTHON_VERSION: '2.7'
PYTHON_VERSION: '2.7.16'
PYTHON_ARCH: '32'

- PYTHON_HOME: "C:\\Python36-x64"
PYTHON_VERSION: '3.6'
PYTHON_VERSION: '3.6.8'
PYTHON_ARCH: '64'

# Testing on both 32bit and 64bit Windows only for Latest Python version,
# because MSIs installers use Latest Python version
- PYTHON_HOME: "C:\\Python37"
PYTHON_VERSION: '3.7'
PYTHON_ARCH: '32'

- PYTHON_HOME: "C:\\Python37-x64"
PYTHON_VERSION: '3.7'
PYTHON_VERSION: '3.7.4'
PYTHON_ARCH: '64'

install:
for:
-
matrix:
only:
- image: Visual Studio 2017

install:
# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"

# Create new virtual environment and activate it
- "rm -rf venv"
- "python -m virtualenv venv"
- "venv/Scripts/activate"

-
matrix:
only:
- image: Ubuntu
install:
- sh: "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
- sh: "PATH=$JAVA_HOME/bin:$PATH"
- sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate"
- sh: "rvm use 2.5"

# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"
# Install latest gradle
- sh: "sudo apt-get -y remove gradle"
- sh: "wget https://services.gradle.org/distributions/gradle-5.5-bin.zip -P /tmp"
- sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip"
- sh: "PATH=/opt/gradle/gradle-5.5/bin:$PATH"

# Create new virtual environment and activate it
- "rm -rf venv"
- "python -m virtualenv venv"
- "venv\\Scripts\\activate"
- "python -c \"import sys; print(sys.executable)\""
build_script:
- "python -c \"import sys; print(sys.executable)\""

# Actually install SAM CLI's dependencies
- "pip install -e \".[dev]\""
# Actually install SAM CLI's dependencies
- "pip install -e \".[dev]\""

test_script:
- "pytest --cov samcli --cov-report term-missing --cov-fail-under 95 tests\\unit"
- "pytest --cov samcli --cov-report term-missing --cov-fail-under 95 tests/unit"
- "flake8 samcli"
- "flake8 tests\\unit tests\\integration"
- "flake8 tests/unit tests/integration"
- "pylint --rcfile .pylintrc samcli"

# Runs only in Linux
- sh: "pytest -vv tests/integration"

4 changes: 2 additions & 2 deletions tests/integration/local/invoke/test_integrations_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

from tests.integration.local.invoke.layer_utils import LayerUtils
from .invoke_integ_base import InvokeIntegBase
from tests.testing_utils import IS_WINDOWS, RUNNING_ON_TRAVIS, RUNNING_TEST_FOR_MASTER_ON_TRAVIS
from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI

# Layers tests require credentials and Travis will only add credentials to the env if the PR is from the same repo.
# This is to restrict layers tests to run outside of Travis and when the branch is not master.
SKIP_LAYERS_TESTS = RUNNING_ON_TRAVIS and RUNNING_TEST_FOR_MASTER_ON_TRAVIS
SKIP_LAYERS_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI

try:
from pathlib import Path
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/publish/test_command_integ.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import re
import json
from subprocess import Popen, PIPE
Expand All @@ -7,13 +6,14 @@

from samcli.commands.publish.command import SEMANTIC_VERSION
from .publish_app_integ_base import PublishAppIntegBase
from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI

# Publish tests require credentials and Travis will only add credentials to the env if the PR is from the same repo.
# This is to restrict publish tests to run outside of Travis and when the branch is not master.
SKIP_PUBLISH_TESTS = os.environ.get("TRAVIS", False) and os.environ.get("TRAVIS_BRANCH", "master") != "master"
# Publish tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo.
# This is to restrict publish tests to run outside of CI/CD and when the branch is not master.
SKIP_PUBLISH_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI


@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in Travis only")
@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in CI/CD only")
class TestPublishExistingApp(PublishAppIntegBase):

def setUp(self):
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_create_application_version_with_semantic_version_option(self):
self.assert_metadata_details(app_metadata, process_stdout.decode('utf-8'))


@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in Travis only")
@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in CI/CD only")
class TestPublishNewApp(PublishAppIntegBase):

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/telemetry/integ_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run_cmd(self, stdin_data="", optout_envvar_value=None):

env = os.environ.copy()

# remove the envvar which usually is set in Travis. This interferes with tests
# remove the envvar which usually is set in CI/CD. This interferes with tests
env.pop("SAM_CLI_TELEMETRY", None)
if optout_envvar_value:
# But if the caller explicitly asked us to opt-out via EnvVar, then set it here
Expand Down
4 changes: 2 additions & 2 deletions tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
import platform

IS_WINDOWS = platform.system().lower() == 'windows'
RUNNING_ON_TRAVIS = os.environ.get("TRAVIS", False)
RUNNING_TEST_FOR_MASTER_ON_TRAVIS = os.environ.get("TRAVIS_BRANCH", "master") != "master"
RUNNING_ON_CI = os.environ.get("APPVEYOR", False)
RUNNING_TEST_FOR_MASTER_ON_CI = os.environ.get("APPVEYOR_REPO_BRANCH", "master") != "master"

0 comments on commit 9e515ae

Please sign in to comment.