diff --git a/.ci/AppVeyor.ps1 b/.ci/AppVeyor.ps1 new file mode 100644 index 0000000000..2aa397831c --- /dev/null +++ b/.ci/AppVeyor.ps1 @@ -0,0 +1,22 @@ +. .ci/FudgeGenerateFake.ps1 +. .ci/PrepareAVVM.ps1 + +function Set-Python-Arch +{ + # run_with_env.cmd needs PYTHON_ARCH set to 64 for x64 + if ($env:Platform -eq 'x64') + { + Set-ItemProperty -path 'HKCU:\Environment' -name 'PYTHON_ARCH' -value '64' + } +} + +function Fix-AppVeyor +{ + Set-Python-Arch + + $config = Get-FudgefileContent .ci/Fudgefile.appveyor + + PackFakeNupkgs $config.packages + + Setup-Products $config.packages +} diff --git a/.ci/FudgeGenerateFake.ps1 b/.ci/FudgeGenerateFake.ps1 new file mode 100644 index 0000000000..0431e4241e --- /dev/null +++ b/.ci/FudgeGenerateFake.ps1 @@ -0,0 +1,61 @@ +Set-StrictMode -Version latest + +function GenerateFakeNuspec +{ + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $name, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $version + ) + + $template = Get-Content .ci\nuspecs\template.nuspec.in + + $content = $template -replace '{name}', $name + $content = $content -replace '{version}', $version + + $nuspec = ('.ci\nuspecs\' + $name + '.nuspec') + + Set-Content $nuspec $content + + Write-Output "Created $nuspec" +} + +function GenerateFakeNuspecs +{ + param ( + [array] + $Packages + ) + + foreach ($pkg in $Packages) + { + GenerateFakeNuspec $pkg.name $pkg.version + } +} + +function PackFakeNupkgs +{ + param ( + [array] + $Packages + ) + + GenerateFakeNuspecs $Packages + + foreach ($pkg in $Packages) + { + $filename = ($pkg.name + '.nuspec') + choco pack ".ci\nuspecs\$filename" > $null + } + mv *.nupkg .ci\nuspecs\ + + # fudge pack -FudgefilePath .ci/Fudgefile.appveyor + + Write-Output 'Packed!' +} diff --git a/.ci/FudgePostInstall.ps1 b/.ci/FudgePostInstall.ps1 new file mode 100644 index 0000000000..ff7d1efebb --- /dev/null +++ b/.ci/FudgePostInstall.ps1 @@ -0,0 +1,182 @@ +. $env:ChocolateyInstall\helpers\functions\Write-FunctionCallLogMessage.ps1 +. $env:ChocolateyInstall\helpers\functions\Get-EnvironmentVariable.ps1 +. $env:ChocolateyInstall\helpers\functions\Get-EnvironmentVariableNames.ps1 +. $env:ChocolateyInstall\helpers\functions\Start-ChocolateyProcessAsAdmin.ps1 +. $env:ChocolateyInstall\helpers\functions\Set-EnvironmentVariable.ps1 +. $env:ChocolateyInstall\helpers\functions\Set-PowerShellExitCode.ps1 +. $env:ChocolateyInstall\helpers\functions\Update-SessionEnvironment.ps1 +. $env:ChocolateyInstall\helpers\functions\Write-FunctionCallLogMessage.ps1 +. $env:ChocolateyInstall\helpers\functions\Install-ChocolateyPath.ps1 + +Set-StrictMode -Version latest + + +function Get-PHP-Root +{ + $list = Get-ChildItem -Directory 'C:\tools\' | Out-String + Write-Verbose $list + + Get-ChildItem -Directory 'C:\tools\' -filter 'php*' | % { + $PHP_ROOT = $_.FullName + + Write-Host 'Setting PHP_ROOT='$PHP_ROOT + + Set-ItemProperty -path 'HKCU:\Environment' -name 'PHP_ROOT' -value $PHP_ROOT + } + if ($PHP_ROOT) { + return $PHP_ROOT + } + throw ('php not found in ' + $list) +} + +function Create-PHP-Ini +{ + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $PHP_ROOT + ) + + $PHP_INI = ($PHP_ROOT + '\php.ini') + + Write-Host 'Creating '$PHP_INI + + cp ($PHP_INI + '-production') $PHP_INI + sed -i 's/;date.timezone =.*/date.timezone=UTC/' $PHP_INI + + $list = Get-ChildItem -Recurse $PHP_ROOT | Out-String + Write-Verbose ('php dir ' + $list) + + Write-Host 'Enabling PHP openssl ...' + + $openssl_dll = '' + + Get-ChildItem $PHP_ROOT -Recurse -filter '*openssl*.dll' | % { + $openssl_dll = $_.FullName + Write-Host ' found '$openssl_dll + } + if (! $openssl_dll) { + Write-Host ' not found' + throw ('openssl not found in ' + $list) + } + + sed -i 's/;extension=openssl/extension=openssl/' $PHP_INI + + $dir = Split-Path -Path $openssl_dll + Write-Host 'Setting extension directory: '$dir + + (Get-Content $PHP_INI) | % { + $_ -replace ';extension_dir *=.*', ('extension_dir="' + $dir + '"') + } | Set-Content $PHP_INI + + grep '^extension' $PHP_INI +} + +function Install-PEAR +{ + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $PHP_ROOT + ) + + $PHP = ($PHP_ROOT + '\php.exe') + + Write-Host 'Installing PEAR' + + $pear_install_url = 'http://pear.php.net/install-pear-nozlib.phar' + $phar = $env:TMP + '\install-pear.phar' + + curl -o $phar $pear_install_url + + $opts = ('-b ' + $PHP_ROOT + ' -d ' + $PHP_ROOT + ' -p ' + $PHP) + + Invoke-Expression ($PHP + ' ' + $phar + ' ' + $opts) +} + +function Update-PEAR +{ + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $PHP_ROOT + ) + + $PHP = ($PHP_ROOT + '\php.exe') + + Write-Host 'Updating PEAR channel pear.php.net' + + $pearcmd = ($PHP_ROOT + '\pearcmd.php') + + $pear_update_cmd = ($PHP + ' ' + $pearcmd + ' channel-update pear.php.net') + + Invoke-Expression $pear_update_cmd +} + +function Add-R-to-PATH +{ + $list = Get-ChildItem -Directory 'C:\Program Files\R' | Out-String + Write-Verbose $list + + Get-ChildItem -Directory 'C:\Program Files\R' | % { + $R_ROOT = $_.FullName + + # $R_ROOT = $R_ROOT -replace 'C:\\Program Files', '%ProgramFiles%' + + Write-Host 'Setting R_ROOT='$R_ROOT + + Set-ItemProperty -path 'HKCU:\Environment' -name 'R_ROOT' -value $R_ROOT + + $R_BIN = ($R_ROOT + '\bin') + + Install-ChocolateyPath -PathToInstall $R_BIN + } + if ($R_ROOT) { + return $R_ROOT + } + throw ('R not found in ' + $list) +} + +function Update-Cabal +{ + cabal update +} + +function PPM-Install-cpanm +{ + ppm install App-cpanminus +} + +function Install-GoMetaLinter +{ + go.exe get -u gopkg.in/alecthomas/gometalinter.v2 +} + +function Install-GoPM +{ + go.exe get -u github.com/gpmgo/gopm + go.exe install github.com/gpmgo/gopm +} + +function Fixes +{ + $PHP_ROOT = Get-PHP-Root + + Create-PHP-Ini $PHP_ROOT + Install-PEAR $PHP_ROOT + Update-PEAR $PHP_ROOT + + Add-R-to-PATH + + Update-Cabal + + PPM-Install-cpanm + + Install-GoMetaLinter + Install-GoPM + + return $LastExitCode +} diff --git a/.ci/Fudgefile.appveyor b/.ci/Fudgefile.appveyor new file mode 100644 index 0000000000..b0abed8a80 --- /dev/null +++ b/.ci/Fudgefile.appveyor @@ -0,0 +1,24 @@ +{ + "scripts": { + "pre": { + "install": ". .ci/AppVeyor.ps1; Fix-AppVeyor" + } + }, + "source": ".ci/nuspecs", + "packages": [ + { "name": "python", "version": "3.6.8" }, + { "name": "nodejs", "version": "11.13.0" }, + { "name": "ruby", "version": "2.6.1.1" }, + { "name": "golang", "version": "1.9.7" }, + { "name": "StrawberryPerl", "version": "5.28.0.1" }, + { "name": "miniconda3", "version": "4.5.12" } + ], + "pack": { + "python": ".ci/nuspecs/python.nuspec", + "nodejs": ".ci/nuspecs/nodejs.nuspec", + "ruby": ".ci/nuspecs/ruby.nuspec", + "golang": ".ci/nuspecs/golang.nuspec", + "StrawberryPerl": ".ci/nuspecs/StrawberryPerl.nuspec", + "miniconda3": ".ci/nuspecs/miniconda3.nuspec" + } +} diff --git a/.ci/PrepareAVVM.ps1 b/.ci/PrepareAVVM.ps1 new file mode 100644 index 0000000000..66dd2260b7 --- /dev/null +++ b/.ci/PrepareAVVM.ps1 @@ -0,0 +1,285 @@ +Set-StrictMode -Version latest + +$PACKAGES_ROOT = "$env:SYSTEMDRIVE\avvm" +$REGISTRY_ROOT = 'HKLM:\Software\AppVeyor\VersionManager' + +function Get-Version([string]$str) { + $versionDigits = $str.Split('.') + $version = @{ + major = -1 + minor = -1 + build = -1 + revision = -1 + number = 0 + value = $null + } + + $version.value = $str + + if($versionDigits -and $versionDigits.Length -gt 0) { + $version.major = [int]$versionDigits[0] + } + if($versionDigits.Length -gt 1) { + $version.minor = [int]$versionDigits[1] + } + if($versionDigits.Length -gt 2) { + $version.build = [int]$versionDigits[2] + } + if($versionDigits.Length -gt 3) { + $version.revision = [int]$versionDigits[3] + } + + for($i = 0; $i -lt $versionDigits.Length; $i++) { + $version.number += [long]$versionDigits[$i] -shl 16 * (3 - $i) + } + + return $version +} + +function SetInstalledProductVersion { + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $product, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $version, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $platform + ) + + $productRegPath = "$REGISTRY_ROOT\$product" + New-Item $productRegPath -Force | Out-Null + New-ItemProperty -Path $productRegPath -Name Version -PropertyType String -Value $version -Force | Out-Null + New-ItemProperty -Path $productRegPath -Name Platform -PropertyType String -Value $platform -Force | Out-Null + + Write-Output "Creating C:\avvm\$product\$version\$platform" + + if (!(Test-Path "C:\avvm\$product\$version\$platform")) { + mkdir "C:\avvm\$product\$version\$platform" -Force > $null + } + + if (!(Test-Path "C:\avvm\$product\$version\$platform")) { + throw "Something went wrong" + } + +} + +function GetInstalledProductVersion($product) { + $productRegPath = "$REGISTRY_ROOT\$product" + if(Test-Path $productRegPath) { + $ver = Get-ItemProperty -Path $productRegPath + @{ + Product = $product + Version = $ver.Version + Platform = $ver.Platform + } + } +} + +function Add-Product +{ + param ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $product, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $version, + + [string] + $platform + ) + + $name = $product + + if (! $platform) { + $platform = $env:platform + } + + $installed = GetInstalledProductVersion $Product + if ($installed) { + if ($installed.Version -eq $version) { + if ($installed.Platform -eq $env:platform) { + Write-Output "$product $version $env:platform already set up" + return; + } + } + } + + $shortver = ($version.split('.'))[0..1] + $shortver = "{0}{1}" -f ($shortver[0], $shortver[1]) + + $dir_name = $name; + + if (Test-Path "C:\avvm\$name\$version\") { + Write-Output "C:\avvm\$name\$version exists; skipping" + + $base = 'https://appveyordownloads.blob.core.windows.net/avvm' + $versions_content = (New-Object Net.WebClient).DownloadString("$base/$name-versions.txt") + Set-Content "C:\avvm\$name-versions.txt" $versions_content + return + } + + if ($installed) { + $current_version = $installed.Version + if ((Get-Version $current_version).number > (Get-Version $version).number) { + $versions_content = "$current_version +$version +lts:$version +stable:$version +current:$current_version +" + } else { + $versions_content = "$version +$current_version +lts:$version +stable:$version +current:$current_version +" + } + } + else { + $versions_content = "$version +lts:$version +stable:$version +" + } + Set-Content "C:\avvm\$name-versions.txt" $versions_content + + Write-Output "Wrote C:\avvm\$name-versions.txt" + + mkdir "C:\avvm\$name" -Force > $null + + mkdir "C:\avvm\$name\$version" -Force > $null + + Write-Verbose "Looking for $shortver C:\$dir_name$shortver .." + + if (!( Test-Path "C:\$dir_name$shortver")) { + throw "Cant find $dir_name$shortver" + } + + mkdir "C:\avvm\$name\$version\$platform" -Force > $null + + Write-Output "Looking for C:\$name$shortver-x64 .." + + $dir = '' + if (Test-Path "C:\$dir_name$shortver-x64") { + if ($platform -eq "x64") { + $dir = "C:\$dir_name$shortver-x64" + } + else { + $dir = "C:\$dir_name$shortver" + } + } + + # TODO: Re-arrange to look only for the needed platform + if (! $dir) { + Write-Output "Looking for C:\$dir_name$shortver-x86 .." + } + + if ((!($dir)) -and (Test-Path "C:\$dir_name$shortver-x86")) { + if ($platform -eq "x86") { + $dir = "C:\$dir_name$shortver-x86" + } + else { + $dir = "C:\$dir_name$shortver" + } + } + + if (!($dir)) { + throw 'couldnt find x86/x64 directories for $name' + } + + if (!( Test-Path $dir)) { + throw "Cant find $dir" + } + + Write-Output "Coping $dir to C:\avvm\$name\$version\$platform\$name ..." + + # Copy-Item -Path $dir -destination "C:\avvm\$name\$version\$platform\$name" -Recurse -Container + move $dir "C:\avvm\$name\$version\$platform\$name" + + $files_content = ('$files = @{ "' + $name + '" = "C:\' + $name + '" }') + $files_path = "C:\avvm\$name\$version\$platform\files.ps1" + + Write-Output "Creating $files_path" + + Set-Content $files_path $files_content +} + +function Setup-Preinstalled +{ + $env:AVVM_DOWNLOAD_URL = '../../avvm/' + Set-ItemProperty -path 'HKCU:\Environment' -name 'AVVM_DOWNLOAD_URL' -value $env:AVVM_DOWNLOAD_URL + + # node already set to 8.x + SetInstalledProductVersion go 1.12.3 x64 + + SetInstalledProductVersion miniconda 2.7.15 x86 + SetInstalledProductVersion miniconda3 3.7.0 x86 + SetInstalledProductVersion perl 5.20.1.2000 x86 +} + +function Setup-Products +{ + param ( + [array] + $Packages + ) + Setup-Preinstalled + + foreach ($pkg in $Packages) + { + $name = $pkg.name + $version = $pkg.version + + if ($name -eq 'StrawberryPerl') { + # Could be mapped to 'perl', but they are slightly different + continue + } + + if ($name -eq 'nodejs') { + $name = 'node' + } + elseif ($name -eq 'golang') { + $name = 'go' + } + elseif ($name -eq 'miniconda3') { + $name = 'miniconda' + } + + if ($name -eq 'python') { + if ($env:PYTHON_VERSION) { + $version = $env:PYTHON_VERSION + } + } + + if ($name -eq 'miniconda') + { + # TODO improve translation of real miniconda versions + # into AppVeyor versions which are the python version + if ($version -eq '4.5.12') { + $version = '3.7' + } + + if ($version[0] -eq '2') { + Write-Output "Moving C:\Miniconda(-x64) to C:\Miniconda27(-x64)" + move C:\Miniconda C:\Miniconda27 + move C:\Miniconda-x64 C:\Miniconda27-x64 + } + } + + Add-Product $name $version $env:PLATFORM + Install-Product $name $version $env:PLATFORM + } +} diff --git a/.ci/appveyor.yml b/.ci/appveyor.yml index 92a5263a6a..eb368050e6 100644 --- a/.ci/appveyor.yml +++ b/.ci/appveyor.yml @@ -1,100 +1,144 @@ environment: - nodejs_version: "10" global: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the # /E:ON and /V:ON options are not enabled in the batch script intepreter # See: http://stackoverflow.com/a/13751649/163740 CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\.ci\\run_with_env.cmd" PIP_CACHE_DIR: C:\pip_cache - GOPATH: c:\gopath - PERLPATH: C:\strawberry\c\bin;C:\strawberry\perl\bin - PERLSITEPATH: C:\strawberry\perl\site\bin + NUGET_EXE_NO_PROMPT: 1 + NUGET_HTTP_CACHE_PATH: C:\nuget_http_cache + CHOCO_CACHE_DIR: C:\choco_cache + PLATFORM: $(PLATFORM) + MSYS_ROOT: C:\msys64 + MSYS_BIN: $(MSYS_ROOT)\usr\bin + GOPATH: C:\gopath + # Override the temp directory to avoid sed escaping issues + # See https://github.com/haskell/cabal/issues/5386 + TMP: c:\tmp + # ActiveState Perl needs to be in path before msys' perl + PATH: >- + C:\python;C:\python\Scripts;$(PATH);$(MSYS_BIN); + %USERPROFILE%\.nuget\packages\fudge\1.3.0\tools; + $(GOPATH)\bin; + $(MSYS_BIN)\core_perl; + C:\ruby\bin; + C:\miniconda;C:\miniconda\Scripts matrix: - - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6" - PYTHON_ARCH: "64" - ruby_version: "24-x64" - TOX_APPVEYOR_X64: 1 + - PYTHON_VERSION: 3.4.4 + - PYTHON_VERSION: 3.6.8 - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6" - PYTHON_ARCH: "32" - TOX_APPVEYOR_X64: 0 - ruby_version: "24" - -stack: go 1.10 +platform: + - x64 + - x86 cache: + - C:\nuget_http_cache + - C:\choco_cache - "C:\\pip_cache" - - "node_modules" - - "C:\\strawberry" - - "C:\\Users\\appveyor\\AppData\\Local\\coala-bears\\coala-bears" - "C:\\Users\\appveyor\\AppData\\Roaming\\nltk_data" + - "%LOCALAPPDATA%\\Composer" + - C:\Users\appveyor\AppData\Roaming\cabal\ branches: except: - /^sils\/.*/ install: - # Prepend newly installed Python to the PATH of this build (this cannot be - # done from inside the powershell script as it would require to restart - # the parent CMD process). - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - "SET PATH=C:\\Program\ Files\\Java\\jdk1.8.0\\bin;%PATH%" - - "SET PATH=C:\\gopath\\bin;%PATH%" - - # https://github.com/coala/coala-bears/issues/2908 - # choco install --ignore-dependencies --yes pmd - # Also doesnt work - # ps: iex (new-object net.webclient). - # downloadstring('https://tailor.sh/install.ps1') - - - go get -u github.com/alecthomas/gometalinter - - gometalinter --install - - go get -u github.com/BurntSushi/toml/cmd/tomlv - - go get -u sourcegraph.com/sqs/goreturns - - # Default Perl doesnt include cpanm - - if not exist "C:\strawberry" choco install strawberryperl -y - - set PATH=%PERLPATH%;%PERLSITEPATH%;%PATH%; - - cpanm --quiet --installdeps --with-develop --notest . + - python --version + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + - node --version + - which npm + - npm --version + - npm config get prefix + - go version + - ruby --version + + - which bower & exit 0 + - "%MSYS_BIN%\\find.exe C:\\Users\\appveyor\\AppData\\Roaming\\npm" + + - python .ci/fix_path.py + - refreshenv + - "%MSYS_BIN%\\date.exe" + - cp .ci/choco.config C:\ProgramData\chocolatey\config\chocolatey.config + + - nuget install fudge -verbosity quiet + - ps: fudge install -FudgefilePath .ci/Fudgefile.appveyor + - choco list --local-only + - refreshenv + - echo %PATH% + - python --version + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + - node --version + - which npm + - npm --version + - npm config get prefix + - ruby --version + - go version + - conda --version + + - ps: fudge install + - choco list --local-only + - refreshenv - echo %PATH% + - node --version + - which npm + - npm --version + - npm config get prefix + - ruby --version + - go version + - conda --version + - R --version + - "%MSYS_BIN%\\find.exe C:\\Users\\appveyor\\AppData\\Roaming\\npm" + - which bower + - bower --version + # Check that we have the expected version and architecture for Python - "python --version" - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - - "%CMD_IN_ENV% python -m pip install tox-appveyor tox-backticks tox-venv" - - - ps: Install-Product node $env:nodejs_version - - "npm config set loglevel warn" - - "npm install" - - "SET PATH=node_modules\\.bin;%PATH%" - # Commands for Ruby - - "sed -i '/sqlint/d' Gemfile" - - "SET PATH=C:\\Ruby%ruby_version%\\bin;%PATH%" - - "bundle install" + - "%MSYS_BIN%\\date.exe" + + - "%CMD_IN_ENV% python -m pip install --upgrade pip setuptools" + - "%CMD_IN_ENV% python -m pip install -r requirements.txt + -r test-requirements.txt + pytest-spec + " + - "%MSYS_BIN%\\date.exe" + + # As installation to windows for these requirements are broken. + # Tests are still being skipped. + - rm + dependency_management/requirements/AptRequirement.py + dependency_management/requirements/BrewRequirement.py + dependency_management/requirements/PkgRequirement.py + dependency_management/requirements/PortageRequirement.py + dependency_management/requirements/ZypperRequirement.py + dependency_management/requirements/DnfRequirement.py + dependency_management/requirements/YumRequirement.py + tests/AptRequirementTest.py + tests/BrewRequirementTest.py + tests/PkgRequirementTest.py + tests/PortageRequirementTest.py + tests/ZypperRequirementTest.py + tests/DnfRequirementTest.py + tests/YumRequirementTest.py build: false # Not a C# project, build stuff at the test step instead. test_script: - # Force DOS format, as Checkstyle configs enable NewlineAtEndOfFile, - # which defaults to CRLF on Windows, and Appveyor CI ignores .gitattributes - # http://help.appveyor.com/discussions/problems/5687-gitattributes-changes-dont-have-any-effect - - unix2dos tests/java/test_files/CheckstyleGood.java - # Clang DLLs x64 were nowadays installed, but the x64 version hangs, so we - # exclude according tests. See https://github.com/appveyor/ci/issues/495 and - # https://github.com/appveyor/ci/issues/688 - - set TOXENV=py36-noreqs-pip-npm-gem-go-perl-java8-win-check-noskip-codecov - - "sed -i 's/^envlist.*$/envlist: %TOXENV%/' tox.ini" - - "%CMD_IN_ENV% python -m tox" - # "%CMD_IN_ENV% python setup.py install" - # "%CMD_IN_ENV% python -m pip install \ - # git+https://github.com/coala/coala" - # sed -i '/ShellCheckBear/d' .coafile - # "%CMD_IN_ENV% coala --ci" + - "%CMD_IN_ENV% python setup.py install" + - "%CMD_IN_ENV% py.test --cov-fail-under=100" + - "%CMD_IN_ENV% pip install coala-bears" + - "%CMD_IN_ENV% coala --ci" + +on_success: + - codecov + +on_failure: + - codecov & exit 0 matrix: fast_finish: true diff --git a/.ci/choco.config b/.ci/choco.config new file mode 100644 index 0000000000..026715ec07 --- /dev/null +++ b/.ci/choco.config @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.ci/fix_path.py b/.ci/fix_path.py new file mode 100644 index 0000000000..834dd24b4f --- /dev/null +++ b/.ci/fix_path.py @@ -0,0 +1,77 @@ +import os + +KEY = 'System\CurrentControlSet\Control\Session Manager\Environment' + +DISCARD_KEYWORDS = tuple([ + 'awscli', + 'azure', + 'coverity', + 'dnvm', + 'mspec', + 'nunit', + 'odbc', + 'privateassemblies', + 'python27', + 'ruby193', + 'service fabric', + 'sql', + 'subversion', + 'testwindow', + 'xunit', +]) + +# TODOs: +# - Also get raw unexpanded values from registry to reduce length, and +# merge them with the current PATH which AppVeyor has populated +# - also fetch and filter user env vars, also de-duplicate wrt system vars +# (see https://github.com/reider-roque/pathvar) +# - Replace \\ and \.\ with \ + + +def get_tidy_path(original): + parts = [] + dups = set() + discard_matches = set() + + for part in original.split(';'): + # This will break directories with a trailing space + part = part.strip().rstrip('\\') + if part in parts: + dups.add(part) + continue + + part_lower = part.lower() + for word in DISCARD_KEYWORDS: + if word in part_lower: + discard_matches.add(word) + break + else: + parts.append(part) + + if dups: + print('Discarded dups:\n {}'.format('\n '.join(sorted(dups)))) + + if discard_matches: + print('Discarded keyword matches: ' + '{}'.format(', '.join(sorted(discard_matches)))) + + return ';'.join(parts) + + +def set_path_in_registry(value): + try: + import winreg + except ImportError: + import _winreg as winreg + + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + with winreg.OpenKey(reg, KEY, 0, winreg.KEY_ALL_ACCESS) as regkey: + winreg.SetValueEx(regkey, 'Path', 0, winreg.REG_EXPAND_SZ, value) + + + +if __name__ == '__main__': + original = os.environ['PATH'] + value = get_tidy_path(original) + print('PATH (len %d) set to:\n%s' % (len(value), value)) + set_path_in_registry(value) diff --git a/.ci/nuspecs/template.nuspec.in b/.ci/nuspecs/template.nuspec.in new file mode 100644 index 0000000000..f056732a6d --- /dev/null +++ b/.ci/nuspecs/template.nuspec.in @@ -0,0 +1,20 @@ + + + + {name} + {version} + {name} {version} + {name} + appveyor + https://www.python.org/download/releases/3.4.0/license + http://www.python.org/ + https://cdn.jsdelivr.net/gh/chocolatey/chocolatey-coreteampackages@edba4a5849ff756e767cba86641bea97ff5721fe/icons/python.svg + false + . + . + python programming development foss cross-platform admin + + + + + diff --git a/Fudgefile b/Fudgefile new file mode 100644 index 0000000000..4873e3c9d0 --- /dev/null +++ b/Fudgefile @@ -0,0 +1,28 @@ +{ + "scripts": { + "pre": { + "install": ". .ci/FudgePostInstall.ps1; Update-SessionEnvironment" + }, + "post": { + "install": ". .ci/FudgePostInstall.ps1; Fixes" + } + }, + "packages": [ + { "name": "msys2", "params": "/InstallDir:C:\\msys64 /NoUpdate" }, + { "name": "python", "version": "3.6.8" }, + { "name": "ruby", "version": "2.6.1.1" }, + { "name": "StrawberryPerl", "version": "5.28.0.1" }, + { "name": "nodejs", "version": "11.13.0" }, + { "name": "golang", "version": "1.9.7" }, + { "name": "miniconda3", "version": "4.5.12" }, + { "name": "php" }, + { "name": "ghc" }, + { "name": "bower" }, + { "name": "composer" }, + { "name": "julia" }, + { "name": "haskell-stack" }, + { "name": "luarocks" }, + { "name": "R.project" }, + { "name": "rust" } + ] +}