diff --git a/appveyor-windows-build-dotnet.yml b/appveyor-windows-build-dotnet.yml new file mode 100644 index 0000000000..22aec59923 --- /dev/null +++ b/appveyor-windows-build-dotnet.yml @@ -0,0 +1,71 @@ +version: 1.0.{build} +image: Windows Server 2019 +build: off + +# Change the clone folder to somewhere in "D:\" because this is shared by default with Docker. We need this to mount folders. +clone_folder: D:\source + +environment: + AWS_DEFAULT_REGION: us-east-1 + SAM_CLI_DEV: 1 + APPVEYOR_CI_OVERRIDE: 1 + + # In Windows, tempdir is usually in C:\. But in AppVeyor only D:\ is shared in Docker. + # Therefore change TEMPDIR it to D: for invoke tests to work. Python uses $TMPDIR envvar + # to find root of tempdir + TMPDIR: D:\tmp + TEMP: D:\tmp + TMP: D:\tmp + + # MSI Installers only use Py3.6.6. It is sufficient to test with this version here. + PYTHON_HOME: "C:\\Python36-x64" + PYTHON_SCRIPTS: "C:\\Python36-x64\\Scripts" + PYTHON_EXE: "C:\\Python36-x64\\python.exe" + PYTHON_VERSION: '3.6.8' + PYTHON_ARCH: '64' + HOME: 'C:\Users\appveyor' + HOMEDRIVE: 'C:' + HOMEPATH: 'C:\Users\appveyor' + +init: + # Uncomment this for RDP + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } + - ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } + + +install: + + # Make sure the temp directory exists for Python to use. + - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" + - "echo %PATH%" + - "python --version" + + # Upgrade setuptools, wheel and virtualenv + - "python -m pip install --upgrade setuptools wheel virtualenv" + + # Create new virtual environment with chosen python version and activate it + - "python -m virtualenv venv" + - "venv\\Scripts\\activate" + - "python --version" + + # Actually install SAM CLI's dependencies + - "pip install -e \".[dev]\"" + + # Switch to Docker Linux containers + - ps: Switch-DockerLinux + + # Echo final Path + - "echo %PATH%" + +test_script: + # Reactivate virtualenv before running tests + - "venv\\Scripts\\activate" + - "docker system prune -a -f" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_Dotnet_cli_package" + +# Uncomment for RDP +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor-windows-build-java.yml b/appveyor-windows-build-java.yml new file mode 100644 index 0000000000..ab3b93b399 --- /dev/null +++ b/appveyor-windows-build-java.yml @@ -0,0 +1,90 @@ +version: 1.0.{build} +image: Windows Server 2019 +build: off + +# Change the clone folder to somewhere in "D:\" because this is shared by default with Docker. We need this to mount folders. +clone_folder: D:\source + +environment: + AWS_DEFAULT_REGION: us-east-1 + SAM_CLI_DEV: 1 + APPVEYOR_CI_OVERRIDE: 1 + + # In Windows, tempdir is usually in C:\. But in AppVeyor only D:\ is shared in Docker. + # Therefore change TEMPDIR it to D: for invoke tests to work. Python uses $TMPDIR envvar + # to find root of tempdir + TMPDIR: D:\tmp + TEMP: D:\tmp + TMP: D:\tmp + + # MSI Installers only use Py3.6.6. It is sufficient to test with this version here. + PYTHON_HOME: "C:\\Python36-x64" + PYTHON_SCRIPTS: "C:\\Python36-x64\\Scripts" + PYTHON_EXE: "C:\\Python36-x64\\python.exe" + PYTHON_VERSION: '3.6.8' + PYTHON_ARCH: '64' + HOME: 'C:\Users\appveyor' + HOMEDRIVE: 'C:' + HOMEPATH: 'C:\Users\appveyor' + + matrix: + - optional_gate: true + +matrix: + allow_failures: + - optional_gate: true + +init: + # Uncomment this for RDP + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } + - ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } + + +install: + + # Make sure the temp directory exists for Python to use. + - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" + - "echo %PATH%" + - "python --version" + + # Upgrade setuptools, wheel and virtualenv + - "python -m pip install --upgrade setuptools wheel virtualenv" + + # Create new virtual environment with chosen python version and activate it + - "python -m virtualenv venv" + - "venv\\Scripts\\activate" + - "python --version" + + # Actually install SAM CLI's dependencies + - "pip install -e \".[dev]\"" + + # setup Java, Maven and Gradle + - "refreshenv" + - "choco install jdk8 -y --force" + - "refreshenv" + - "choco install maven -y --force" + - "refreshenv" + - "choco install gradle -y --force" + - "refreshenv" + - "java -version" + - "gradle -v" + - "mvn --version" + + # Switch to Docker Linux containers + - ps: Switch-DockerLinux + + # Echo final Path + - "echo %PATH%" + +test_script: + # Reactivate virtualenv before running tests + - "venv\\Scripts\\activate" + - "docker system prune -a -f" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_Java" + +# Uncomment for RDP +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor-windows-build-nodejs.yml b/appveyor-windows-build-nodejs.yml new file mode 100644 index 0000000000..bfbdd76833 --- /dev/null +++ b/appveyor-windows-build-nodejs.yml @@ -0,0 +1,77 @@ +version: 1.0.{build} +image: Windows Server 2019 +build: off + +# Change the clone folder to somewhere in "D:\" because this is shared by default with Docker. We need this to mount folders. +clone_folder: D:\source + +environment: + AWS_DEFAULT_REGION: us-east-1 + SAM_CLI_DEV: 1 + APPVEYOR_CI_OVERRIDE: 1 + + # In Windows, tempdir is usually in C:\. But in AppVeyor only D:\ is shared in Docker. + # Therefore change TEMPDIR it to D: for invoke tests to work. Python uses $TMPDIR envvar + # to find root of tempdir + TMPDIR: D:\tmp + TEMP: D:\tmp + TMP: D:\tmp + + # MSI Installers only use Py3.6.6. It is sufficient to test with this version here. + PYTHON_HOME: "C:\\Python36-x64" + PYTHON_SCRIPTS: "C:\\Python36-x64\\Scripts" + PYTHON_EXE: "C:\\Python36-x64\\python.exe" + PYTHON_VERSION: '3.6.8' + PYTHON_ARCH: '64' + HOME: 'C:\Users\appveyor' + HOMEDRIVE: 'C:' + HOMEPATH: 'C:\Users\appveyor' + +init: + # Uncomment this for RDP + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } + - ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } + + +install: + + # Make sure the temp directory exists for Python to use. + - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" + - "echo %PATH%" + - "python --version" + + # Upgrade setuptools, wheel and virtualenv + - "python -m pip install --upgrade setuptools wheel virtualenv" + + # Create new virtual environment with chosen python version and activate it + - "python -m virtualenv venv" + - "venv\\Scripts\\activate" + - "python --version" + + # Actually install SAM CLI's dependencies + - "pip install -e \".[dev]\"" + + + # To run Nodejs workflow integ tests + - "choco install nodejs-lts -y --force" + - "refreshenv" + + + # Switch to Docker Linux containers + - ps: Switch-DockerLinux + + # Echo final Path + - "echo %PATH%" + +test_script: + # Reactivate virtualenv before running tests + - "venv\\Scripts\\activate" + - "docker system prune -a -f" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_NodeFunctions" + +# Uncomment for RDP +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor-windows-build-python.yml b/appveyor-windows-build-python.yml new file mode 100644 index 0000000000..a20d9b06ce --- /dev/null +++ b/appveyor-windows-build-python.yml @@ -0,0 +1,72 @@ +version: 1.0.{build} +image: Windows Server 2019 +build: off + +# Change the clone folder to somewhere in "D:\" because this is shared by default with Docker. We need this to mount folders. +clone_folder: D:\source + +environment: + AWS_DEFAULT_REGION: us-east-1 + SAM_CLI_DEV: 1 + APPVEYOR_CI_OVERRIDE: 1 + + # In Windows, tempdir is usually in C:\. But in AppVeyor only D:\ is shared in Docker. + # Therefore change TEMPDIR it to D: for invoke tests to work. Python uses $TMPDIR envvar + # to find root of tempdir + TMPDIR: D:\tmp + TEMP: D:\tmp + TMP: D:\tmp + + # MSI Installers only use Py3.6.6. It is sufficient to test with this version here. + PYTHON_HOME: "C:\\Python36-x64" + PYTHON_SCRIPTS: "C:\\Python36-x64\\Scripts" + PYTHON_EXE: "C:\\Python36-x64\\python.exe" + PYTHON_VERSION: '3.6.8' + PYTHON_ARCH: '64' + HOME: 'C:\Users\appveyor' + HOMEDRIVE: 'C:' + HOMEPATH: 'C:\Users\appveyor' + +init: + # Uncomment this for RDP + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } + - ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } + + +install: + + # Make sure the temp directory exists for Python to use. + - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" + - "echo %PATH%" + - "python --version" + + # Upgrade setuptools, wheel and virtualenv + - "python -m pip install --upgrade setuptools wheel virtualenv" + + # Create new virtual environment with chosen python version and activate it + - "python -m virtualenv venv" + - "venv\\Scripts\\activate" + - "python --version" + + # Actually install SAM CLI's dependencies + - "pip install -e \".[dev]\"" + # Switch to Docker Linux containers + - ps: Switch-DockerLinux + + # Echo final Path + - "echo %PATH%" + +test_script: + # Reactivate virtualenv before running tests + - "venv\\Scripts\\activate" + - "docker system prune -a -f" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_PythonFunctions" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_SingleFunctionBuilds" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_ErrorCases" + +# Uncomment for RDP +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor-windows-build-ruby.yml b/appveyor-windows-build-ruby.yml new file mode 100644 index 0000000000..18bbf966ec --- /dev/null +++ b/appveyor-windows-build-ruby.yml @@ -0,0 +1,88 @@ +version: 1.0.{build} +image: Windows Server 2019 +build: off + +# Change the clone folder to somewhere in "D:\" because this is shared by default with Docker. We need this to mount folders. +clone_folder: D:\source + +environment: + AWS_DEFAULT_REGION: us-east-1 + SAM_CLI_DEV: 1 + APPVEYOR_CI_OVERRIDE: 1 + + # In Windows, tempdir is usually in C:\. But in AppVeyor only D:\ is shared in Docker. + # Therefore change TEMPDIR it to D: for invoke tests to work. Python uses $TMPDIR envvar + # to find root of tempdir + TMPDIR: D:\tmp + TEMP: D:\tmp + TMP: D:\tmp + + # MSI Installers only use Py3.6.6. It is sufficient to test with this version here. + PYTHON_HOME: "C:\\Python36-x64" + PYTHON_SCRIPTS: "C:\\Python36-x64\\Scripts" + PYTHON_EXE: "C:\\Python36-x64\\python.exe" + PYTHON_VERSION: '3.6.8' + PYTHON_ARCH: '64' + HOME: 'C:\Users\appveyor' + HOMEDRIVE: 'C:' + HOMEPATH: 'C:\Users\appveyor' + + matrix: + - optional_gate: true + +matrix: + allow_failures: + - optional_gate: true + +init: + # Uncomment this for RDP + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } + - ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } + + +install: + + # Make sure the temp directory exists for Python to use. + - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" + - "echo %PATH%" + - "python --version" + + # Upgrade setuptools, wheel and virtualenv + - "python -m pip install --upgrade setuptools wheel virtualenv" + + # Create new virtual environment with chosen python version and activate it + - "python -m virtualenv venv" + - "venv\\Scripts\\activate" + - "python --version" + + # Actually install SAM CLI's dependencies + - "pip install -e \".[dev]\"" + + # setup Ruby + - "choco install ruby --version 2.5.3.1 --force -y" + - "refreshenv" + - "ruby --version" + - "gem --version" + - "gem install bundler -v 2.0.2" + - "refreshenv" + - "bundler --version" + - "echo %PATH%" + + # Switch to Docker Linux containers + - ps: Switch-DockerLinux + + # Echo final Path + - "echo %PATH%" + +test_script: + # Reactivate virtualenv before running tests + - "venv\\Scripts\\activate" + - "docker system prune -a -f" + - "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_RubyFunctions" + +# Uncomment for RDP +# on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor-windows.yml b/appveyor-windows.yml index 2aca76c3ff..3243f006a6 100644 --- a/appveyor-windows.yml +++ b/appveyor-windows.yml @@ -40,6 +40,8 @@ install: # Make sure the temp directory exists for Python to use. - ps: "mkdir -Force D:\\tmp" + - "SET PATH=%PYTHON_HOME%;%PATH%" + - "echo %PYTHON_HOME%" - "echo %PATH%" - "python --version" @@ -47,42 +49,13 @@ install: - "python -m pip install --upgrade setuptools wheel virtualenv" # Create new virtual environment with chosen python version and activate it - - "rm -rf venv" - - "dir C:\\Python36-x64" - - "virtualenv -p %PYTHON_EXE% venv" + - "python -m virtualenv venv" - "venv\\Scripts\\activate" - - "python -c \"import sys; print(sys.executable)\"" - "python --version" # Actually install SAM CLI's dependencies - "pip install -e \".[dev]\"" - - # To run Nodejs workflow integ tests - - "choco install nodejs-lts -y --force" - - "refreshenv" - # setup Ruby - - "choco install ruby --version 2.5.3.1 --force -y" - - "refreshenv" - - "ruby --version" - - "gem --version" - - "gem install bundler -v 2.0.2" - - "refreshenv" - - "bundler --version" - - "echo %PATH%" - - # setup Java, Maven and Gradle - - "refreshenv" - - "choco install jdk8 -y --force" - - "refreshenv" - - "choco install maven -y --force" - - "refreshenv" - - "choco install gradle -y --force" - - "refreshenv" - - "java -version" - - "gradle -v" - - "mvn --version" - # Switch to Docker Linux containers - ps: Switch-DockerLinux diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py index a07ccc7e7c..fef5a26dea 100644 --- a/tests/integration/buildcmd/test_build_cmd.py +++ b/tests/integration/buildcmd/test_build_cmd.py @@ -11,13 +11,16 @@ from parameterized import parameterized from .build_integ_base import BuildIntegBase -from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI +from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, CI_OVERRIDE LOG = logging.getLogger(__name__) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_PythonFunctions(BuildIntegBase): EXPECTED_FILES_GLOBAL_MANIFEST = set() @@ -100,7 +103,10 @@ def _get_python_version(self): return "python{}.{}".format(sys.version_info.major, sys.version_info.minor) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_ErrorCases(BuildIntegBase): def test_unsupported_runtime(self): overrides = {"Runtime": "unsupportedpython", "CodeUri": "Python"} @@ -116,7 +122,10 @@ def test_unsupported_runtime(self): self.assertIn("Build Failed", process_stdout) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_NodeFunctions(BuildIntegBase): EXPECTED_FILES_GLOBAL_MANIFEST = set() @@ -184,7 +193,10 @@ def _verify_built_artifact(self, build_dir, function_logical_id, expected_files, self.assertEqual(actual_files, expected_modules) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_RubyFunctions(BuildIntegBase): EXPECTED_FILES_GLOBAL_MANIFEST = set() @@ -251,7 +263,10 @@ def _verify_built_artifact(self, build_dir, function_logical_id, expected_files, self.assertTrue(any([True if self.EXPECTED_RUBY_GEM in gem else False for gem in os.listdir(str(gem_path))])) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_Java(BuildIntegBase): EXPECTED_FILES_PROJECT_MANIFEST_GRADLE = {"aws", "lib", "META-INF"} @@ -340,7 +355,10 @@ def _change_to_unix_line_ending(self, path): open_file.write(content) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_Dotnet_cli_package(BuildIntegBase): FUNCTION_LOGICAL_ID = "Function" @@ -438,7 +456,10 @@ def _verify_built_artifact(self, build_dir, function_logical_id, expected_files) self.assertEqual(actual_files, expected_files) -@skipIf(IS_WINDOWS and RUNNING_ON_CI, "Skip build tests on windows when running in CI") +@skipIf( + ((IS_WINDOWS and RUNNING_ON_CI) and not CI_OVERRIDE), + "Skip build tests on windows when running in CI unless overridden", +) class TestBuildCommand_SingleFunctionBuilds(BuildIntegBase): template = "many-functions-template.yaml" diff --git a/tests/testing_utils.py b/tests/testing_utils.py index ce0b3fc0ff..293e6e9676 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -4,3 +4,4 @@ IS_WINDOWS = platform.system().lower() == "windows" RUNNING_ON_CI = os.environ.get("APPVEYOR", False) RUNNING_TEST_FOR_MASTER_ON_CI = os.environ.get("APPVEYOR_REPO_BRANCH", "master") != "master" +CI_OVERRIDE = os.environ.get("APPVEYOR_CI_OVERRIDE", False)