|
| 1 | +environment: |
| 2 | + VUE_TEMPLATES: "minimal full full-airbnb" |
| 3 | + |
| 4 | +cache: |
| 5 | + - node_modules |
| 6 | + - examples\full\node_modules |
| 7 | + - examples\full-airbnb\node_modules |
| 8 | + - examples\minimal\node_modules |
| 9 | + - '%APPDATA%\npm-cache' |
| 10 | + - '%USERPROFILE%\.npm' |
| 11 | + - '%USERPROFILE%\.cache' |
| 12 | + |
| 13 | +install: |
| 14 | + - ps: Install-Product node 8 |
| 15 | + - ps: Install-Module -Name PSWriteColor |
| 16 | + - ps: Install-Module -Name Assert |
| 17 | + - npm install -g yarn vue-cli |
| 18 | + - yarn install --frozen-lockfile --silent 2> $null |
| 19 | + |
| 20 | +test_script: |
| 21 | + - ps: >- |
| 22 | + function Test-Extension() { |
| 23 | + Write-Color "Working inside ", (Get-Location).path, " folder..." -Color White, Yellow, White |
| 24 | +
|
| 25 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Installing extension dependencies..." -Color Yellow, White |
| 26 | + yarn install --frozen-lockfile --silent 2> $null |
| 27 | +
|
| 28 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Building extension..." -Color Yellow, White |
| 29 | + yarn build --silent 2> $null |
| 30 | +
|
| 31 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Testing version behavior..." -Color Yellow, White |
| 32 | + Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_version.ps1" |
| 33 | +
|
| 34 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 35 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Linting..." -Color Yellow, White |
| 36 | + yarn lint --fix |
| 37 | + } |
| 38 | +
|
| 39 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 40 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Prettying..." -Color Yellow, White |
| 41 | + yarn prettier:write |
| 42 | + } |
| 43 | +
|
| 44 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 45 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Testing options..." -Color Yellow, White |
| 46 | + Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_options.ps1" |
| 47 | + } |
| 48 | +
|
| 49 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 50 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Testing axios..." -Color Yellow, White |
| 51 | + Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_axios.ps1" |
| 52 | + } |
| 53 | +
|
| 54 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 55 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Testing vue-router..." -Color Yellow, White |
| 56 | + Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_router.ps1" |
| 57 | + } |
| 58 | +
|
| 59 | + if ($env:VUE_TEMPLATE.startsWith('full')) { |
| 60 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Testing vuex..." -Color Yellow, White |
| 61 | + Invoke-Expression "$($env:APPVEYOR_BUILD_FOLDER)/tests/test_store.ps1" |
| 62 | + } |
| 63 | + } |
| 64 | +
|
| 65 | + function Create-Extension() { |
| 66 | + Param($Template) |
| 67 | + $env:VUE_TEMPLATE = $Template |
| 68 | +
|
| 69 | + cd "$($env:APPVEYOR_BUILD_FOLDER)/tests" |
| 70 | + Write-Color "[$($env:VUE_TEMPLATE)]", " Creating extension following ", $Template, " scenario..." -Color Yellow, White, Yellow, White |
| 71 | + vue init .. "extension-$($Template)" |
| 72 | +
|
| 73 | + cd "extension-$($Template)" |
| 74 | + Test-Extension |
| 75 | + } |
| 76 | +
|
| 77 | + function Main() { |
| 78 | + if($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH.startsWith('dependabot')) { |
| 79 | + Write-Color "Dependabot PR detected" -Color Yellow |
| 80 | + $env:VUE_TEMPLATE = (git --no-pager diff --name-only origin/master | Select-String "examples" | Select-Object -Last 1 | Out-String | ForEach-Object { $_.Split('/')[1] }) |
| 81 | +
|
| 82 | + if ($env:VUE_TEMPLATE -like "*$env:VUE_TEMPLATE*") { |
| 83 | + Write-Color "Running tests for $($env:VUE_TEMPLATE) example..." -Color Yellow |
| 84 | + cd "$($env:APPVEYOR_BUILD_FOLDER)/examples/$($env:VUE_TEMPLATE)" |
| 85 | + Test-Extension |
| 86 | + } else { |
| 87 | + Write-Color "Nothing to tests for global project..." -Color Orange |
| 88 | + exit 0 |
| 89 | + } |
| 90 | + } else { |
| 91 | + foreach($VUE_TEMPLATE in $env:VUE_TEMPLATES.split(" ")) { |
| 92 | + Create-Extension -Template $VUE_TEMPLATE |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | +
|
| 97 | + Main |
| 98 | +
|
| 99 | +build: off |
0 commit comments