| 1 |
version: "{build}" |
| 2 |
skip_branch_with_pr: true |
| 3 |
skip_tags: true |
| 4 |
build: off |
| 5 |
|
| 6 |
os: Visual Studio 2019 |
| 7 |
|
| 8 |
init: |
| 9 |
- echo APPVEYOR_YAML_MARKER=pr-1222-smoke-packaging-v2 |
| 10 |
- echo APPVEYOR_REPO_BRANCH=%APPVEYOR_REPO_BRANCH% |
| 11 |
- echo APPVEYOR_REPO_COMMIT=%APPVEYOR_REPO_COMMIT% |
| 12 |
- echo APPVEYOR_PULL_REQUEST_NUMBER=%APPVEYOR_PULL_REQUEST_NUMBER% |
| 13 |
|
| 14 |
environment: |
| 15 |
matrix: |
| 16 |
|
| 17 |
- nodejs_version: stable |
| 18 |
|
| 19 |
|
| 20 |
- nodejs_version: none |
| 21 |
|
| 22 |
|
| 23 |
- nodejs_version: python |
| 24 |
|
| 25 |
platform: |
| 26 |
- x64 |
| 27 |
|
| 28 |
for: |
| 29 |
- matrix: |
| 30 |
only: |
| 31 |
- nodejs_version: stable |
| 32 |
install: |
| 33 |
- ps: Install-Product node $env:nodejs_version $env:platform |
| 34 |
- npm -g i npm@latest |
| 35 |
build_script: |
| 36 |
- set npm_config_build_from_source=true&& appveyor-retry call npm install |
| 37 |
test_script: |
| 38 |
- npm test |
| 39 |
after_test: |
| 40 |
- chcp 65001 |
| 41 |
- echo [opencc npm package] building opencc win32-x64 prebuild |
| 42 |
- if exist prebuilds rmdir /S /Q prebuilds |
| 43 |
- npm run prebuild |
| 44 |
- if exist prebuilds\darwin-arm64 exit /B 1 |
| 45 |
- if exist prebuilds\linux-x64 exit /B 1 |
| 46 |
- if exist prebuilds\linux-arm64 exit /B 1 |
| 47 |
- if not exist prebuilds\win32-x64\opencc.node exit /B 1 |
| 48 |
- npm run prepare:scoped-packages |
| 49 |
- echo [opencc npm package] packing opencc |
| 50 |
- npm pack |
| 51 |
- for %%F in (opencc-*.tgz) do set OPENCC_TGZ=%%~fF |
| 52 |
- echo [opencc npm package] packing opencc win32-x64 scoped binary package |
| 53 |
- npm pack dist\scoped-packages\@opencc\opencc-win32-x64 |
| 54 |
- for %%F in (opencc-opencc-win32-x64-*.tgz) do set OPENCC_WIN32_TGZ=%%~fF |
| 55 |
- echo [opencc npm package] building opencc-jieba win32-x64 package files |
| 56 |
- cmake -A%platform% -S. -Bbuild-npm-jieba -DCMAKE_INSTALL_PREFIX:PATH=%CD%\build-npm-jieba-install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_OPENCC_JIEBA_PLUGIN:BOOL=ON -DENABLE_GTEST:BOOL=OFF -DENABLE_BENCHMARK:BOOL=OFF |
| 57 |
- cmake --build build-npm-jieba --config Release --target install |
| 58 |
- mkdir plugins\jieba\node\prebuilds\win32-x64 |
| 59 |
- mkdir plugins\jieba\node\data |
| 60 |
- copy build-npm-jieba-install\share\opencc\*jieba.json plugins\jieba\node\data\ |
| 61 |
- xcopy /E /I /Y build-npm-jieba-install\share\opencc\jieba_dict plugins\jieba\node\data\jieba_dict |
| 62 |
- copy build-npm-jieba-install\bin\plugins\opencc-jieba.dll plugins\jieba\node\prebuilds\win32-x64\opencc-jieba.dll |
| 63 |
- npm --prefix plugins\jieba\node run prepare:scoped-packages |
| 64 |
- echo [opencc npm package] packing opencc-jieba win32-x64 scoped binary package |
| 65 |
- npm pack plugins\jieba\node\dist\scoped-packages\@opencc\opencc-jieba-win32-x64 |
| 66 |
- for %%F in (opencc-opencc-jieba-win32-x64-*.tgz) do set OPENCC_JIEBA_WIN32_TGZ=%%~fF |
| 67 |
- echo [opencc npm package] packing opencc-jieba |
| 68 |
- npm pack plugins\jieba\node --ignore-scripts |
| 69 |
- for %%F in (opencc-jieba-*.tgz) do set OPENCC_JIEBA_TGZ=%%~fF |
| 70 |
- mkdir npm-smoke |
| 71 |
- echo [opencc npm smoke] installing packed packages |
| 72 |
- npm --prefix npm-smoke install "%OPENCC_TGZ%" "%OPENCC_WIN32_TGZ%" "%OPENCC_JIEBA_TGZ%" "%OPENCC_JIEBA_WIN32_TGZ%" |
| 73 |
- .\npm-smoke\node_modules\.bin\opencc.cmd --version |
| 74 |
- .\npm-smoke\node_modules\.bin\opencc.cmd --help >nul |
| 75 |
- mkdir npm-smoke\測試 |
| 76 |
- echo 勇敢的士兵 > npm-smoke\測試\輸入.txt |
| 77 |
- echo [opencc npm smoke] input |
| 78 |
- type npm-smoke\測試\輸入.txt |
| 79 |
- .\npm-smoke\node_modules\.bin\opencc.cmd -i npm-smoke\測試\輸入.txt -o npm-smoke\測試\輸出.s2twp.txt -c s2twp |
| 80 |
- echo [opencc npm smoke] s2twp file output |
| 81 |
- type npm-smoke\測試\輸出.s2twp.txt |
| 82 |
- .\npm-smoke\node_modules\.bin\opencc.cmd -i npm-smoke\測試\輸入.txt -o npm-smoke\測試\輸出.s2twp_jieba.txt -c s2twp_jieba |
| 83 |
- echo [opencc npm smoke] s2twp_jieba file output |
| 84 |
- type npm-smoke\測試\輸出.s2twp_jieba.txt |
| 85 |
- type npm-smoke\測試\輸入.txt | .\npm-smoke\node_modules\.bin\opencc.cmd -c s2twp > npm-smoke\測試\管線.s2twp.txt |
| 86 |
- echo [opencc npm smoke] s2twp pipe output |
| 87 |
- type npm-smoke\測試\管線.s2twp.txt |
| 88 |
- type npm-smoke\測試\輸入.txt | .\npm-smoke\node_modules\.bin\opencc.cmd -c s2twp_jieba > npm-smoke\測試\管線.s2twp_jieba.txt |
| 89 |
- echo [opencc npm smoke] s2twp_jieba pipe output |
| 90 |
- type npm-smoke\測試\管線.s2twp_jieba.txt |
| 91 |
artifacts: |
| 92 |
- path: opencc-*.tgz |
| 93 |
name: OpenCCNpmPackage |
| 94 |
- path: opencc-opencc-win32-x64-*.tgz |
| 95 |
name: OpenCCWin32NpmPackage |
| 96 |
- path: opencc-jieba-*.tgz |
| 97 |
name: OpenCCJiebaNpmPackage |
| 98 |
- path: opencc-opencc-jieba-win32-x64-*.tgz |
| 99 |
name: OpenCCJiebaWin32NpmPackage |
| 100 |
|
| 101 |
- matrix: |
| 102 |
only: |
| 103 |
- nodejs_version: none |
| 104 |
build_script: |
| 105 |
- ps: .\scripts\release-windows-winget.ps1 -SkipTests |
| 106 |
test_script: |
| 107 |
- chcp 65001 |
| 108 |
- dist\winget-x64\staging\bin\opencc.exe --version |
| 109 |
- dist\winget-x64\staging\bin\opencc.exe --help >nul |
| 110 |
- mkdir 測試 |
| 111 |
- echo 勇敢的士兵 > 測試\輸入.txt |
| 112 |
- echo [opencc smoke] input |
| 113 |
- type 測試\輸入.txt |
| 114 |
- dist\winget-x64\staging\bin\opencc.exe -i 測試\輸入.txt -o 測試\輸出.s2twp.txt -c s2twp |
| 115 |
- echo [opencc smoke] s2twp file output |
| 116 |
- type 測試\輸出.s2twp.txt |
| 117 |
- dist\winget-x64\staging\bin\opencc.exe -i 測試\輸入.txt -o 測試\輸出.s2twp_jieba.txt -c s2twp_jieba |
| 118 |
- echo [opencc smoke] s2twp_jieba file output |
| 119 |
- type 測試\輸出.s2twp_jieba.txt |
| 120 |
- type 測試\輸入.txt | dist\winget-x64\staging\bin\opencc.exe -c s2twp > 測試\管線.s2twp.txt |
| 121 |
- echo [opencc smoke] s2twp pipe output |
| 122 |
- type 測試\管線.s2twp.txt |
| 123 |
- type 測試\輸入.txt | dist\winget-x64\staging\bin\opencc.exe -c s2twp_jieba > 測試\管線.s2twp_jieba.txt |
| 124 |
- echo [opencc smoke] s2twp_jieba pipe output |
| 125 |
- type 測試\管線.s2twp_jieba.txt |
| 126 |
- 7z a opencc-smoke-output.zip 測試\*.txt |
| 127 |
artifacts: |
| 128 |
- path: dist\winget-x64\OpenCC-*-windows-x64-portable.zip |
| 129 |
name: OpenCCWindowsCLI |
| 130 |
- path: dist\winget-x64\OpenCC-*-windows-x64-portable.zip.sha256 |
| 131 |
name: OpenCCWindowsCLISha256 |
| 132 |
- path: dist\winget-x64\winget-manifests\** |
| 133 |
name: OpenCCWinGetManifests |
| 134 |
- path: opencc-smoke-output.zip |
| 135 |
name: OpenCCSmokeOutput |
| 136 |
|
| 137 |
- matrix: |
| 138 |
only: |
| 139 |
- nodejs_version: python |
| 140 |
install: |
| 141 |
- py -3 --version |
| 142 |
- py -3 -m pip install --upgrade pip setuptools wheel |
| 143 |
build_script: |
| 144 |
- py -3 -m pip wheel --no-deps --wheel-dir python-smoke-dist . |
| 145 |
- for %%F in (python-smoke-dist\*.whl) do set OPENCC_PY_WHL=%%~fF |
| 146 |
- py -3 -m venv python-smoke-venv |
| 147 |
- python-smoke-venv\Scripts\python.exe -m pip install "%OPENCC_PY_WHL%" |
| 148 |
test_script: |
| 149 |
- chcp 65001 |
| 150 |
- python-smoke-venv\Scripts\opencc.exe --version |
| 151 |
- python-smoke-venv\Scripts\opencc.exe --help >nul |
| 152 |
- mkdir python-smoke\測試 |
| 153 |
- echo 打印机和鼠标 > python-smoke\測試\簡體輸入.txt |
| 154 |
- echo 開放中文轉換 > python-smoke\測試\繁體輸入.txt |
| 155 |
- echo [opencc python smoke] s2twp input |
| 156 |
- type python-smoke\測試\簡體輸入.txt |
| 157 |
- python-smoke-venv\Scripts\opencc.exe -i python-smoke\測試\簡體輸入.txt -o python-smoke\測試\輸出.s2twp.txt -c s2twp |
| 158 |
- echo [opencc python smoke] s2twp file output |
| 159 |
- type python-smoke\測試\輸出.s2twp.txt |
| 160 |
- type python-smoke\測試\簡體輸入.txt | python-smoke-venv\Scripts\opencc.exe -c s2twp > python-smoke\測試\管線.s2twp.txt |
| 161 |
- echo [opencc python smoke] s2twp pipe output |
| 162 |
- type python-smoke\測試\管線.s2twp.txt |
| 163 |
- echo [opencc python smoke] t2s input |
| 164 |
- type python-smoke\測試\繁體輸入.txt |
| 165 |
- python-smoke-venv\Scripts\opencc.exe -i python-smoke\測試\繁體輸入.txt -o python-smoke\測試\輸出.t2s.txt -c t2s |
| 166 |
- echo [opencc python smoke] t2s file output |
| 167 |
- type python-smoke\測試\輸出.t2s.txt |
| 168 |
- type python-smoke\測試\繁體輸入.txt | python-smoke-venv\Scripts\opencc.exe -c t2s > python-smoke\測試\管線.t2s.txt |
| 169 |
- echo [opencc python smoke] t2s pipe output |
| 170 |
- type python-smoke\測試\管線.t2s.txt |
| 171 |
- python-smoke-venv\Scripts\python.exe python\tests\pypi_smoke.py |
| 172 |
- 7z a opencc-python-smoke-output.zip python-smoke\測試\*.txt |
| 173 |
artifacts: |
| 174 |
- path: python-smoke-dist\*.whl |
| 175 |
name: OpenCCPythonWheel |
| 176 |
- path: opencc-python-smoke-output.zip |
| 177 |
name: OpenCCPythonSmokeOutput |