|
| 1 | +# .appveyor.yml (for Perl distributions) |
| 2 | + |
| 3 | +# * (APIv1) for usage instructions, see <https://github.com/rivy/CI.AppVeyor.helpers-perl/blob/stable.APIv1/README.mkd> |
| 4 | + |
| 5 | +# ref: <https://www.appveyor.com/docs/appveyor-yml>[`@`](https://archive.is/OUJHS) |
| 6 | +# * "appveyor.yml" validation tool @ <https://ci.appveyor.com/tools/validate-yaml> |
| 7 | + |
| 8 | +version: "{build} ~ {branch}" |
| 9 | + |
| 10 | +branches: |
| 11 | + except: |
| 12 | + - gh-pages |
| 13 | + |
| 14 | +skip_tags: true ## do not build on tags |
| 15 | + |
| 16 | +matrix: |
| 17 | + allow_failures: |
| 18 | + - AUTHOR_TESTING: 1 |
| 19 | + - TEST_SIGNATURE: 1 |
| 20 | + - CI_HELPER_BRANCH: canary |
| 21 | + - Perl_VERSION: "5.8.8" ## allow perl v5.8.8 failures; (v5.8.8 is problematic for many projects) |
| 22 | + |
| 23 | +environment: |
| 24 | + matrix: |
| 25 | + - Perl_VERSION: "latest" |
| 26 | + COVERAGE: "Codecov Coveralls" ## note: case sensitive! |
| 27 | + AUTHOR_TESTING: 1 |
| 28 | + RELEASE_TESTING: 1 |
| 29 | + - Perl_VERSION: "5.28" |
| 30 | + - Perl_VERSION: "5.26" |
| 31 | + - Perl_VERSION: "5.24" |
| 32 | + - Perl_VERSION: "5.22" |
| 33 | + - Perl_VERSION: "5.20" |
| 34 | + - Perl_VERSION: "5.16" |
| 35 | + - Perl_VERSION: "5.14" |
| 36 | + - Perl_VERSION: "5.12" |
| 37 | + - Perl_VERSION: "5.10" |
| 38 | + - Perl_VERSION: "5.8.9" |
| 39 | + - Perl_VERSION: "5.8.8" |
| 40 | + - Perl_VERSION: "latest" |
| 41 | + CI_HELPER_BRANCH: "canary" |
| 42 | + TEST_SIGNATURE: 1 |
| 43 | + global: |
| 44 | + AUTOMATED_TESTING: 1 |
| 45 | + CI_CACHE_DIR: "C:\\cache" |
| 46 | + # |
| 47 | + # debug? |
| 48 | + # CI_DEBUG: 1 ## [ "" == false, <non-empty> == true ]; "true" enables detailed output for the helper scripts |
| 49 | + # |
| 50 | + ## configuration (CI/network-side settings and then ".appveyor_init.{BAT,PS1}" [if present], may override these values [by design]) |
| 51 | + ## --- |
| 52 | + # * standard perl distribution test configuration signals |
| 53 | + AUTHOR_TESTING: "" |
| 54 | + RELEASE_TESTING: "" |
| 55 | + # * .appveyor.yml configuration variables |
| 56 | + CI_HELPER_API_VERSION: "1" ## * API version (the expected/requested helper API version) |
| 57 | + CI_HELPER_BRANCH: "" ## "" => auto-set, valid alternates are [ "stable" (the default), "canary", BRANCH, or TAG ] |
| 58 | + CI_HELPER_REPO: "" ## "" => auto-set; allows easier use of alternate helper scripts (ie, alternate forks) |
| 59 | + DEVEL_COVER_OPTIONS: "" ## "" => auto-set, value determined by DIST_TOOLING; quoted whitespace (eg, " ") is an empty/neutral setting which also blocks auto-set |
| 60 | + DIST_EXTRA_DEPS: "" ## additional required/requested dependencies for build and/or testing |
| 61 | + DIST_SUPPRESS_DEPS: "" ## [ "" == false, <non-empty> == true ]; "true" can be useful for CORE modules, suppressing discovery and installation of dependencies, unless otherwise required (by COVERAGE or DIST_EXTRA_DEPS) |
| 62 | + DIST_TOOLING: "" ## [ "build", "make" ]; "" => auto-set based on existence of "Build.PL" and/or "Makefile.PL" |
| 63 | + TEST_METHOD: "" ## "" => auto-set based on DIST_TOOLING (`perl Build test`, `%make% test`, or `prove -bl`) |
| 64 | + TEST_FILES: "" ## "" => auto-set to "" for build/make distributions, otherwise "t" or "t xt" depending on AUTHOR_TESTING and/or RELEASE_TESTING and directory existence |
| 65 | + ## --- |
| 66 | + |
| 67 | +cache: |
| 68 | +# note: unused, because, unfortunately, the available cache is too small to be helpful (unshared; 1GB across all projects) |
| 69 | +# - '%CI_CACHE_DIR% -> .appveyor.yml' |
| 70 | + |
| 71 | +install: |
| 72 | + - ps: ; write-host $("[{0:HH:mm:ss}].install" -f $($mark = get-date; $mark)) -f darkgray |
| 73 | + # ensure CWD is project main directory |
| 74 | + - cd "%APPVEYOR_BUILD_FOLDER%" |
| 75 | + # perform any special preparation (optional; distribution specific) |
| 76 | + # * note: optional external file(s), global scope => allows ".appveyor.yml" to remain more stable and similar [or the same] between different distributions [eg, for automated distribution of ".appveyor.yml" changes] |
| 77 | + - if EXIST ".appveyor_init.BAT" ( call .appveyor_init.BAT ) |
| 78 | + - ps: if ( test-path ".appveyor_init.PS1" ) { . ".\.appveyor_init.PS1" } |
| 79 | + # save current-point-in-time environment (for later logging of environment variable overrides) |
| 80 | + - ps: $baseline_env = @(get-childitem env:) |
| 81 | + # create a working area |
| 82 | + - ps: if ( ! $env:CI_TEMP_DIR ) { $env:CI_TEMP_DIR = "${env:TEMP}\${env:APPVEYOR_JOB_ID}" ; mkdir -force $env:CI_TEMP_DIR | out-null } |
| 83 | + # create cache area, if missing |
| 84 | + - if NOT DEFINED CI_CACHE_DIR ( set "CI_CACHE_DIR=%CI_TEMP_DIR%\cache" ) |
| 85 | + - if NOT EXIST "%CI_CACHE_DIR%" ( mkdir "%CI_CACHE_DIR%" ) |
| 86 | + # finalize HELPER repository location |
| 87 | + - if NOT DEFINED CI_HELPER_API_VERSION ( set "CI_HELPER_API_VERSION=1" ) |
| 88 | + - if NOT DEFINED CI_HELPER_REPO ( set "CI_HELPER_REPO=https://github.com/rivy/CI.AppVeyor.helpers-perl.git" ) |
| 89 | + - if NOT DEFINED CI_HELPER_BRANCH ( set "CI_HELPER_BRANCH=stable" ) |
| 90 | + - if /i "%CI_HELPER_BRANCH%"=="canary" ( set "CI_HELPER_BRANCH=canary.APIv%CI_HELPER_API_VERSION%" ) |
| 91 | + - if /i "%CI_HELPER_BRANCH%"=="stable" ( set "CI_HELPER_BRANCH=stable.APIv%CI_HELPER_API_VERSION%" ) |
| 92 | + # find / download helpers |
| 93 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (helpers)" -f $($mark_sub = get-date; $mark_sub)) -f darkgray |
| 94 | + # * use "vendored" copy if present |
| 95 | + - ps: if ( ! $env:CI_HELPERS -and (test-path ".appveyor_bin") ) { $env:CI_HELPERS=[IO.Path]::GetFullPath(".appveyor_bin") ; ${env:CI_HELPER_REPO} = ${env:APPVEYOR_REPO_NAME} ; ${env:CI_HELPER_BRANCH_DESC} = ${env:APPVEYOR_REPO_COMMIT} ; } |
| 96 | + # * clone/download helpers from HELPER repo (via `git`) if needed |
| 97 | + - ps: if ( ! $env:CI_HELPERS ) { $repo_path = $( mkdir "${env:CI_TEMP_DIR}\helpers" ).Fullname ; $git_cmd = "git clone ${env:CI_HELPER_REPO} `"${repo_path}`" -b ${env:CI_HELPER_BRANCH} 2>&1" ; write-host "[``${git_cmd}``]" ; & 'CMD' @( '/c', $git_cmd ) ; $err = $LASTEXITCODE ; $env:CI_HELPERS = "${repo_path}\.appveyor_bin" ; if ($err -ne 0) { exit $err } ; } |
| 98 | + - ps: if ( ! $env:CI_HELPER_BRANCH_DESC ) { ${env:CI_HELPER_BRANCH_DESC} = $( pushd "${env:CI_HELPERS}" ; & 'git' @( 'describe', '--always' ) 2>&1 ; popd ) ; } |
| 99 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (helpers) ... (${env:CI_HELPER_REPO}@${env:CI_HELPER_BRANCH_DESC})") |
| 100 | + # resolve requested coverage with needed configuration |
| 101 | + - ps: . "${env:CI_HELPERS}\#install.determine-coverage.PS1" |
| 102 | + ## |
| 103 | + # highlight any overrides within baseline environment |
| 104 | + - ps: $baseline_env | & "${env:CI_HELPERS}\log.env-overrides.PS1" |
| 105 | + ## |
| 106 | + # move "C:\mingw" to avoid cross library linking (a problem with older perl versions, breaking dll compilation with "/mingw/lib/dllcrt2.o:(.text+0xd1): undefined reference to `__dyn_tls_init_callback'") |
| 107 | + # * only truly needed for modules containing XS compilation, but ok for all modules |
| 108 | + - move c:\mingw c:\mingw.o >NUL |
| 109 | + # force branch checkout (if knowable), then reset to the specific commit ## (needed for accurate code coverage info) |
| 110 | + # * this allows later apps to see the branch name using standard `git branch` operations, yet always builds the correct specific commit |
| 111 | + # * ref: <https://github.com/appveyor/ci/issues/1606>[`@`](https://archive.is/RVpnF) |
| 112 | + - if DEFINED APPVEYOR_REPO_BRANCH if /i "%APPVEYOR_REPO_SCM%"=="git" ( git checkout "%APPVEYOR_REPO_BRANCH%" >NUL & git reset --hard "%APPVEYOR_REPO_COMMIT%" ) |
| 113 | + # install perl (strawberry variant) + version verification |
| 114 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (perl)" -f $($mark_sub = get-date; $mark_sub)) -f darkgray |
| 115 | + - ps: . "${env:CI_HELPERS}\#install.install-perl.PS1" |
| 116 | + - perl -V |
| 117 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (perl) ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark_sub).totalseconds)) -f gray |
| 118 | + # determine build tooling |
| 119 | + - ps: . "${env:CI_HELPERS}\#install.determine-tooling.PS1" |
| 120 | + # setup DEVEL_COVER_OPTIONS, if needed |
| 121 | + - ps: if (! $env:DEVEL_COVER_OPTIONS) { . "${env:CI_HELPERS}\#install.setup-cover_options.PS1" } |
| 122 | + # setup testing method/options and test files |
| 123 | + - ps: . "${env:CI_HELPERS}\#install.setup-testing.PS1" |
| 124 | + # distribution prep prior to the build/make process (ie, build dependencies and OS_unsupported check) |
| 125 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (distribution requirements and recommendations)" -f $($mark_sub = get-date; $mark_sub)) -f darkgray |
| 126 | + - ps: . "${env:CI_HELPERS}\#install.setup-dist.PS1" |
| 127 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (distribution requirements and recommendations) ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark_sub).totalseconds)) -f gray |
| 128 | + # coverage prep |
| 129 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (coverage requirements)" -f $($mark_sub = get-date; $mark_sub)) -f darkgray |
| 130 | + - ps: . "${env:CI_HELPERS}\#install.setup-coverage.PS1" |
| 131 | + - ps: ; write-host $("[{0:HH:mm:ss}].install (coverage requirements) ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark_sub).totalseconds)) -f gray |
| 132 | + # |
| 133 | + - ps: ; write-host $("[{0:HH:mm:ss}].install ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark).totalseconds)) -f green |
| 134 | + |
| 135 | +before_build: |
| 136 | + - ps: ; write-host $("[{0:HH:mm:ss}].build.before_build" -f $($mark = get-date; $mark)) -f darkgray |
| 137 | + # ensure CWD is project main directory |
| 138 | + - cd "%APPVEYOR_BUILD_FOLDER%" |
| 139 | + # * for non-COVERAGE builds, enable parallel processing (COVERAGE builds need sequential, correctly interleaved, output to avoid warnings) |
| 140 | + - if NOT DEFINED COVERAGE (set "HARNESS_OPTIONS=j") |
| 141 | + - set HARNESS_TIMER=1 |
| 142 | + # * for COVERAGE builds, enable coverage for `prove` testing |
| 143 | + - if DEFINED COVERAGE (set HARNESS_PERL_SWITCHES=-MDevel::Cover %HARNESS_PERL_SWITCHES%) |
| 144 | + # * for COVERAGE builds, preload JSON:PP to avoid JSON::PP::Boolean redefine warning (see <https://github.com/rurban/Cpanel-JSON-XS/issues/65#issuecomment-219352754>) |
| 145 | + - if DEFINED COVERAGE (set HARNESS_PERL_SWITCHES=-MJSON::PP %HARNESS_PERL_SWITCHES%) |
| 146 | + # |
| 147 | + - ps: . "${env:CI_HELPERS}\#build-before_build.PS1" |
| 148 | + # show final build-related environment variables |
| 149 | + - ps: . "${env:CI_HELPERS}\log.env.PS1" |
| 150 | + # |
| 151 | + - ps: ; write-host $("[{0:HH:mm:ss}].build.before_build ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark).totalseconds)) -f green |
| 152 | + |
| 153 | +build_script: |
| 154 | + - ps: ; write-host $("[{0:HH:mm:ss}].build.build_script" -f $($mark = get-date; $mark)) -f darkgray |
| 155 | + - ps: . "${env:CI_HELPERS}\#build-build_script.PS1" |
| 156 | + - ps: ; write-host $("[{0:HH:mm:ss}].build.build_script ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark).totalseconds)) -f green |
| 157 | + |
| 158 | +test_script: |
| 159 | + - ps: ; write-host $("[{0:HH:mm:ss}].test.test_script" -f $($mark = get-date; $mark)) -f darkgray |
| 160 | + - ps: . "${env:CI_HELPERS}\#test-test_script.PS1" |
| 161 | + - ps: ; write-host $("[{0:HH:mm:ss}].test.test_script ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark).totalseconds)) -f green |
| 162 | + |
| 163 | +after_test: |
| 164 | + - ps: ; write-host $("[{0:HH:mm:ss}].test.after_test" -f $($mark = get-date; $mark)) -f darkgray |
| 165 | + # reporting |
| 166 | + # * report any code coverage information |
| 167 | + - ps: if (-not $env:OS_unsupported -and $env:COVERAGE) { $env:COVERAGE.split() | foreach { & 'CMD' @( '/c', "cover -report $_ 2>&1" ) } } |
| 168 | + - ps: ; write-host $("[{0:HH:mm:ss}].test.after_test ... done ({1:0.0}s)" -f $(get-date; $($(get-date) - $mark).totalseconds)) -f green |
| 169 | + # end with any informational or warning messages, if needed |
| 170 | + - ps: if ($env:CI_SKIP) { write-host -f magenta "info:` CI_SKIP enabled" ; Add-AppveyorMessage -Message "CI_SKIP enabled" -Category Info } |
| 171 | + - ps: if ($env:CI_SKIP_TEST) { write-host -f magenta "info:` CI_SKIP_TEST enabled" ; Add-AppveyorMessage -Message "CI_SKIP_TEST enabled" -Category Info } |
| 172 | + # * prominent "unsupported" warning |
| 173 | + - ps: if ($env:OS_unsupported) { write-host -f magenta "WARN:` OS unsupported" ; Add-AppveyorMessage -Message "OS unsupported" -Category Warning } |
0 commit comments