|
| 1 | +name: build-swoole-cli-windows-msys2 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + windows-msys2: |
| 9 | + if: 1 |
| 10 | + runs-on: windows-2022 |
| 11 | + steps: |
| 12 | + - name: Show Environment Info |
| 13 | + shell: cmd |
| 14 | + run: | |
| 15 | + ver |
| 16 | + wmic cpu get name, caption, maxclockspeed, status |
| 17 | + systeminfo |
| 18 | + systeminfo | findstr /B /C:"OS Name" /C:"OS Version" |
| 19 | + systeminfo | findstr /B /C:"Manufacturer" /C:"Product" /C:"Version" |
| 20 | + set |
| 21 | + ipconfig |
| 22 | + uname -a |
| 23 | + pwd |
| 24 | + ipconfig /all |
| 25 | +
|
| 26 | + - name: Prepare git |
| 27 | + run: | |
| 28 | + git config --global core.autocrlf false |
| 29 | + git config --global core.eol lf |
| 30 | + git config --global core.ignorecase false |
| 31 | + git config --global --add safe.directory ${{ github.workspace }} |
| 32 | +
|
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - name: Cache msys2 packages |
| 35 | + id: cache-msys2 |
| 36 | + uses: actions/cache@v4 |
| 37 | + env: |
| 38 | + cache-name: cache-msys2-packages |
| 39 | + with: |
| 40 | + path: C:\msys2-packages |
| 41 | + key: "${{ runner.os }}-build-${{ env.cache-name }}" |
| 42 | + |
| 43 | + - name: Cache pool |
| 44 | + id: cache-msys2-pool |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: "${{ github.workspace }}\\pool\\" |
| 48 | + key: "${{ runner.os }}-build-pool-cache" |
| 49 | + |
| 50 | + - uses: msys2/setup-msys2@v2 |
| 51 | + # https://github.com/msys2/setup-msys2 |
| 52 | + with: |
| 53 | + msystem: MSYS |
| 54 | + location: C:\msys2-packages |
| 55 | + |
| 56 | + - name: prepare build environment |
| 57 | + shell: msys2 {0} |
| 58 | + run: | |
| 59 | + bash ./sapi/quickstart/windows/msys2-build/install-msys2.sh |
| 60 | +
|
| 61 | + - name: install deps lib with source code |
| 62 | + shell: msys2 {0} |
| 63 | + run: | |
| 64 | + bash ./sapi/scripts/msys2/install-deps-lib.sh |
| 65 | +
|
| 66 | + - name: Prepare |
| 67 | + shell: msys2 {0} |
| 68 | + run: | |
| 69 | + bash ./sapi/scripts/msys2/config-ext.sh |
| 70 | +
|
| 71 | + - name: Configure |
| 72 | + shell: msys2 {0} |
| 73 | + run: | |
| 74 | + bash ./sapi/scripts/msys2/config.sh |
| 75 | +
|
| 76 | + - name: Build |
| 77 | + shell: msys2 {0} |
| 78 | + run: | |
| 79 | + bash ./sapi/scripts/msys2/build.sh |
| 80 | +
|
| 81 | + - name: Archive |
| 82 | + shell: msys2 {0} |
| 83 | + run: | |
| 84 | + bash ./sapi/scripts/msys2/archive.sh |
| 85 | +
|
| 86 | + - name: Show Build Result |
| 87 | + shell: msys2 {0} |
| 88 | + run: | |
| 89 | + ./bin/swoole-cli.exe -v |
| 90 | + ./bin/swoole-cli.exe -m |
| 91 | + ./bin/swoole-cli.exe --ri swoole |
| 92 | + ./bin/swoole-cli.exe -r "echo PHP_VERSION;" |
| 93 | + ldd ./bin/swoole-cli.exe |
| 94 | +
|
| 95 | + - name: get app version with bash |
| 96 | + shell: msys2 {0} |
| 97 | + run: | |
| 98 | + APP_VERSION=$(cat ./APP_VERSION) |
| 99 | + APP_NAME=$(cat ./APP_NAME) |
| 100 | + echo $APP_VERSION |
| 101 | + echo $APP_NAME |
| 102 | + echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV |
| 103 | + echo "APP_NAME=${APP_NAME}" >> $GITHUB_ENV |
| 104 | +
|
| 105 | + - name: production artifacts |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-msys2-x64 |
| 109 | + retention-days: 90 |
| 110 | + path: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-msys2-x64.zip |
| 111 | + |
| 112 | + - name: gh release |
| 113 | + uses: softprops/action-gh-release@v2 |
| 114 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 115 | + env: |
| 116 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 117 | + with: |
| 118 | + files: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-msys2-x64.zip |
0 commit comments