cloudflare/cloudflared
Publicmirrored from https://github.com/cloudflare/cloudflaredAvailable
.ci/scripts/windows/component-test.ps1
40lines · modecode
| 1 | Set-StrictMode -Version Latest |
| 2 | $ErrorActionPreference = "Stop" |
| 3 | $ProgressPreference = "SilentlyContinue" |
| 4 | |
| 5 | $env:TARGET_OS = "windows" |
| 6 | $env:LOCAL_OS = "windows" |
| 7 | $env:TARGET_ARCH = "amd64" |
| 8 | $env:LOCAL_ARCH = "amd64" |
| 9 | $env:CGO_ENABLED = 1 |
| 10 | |
| 11 | python --version |
| 12 | python -m pip --version |
| 13 | |
| 14 | |
| 15 | Write-Host "Building cloudflared" |
| 16 | & make cloudflared |
| 17 | if ($LASTEXITCODE -ne 0) { throw "Failed to build cloudflared" } |
| 18 | |
| 19 | |
| 20 | Write-Host "Running unit tests" |
| 21 | # Not testing with race detector because of https://github.com/golang/go/issues/61058 |
| 22 | # We already test it on other platforms |
| 23 | go test -failfast -v -mod=vendor ./... |
| 24 | if ($LASTEXITCODE -ne 0) { throw "Failed unit tests" } |
| 25 | |
| 26 | |
| 27 | # On Gitlab runners we need to add all of this addresses to the NO_PROXY list in order for the tests to run. |
| 28 | $env:NO_PROXY = "pypi.org,files.pythonhosted.org,api.cloudflare.com,argotunneltest.com,argotunnel.com,trycloudflare.com,${env:NO_PROXY}" |
| 29 | Write-Host "No Proxy: ${env:NO_PROXY}" |
| 30 | Write-Host "Running component tests" |
| 31 | try { |
| 32 | python -m pip --disable-pip-version-check install --upgrade -r component-tests/requirements.txt --use-pep517 |
| 33 | python component-tests/setup.py --type create |
| 34 | python -m pytest component-tests -o log_cli=true --log-cli-level=INFO --junit-xml=report.xml |
| 35 | if ($LASTEXITCODE -ne 0) { |
| 36 | throw "Failed component tests" |
| 37 | } |
| 38 | } finally { |
| 39 | python component-tests/setup.py --type cleanup |
| 40 | } |
| 41 | |