diff options
author | Daniel Moody <dmoody256@gmail.com> | 2020-05-20 16:10:40 (GMT) |
---|---|---|
committer | Daniel Moody <dmoody256@gmail.com> | 2020-05-20 16:10:40 (GMT) |
commit | 1f122243645de24911a5b6196d1cf735e56c4452 (patch) | |
tree | 354e351fc54f505182b0e154988bf64a74611105 | |
parent | aa5378e37ff2ab4e70be6d6b2af0cd79597da7dc (diff) | |
download | SCons-1f122243645de24911a5b6196d1cf735e56c4452.zip SCons-1f122243645de24911a5b6196d1cf735e56c4452.tar.gz SCons-1f122243645de24911a5b6196d1cf735e56c4452.tar.bz2 |
clean up CI files
-rw-r--r-- | .appveyor.yml | 52 | ||||
-rw-r--r-- | .appveyor/coverage_report.ps1 | 5 | ||||
-rw-r--r-- | .appveyor/coverage_setup.ps1 | 13 | ||||
-rw-r--r-- | .appveyor/disable_msvc_10.ps1 | 5 | ||||
-rw-r--r-- | .appveyor/ignore_git_bins.ps1 | 5 | ||||
-rw-r--r-- | .appveyor/install.bat | 11 | ||||
-rw-r--r-- | .coverage_templates/.coveragerc.template | 30 | ||||
-rw-r--r-- | .coverage_templates/sitecustomize.py.template | 5 | ||||
-rw-r--r-- | .travis.yml | 26 | ||||
-rw-r--r-- | .travis/.coveragerc | 8 | ||||
-rwxr-xr-x | .travis/coverage_setup.sh | 21 |
11 files changed, 102 insertions, 79 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 4d7706e..6689594 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,7 +2,6 @@ image: # linux builds done in Travis CI for now - # - Ubuntu - Visual Studio 2015 - Visual Studio 2017 - Visual Studio 2019 @@ -15,17 +14,7 @@ cache: install: # add python and python user-base to path for pip installs - - cmd: "C:\\%WINPYTHON%\\python.exe --version" - - cmd: for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -c "import sys; print(sys.path[-1])"') do (set PYSITEDIR=%%g) - # use mingw 32 bit until #3291 is resolved - - cmd: "set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\ProgramData\\chocolatey\\bin;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin;C:\\cygwin\\bin;C:\\msys64\\usr\\bin;C:\\msys64\\mingw64\\bin;%PATH%" - - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pip setuptools wheel " - - cmd: "C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pypiwin32 coverage codecov" - - cmd: set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off lxml - # install 3rd party tools to test with - - cmd: choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc winflexbison - - cmd: set SCONS_CACHE_MSVC_CONFIG=true - - cmd: set + - cmd: .\.appveyor\install.bat # build matrix will be number of images multiplied by each '-' below, # less any exclusions. @@ -72,14 +61,7 @@ matrix: # remove some binaries we don't want to be found before_build: - - ps: | - if ($isWindows) { - dir "C:\Program Files\Git\usr\bin\x*.exe" - if (Test-Path "C:\Program Files\Git\usr\bin\xsltproc.EXE" ) { - Remove-Item "C:\Program Files\Git\usr\bin\xsltproc.EXE" -ErrorAction Ignore - } - dir "C:\Program Files\Git\usr\bin\x*.exe" - } + - ps: .\.appveyor\ignore_git_bins.ps1 build: off @@ -87,41 +69,19 @@ build_script: # exclude VS 10.0 because it hangs the testing until this is resolved: # https://help.appveyor.com/discussions/problems/19283-visual-studio-2010-trial-license-has-expired - - ps: | - New-Item -Name exclude_list.txt -ItemType File - $workaround_image = "Visual Studio 2015" - if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq $workaround_image) { - Add-Content -Path 'exclude_list.txt' -Value 'test\MSVS\vs-10.0-exec.py' - } + - ps: .\.appveyor\disable_msvc_10.ps1 # setup coverage by creating the coverage config file, and adding coverage # to the sitecustomize so that all python processes start with coverage - - ps: | - if ($env:COVERAGE -eq 1) { - $env:COVERAGE_PROCESS_START = "$($env:APPVEYOR_BUILD_FOLDER)/.coveragerc"; - $env:COVERAGE_FILE = "$($env:APPVEYOR_BUILD_FOLDER)/.coverage"; - New-Item -ItemType Directory -Force -Path "$($env:PYSITEDIR)"; - $sitecustomizeText = "import os`r`nos.environ['COVERAGE_PROCESS_START'] = '$($env:COVERAGE_PROCESS_START)'`r`nos.environ['COVERAGE_FILE'] = '$($env:COVERAGE_FILE)'`r`nimport coverage`r`ncoverage.process_startup()"; - $sitecustomizeText|Set-Content "$($env:PYSITEDIR)/sitecustomize.py"; - Get-Content -Path "$($env:PYSITEDIR)/sitecustomize.py"; - $coveragercFile = "[run]`r`nsource = $($env:APPVEYOR_BUILD_FOLDER)/SCons`r`nparallel = True`r`ndisable_warnings = trace-changed`r`nomit =`r`n`t*Tests.py`r`n`t*\src\*`r`n`t*\test\*`r`n`t*\testing\*`r`n`t*\template\*`r`n`t*\scripts\*`r`n`t*\scons-time.py`r`n`t*\bootstrap.py`r`n`t*\runtest.py`r`n`t*\setup.py`r`n`r`n[path]`r`nsource = $($env:APPVEYOR_BUILD_FOLDER)`r`n[report]`r`nomit =`r`n`t*Tests.py`r`n`t*\src\*`r`n`t*\test\*`r`n`t*\testing\*`r`n`t*\template\*`r`n`t*\scripts\*`r`n`t*\scons-time.py`r`n`t*\bootstrap.py`r`n`t*\runtest.py`r`n`t*\setup.py`r`n`r`n" - $coveragercFile|Set-Content "$($env:COVERAGE_PROCESS_START)"; - Get-Content -Path "$($env:COVERAGE_PROCESS_START)"; - } - - + - ps: .\.appveyor\coverage_setup.ps1 + # NOTE: running powershell from cmd is intended because # it formats the output correctly - cmd: powershell -Command "& { if($env:COVERAGE -eq 1) { coverage run -p --rcfile=$($env:COVERAGE_PROCESS_START) runtest.py -j 2 -t --exclude-list exclude_list.txt -a } else { C:\\%WINPYTHON%\\python.exe runtest.py -j 2 -t --exclude-list exclude_list.txt -a }; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}" # run coverage even if there was a test failure on_finish: - - ps: | - if ($env:COVERAGE -eq 1) { - & coverage combine - & coverage report - & coverage xml -i -o coverage_xml.xml - } + - ps: .\.appveyor\coverage_report.ps1 # running codecov in powershell causes an error so running in platform # shells - cmd: if %COVERAGE% equ 1 codecov -X gcov --file coverage_xml.xml diff --git a/.appveyor/coverage_report.ps1 b/.appveyor/coverage_report.ps1 new file mode 100644 index 0000000..43e2328 --- /dev/null +++ b/.appveyor/coverage_report.ps1 @@ -0,0 +1,5 @@ +if ($env:COVERAGE -eq 1) { + & coverage combine; + & coverage report; + & coverage xml -i -o coverage_xml.xml; +} diff --git a/.appveyor/coverage_setup.ps1 b/.appveyor/coverage_setup.ps1 new file mode 100644 index 0000000..0906cb9 --- /dev/null +++ b/.appveyor/coverage_setup.ps1 @@ -0,0 +1,13 @@ +if ($env:COVERAGE -eq 1) { + $env:COVERAGE_PROCESS_START = "$($env:APPVEYOR_BUILD_FOLDER)\.coveragerc"; + $env:COVERAGE_FILE = "$($env:APPVEYOR_BUILD_FOLDER)\.coverage"; + New-Item -ItemType Directory -Force -Path "$($env:PYSITEDIR)"; + + (Get-Content -path .coverage_templates\.coveragerc.template -Raw) -replace '\$PWD',"$((Get-Location) -replace '\\', '/')" | Set-Content -Path "$($env:COVERAGE_PROCESS_START)"; + (Get-Content -path .coverage_templates\sitecustomize.py.template -Raw) -replace '\$PWD',"$((Get-Location) -replace '\\', '/')" | Set-Content -Path "$($env:PYSITEDIR)\sitecustomize.py"; + + Write-Host "$($env:PYSITEDIR)\sitecustomize.py"; + Get-Content -Path "$($env:PYSITEDIR)\sitecustomize.py"; + Write-Host "$($env:COVERAGE_PROCESS_START)"; + Get-Content -Path "$($env:COVERAGE_PROCESS_START)"; +} diff --git a/.appveyor/disable_msvc_10.ps1 b/.appveyor/disable_msvc_10.ps1 new file mode 100644 index 0000000..086f1e4 --- /dev/null +++ b/.appveyor/disable_msvc_10.ps1 @@ -0,0 +1,5 @@ +New-Item -Name exclude_list.txt -ItemType File; +$workaround_image = "Visual Studio 2015"; +if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq $workaround_image) { + Add-Content -Path 'exclude_list.txt' -Value 'test\MSVS\vs-10.0-exec.py'; +} diff --git a/.appveyor/ignore_git_bins.ps1 b/.appveyor/ignore_git_bins.ps1 new file mode 100644 index 0000000..4e4202e --- /dev/null +++ b/.appveyor/ignore_git_bins.ps1 @@ -0,0 +1,5 @@ +dir "C:\Program Files\Git\usr\bin\x*.exe"; +if (Test-Path "C:\Program Files\Git\usr\bin\xsltproc.EXE" ) { + Remove-Item "C:\Program Files\Git\usr\bin\xsltproc.EXE" -ErrorAction Ignore; +} +dir "C:\Program Files\Git\usr\bin\x*.exe"; diff --git a/.appveyor/install.bat b/.appveyor/install.bat new file mode 100644 index 0000000..67a064d --- /dev/null +++ b/.appveyor/install.bat @@ -0,0 +1,11 @@ +C:\\%WINPYTHON%\\python.exe --version +for /F "tokens=*" %%g in ('C:\\%WINPYTHON%\\python.exe -c "import sys; print(sys.path[-1])"') do (set PYSITEDIR=%%g) +REM use mingw 32 bit until #3291 is resolved +set PATH=C:\\%WINPYTHON%;C:\\%WINPYTHON%\\Scripts;C:\\ProgramData\\chocolatey\\bin;C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin;C:\\cygwin\\bin;C:\\msys64\\usr\\bin;C:\\msys64\\mingw64\\bin;%PATH% +C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pip setuptools wheel +C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off pypiwin32 coverage codecov +set STATIC_DEPS=true & C:\\%WINPYTHON%\\python.exe -m pip install -U --progress-bar off lxml +REM install 3rd party tools to test with +choco install --allow-empty-checksums dmd ldc swig vswhere xsltproc winflexbison +set SCONS_CACHE_MSVC_CONFIG=true +set diff --git a/.coverage_templates/.coveragerc.template b/.coverage_templates/.coveragerc.template new file mode 100644 index 0000000..6413924 --- /dev/null +++ b/.coverage_templates/.coveragerc.template @@ -0,0 +1,30 @@ +[run] +source = $PWD +parallel = True +omit = + *Tests.py + */src/* + */test/* + */testing/* + */template/* + */scripts/* + */scons-time.py + */bootstrap.py + */runtest.py + */setup.py + +[path] +source = $PWD + +[report] +omit = + *Tests.py + */src/* + */test/* + */testing/* + */template/* + */scripts/* + */scons-time.py + */bootstrap.py + */runtest.py + */setup.py diff --git a/.coverage_templates/sitecustomize.py.template b/.coverage_templates/sitecustomize.py.template new file mode 100644 index 0000000..06bed8a --- /dev/null +++ b/.coverage_templates/sitecustomize.py.template @@ -0,0 +1,5 @@ +import os +os.environ['COVERAGE_PROCESS_START'] = r'$PWD/.coveragerc' +os.environ['COVERAGE_FILE'] = r'$PWD/.coverage' +import coverage +coverage.process_startup() diff --git a/.travis.yml b/.travis.yml index 25da402..9fa9376 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,31 +67,7 @@ jobs: python: 3.7 name: coverage before_script: - - python -m pip install -U coverage codecov - - python -m site - # setup sitecustomize so we can make all subprocess start coverage - - export PYSITEDIR=$(python -c "import sys; print(sys.path[-1])") - - export COVERAGE_PROCESS_START="$PWD/.coveragerc" - - export COVERAGE_FILE="$PWD/.coverage" - - mkdir -p "$PYSITEDIR" - - echo "$PYSITEDIR" - - touch "${PYSITEDIR}/sitecustomize.py" - - echo "import os" | tee --append "${PYSITEDIR}/sitecustomize.py" - - echo "os.environ['COVERAGE_PROCESS_START'] = '$PWD/.coveragerc'" | tee --append "${PYSITEDIR}/sitecustomize.py" - - echo "os.environ['COVERAGE_FILE'] = '$PWD/.coverage'" | tee --append "${PYSITEDIR}/sitecustomize.py" - - echo "import coverage" | tee --append "${PYSITEDIR}/sitecustomize.py" - - echo "coverage.process_startup()" | tee --append "${PYSITEDIR}/sitecustomize.py" - - cat "${PYSITEDIR}/sitecustomize.py" - # write the coverage config file - - echo "[run]" >> "$PWD/.coveragerc" - - echo "source = $PWD" >> "$PWD/.coveragerc" - - echo "parallel = True" >> "$PWD/.coveragerc" - - printf "omit =\n\t*Tests.py\n\t*/src/*\n\t*/test/*\n\t*/testing/*\n\t*/template/*\n\t*/scripts/*\n\t*/scons-time.py\n\t*/bootstrap.py\n\t*/runtest.py\n\t*/setup.py\n\n" >> "$PWD/.coveragerc" - - echo "[path]" >> "$PWD/.coveragerc" - - echo "source = $PWD" >> "$PWD/.coveragerc" - - echo "[report]" >> "$PWD/.coveragerc" - - printf "omit =\n\t*Tests.py\n\t*/src/*\n\t*/test/*\n\t*/testing/*\n\t*/template/*\n\t*/scripts/*\n\t*/scons-time.py\n\t*/bootstrap.py\n\t*/runtest.py\n\t*/setup.py\n\n" >> "$PWD/.coveragerc" - - cat "$PWD/.coveragerc" + - ./.travis/coverage_setup.sh script: - coverage run -p --rcfile="$PWD/.coveragerc" runtest.py -a -j 2 || if [[ $? == 2 ]]; then true; else false; fi diff --git a/.travis/.coveragerc b/.travis/.coveragerc deleted file mode 100644 index 3aaf35b..0000000 --- a/.travis/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -echo "[run]" >> .coveragerc -echo "source = $PWD/SCons" >> .coveragerc -echo "parallel = True" >> .coveragerc -printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsetup.py\n\n" >> .coveragerc -echo "[path]" >> .coveragerc -echo "source = $PWD" >> .coveragerc -echo "[report]" >> .coveragerc -printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsetup.py\n\n" >> .coveragerc diff --git a/.travis/coverage_setup.sh b/.travis/coverage_setup.sh new file mode 100755 index 0000000..e71fde8 --- /dev/null +++ b/.travis/coverage_setup.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +python -m pip install -U coverage codecov + +# setup sitecustomize so we can make all subprocess start coverage +export PYSITEDIR=$(python -c "import sys; print(sys.path[-1])") +mkdir -p "$PYSITEDIR" + +# coverage.py environment variable for multiprocess +export COVERAGE_PROCESS_START="$PWD/.coveragerc" +export COVERAGE_FILE="$PWD/.coverage" + +# replace PWD in the template files so we have absolute paths from out /tmp test folders +sed -e "s#\$PWD#$PWD#" .coverage_templates/.coveragerc.template > "$PWD/.coveragerc" +sed -e "s#\$PWD#$PWD#" .coverage_templates/sitecustomize.py.template > "${PYSITEDIR}/sitecustomize.py" + +# print the results +echo "${PYSITEDIR}/sitecustomize.py" +cat "${PYSITEDIR}/sitecustomize.py" +echo "$PWD/.coveragerc" +cat "$PWD/.coveragerc" |