|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-windows: |
| 12 | + name: Build Windows (${{ matrix.arch }}) |
| 13 | + runs-on: windows-2019 |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + arch: [x86, x86_64] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Download Premake5 |
| 23 | + run: | |
| 24 | + Invoke-WebRequest -Uri "https://github.com/premake/premake-core/releases/download/v5.0.0-beta7/premake-5.0.0-beta7-windows.zip" -OutFile "premake.zip" |
| 25 | + Expand-Archive -Path "premake.zip" -DestinationPath "." |
| 26 | + shell: pwsh |
| 27 | + |
| 28 | + - name: Generate Visual Studio solution |
| 29 | + run: .\premake5.exe --os=windows --file=BuildProjects.lua vs2019 |
| 30 | + shell: pwsh |
| 31 | + |
| 32 | + - name: Setup MSBuild |
| 33 | + uses: microsoft/setup-msbuild@v2 |
| 34 | + |
| 35 | + - name: Build x86 |
| 36 | + if: matrix.arch == 'x86' |
| 37 | + run: msbuild solutions/windows-vs2019/GWSockets.sln /p:Configuration=Release /p:Platform=x86 |
| 38 | + shell: cmd |
| 39 | + |
| 40 | + - name: Build x86_64 |
| 41 | + if: matrix.arch == 'x86_64' |
| 42 | + run: msbuild solutions/windows-vs2019/GWSockets.sln /p:Configuration=Release /p:Platform=x64 |
| 43 | + shell: cmd |
| 44 | + |
| 45 | + - name: List output files |
| 46 | + run: Get-ChildItem -Recurse out/ |
| 47 | + shell: pwsh |
| 48 | + |
| 49 | + - name: Upload artifacts (x86) |
| 50 | + if: matrix.arch == 'x86' |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: gmsv_gwsockets_win32 |
| 54 | + path: out/windows/gmsv_gwsockets_win32.dll |
| 55 | + if-no-files-found: error |
| 56 | + |
| 57 | + - name: Upload artifacts (x86_64) |
| 58 | + if: matrix.arch == 'x86_64' |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: gmsv_gwsockets_win64 |
| 62 | + path: out/windows/gmsv_gwsockets_win64.dll |
| 63 | + if-no-files-found: error |
| 64 | + |
| 65 | + build-linux: |
| 66 | + name: Build Linux (${{ matrix.arch }}) |
| 67 | + runs-on: ubuntu-20.04 |
| 68 | + strategy: |
| 69 | + matrix: |
| 70 | + arch: [x86, x86_64] |
| 71 | + |
| 72 | + steps: |
| 73 | + - name: Checkout repository |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: | |
| 78 | + sudo apt-get update |
| 79 | + sudo apt-get install -y build-essential gcc-multilib g++-multilib |
| 80 | +
|
| 81 | + - name: Download Premake5 |
| 82 | + run: | |
| 83 | + wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta7/premake-5.0.0-beta7-linux.tar.gz |
| 84 | + tar -xzf premake-5.0.0-beta7-linux.tar.gz |
| 85 | + chmod +x premake5 |
| 86 | +
|
| 87 | + - name: Generate Makefiles |
| 88 | + run: ./premake5 --os=linux --file=BuildProjects.lua gmake |
| 89 | + |
| 90 | + - name: Build x86 |
| 91 | + if: matrix.arch == 'x86' |
| 92 | + working-directory: solutions/linux-gmake |
| 93 | + run: make config=release_x86 -j$(nproc) |
| 94 | + |
| 95 | + - name: Build x86_64 |
| 96 | + if: matrix.arch == 'x86_64' |
| 97 | + working-directory: solutions/linux-gmake |
| 98 | + run: make config=release_x86_64 -j$(nproc) |
| 99 | + |
| 100 | + - name: List output files |
| 101 | + run: find out/ -type f |
| 102 | + |
| 103 | + - name: Upload artifacts (x86) |
| 104 | + if: matrix.arch == 'x86' |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: gmsv_gwsockets_linux32 |
| 108 | + path: out/linux/gmsv_gwsockets_linux.dll |
| 109 | + if-no-files-found: error |
| 110 | + |
| 111 | + - name: Upload artifacts (x86_64) |
| 112 | + if: matrix.arch == 'x86_64' |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: gmsv_gwsockets_linux64 |
| 116 | + path: out/linux/gmsv_gwsockets_linux64.dll |
| 117 | + if-no-files-found: error |
| 118 | + |
| 119 | + create-release-artifacts: |
| 120 | + name: Combine artifacts |
| 121 | + runs-on: ubuntu-latest |
| 122 | + needs: [build-windows, build-linux] |
| 123 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 124 | + |
| 125 | + steps: |
| 126 | + - name: Download all artifacts |
| 127 | + uses: actions/download-artifact@v4 |
| 128 | + with: |
| 129 | + path: artifacts |
| 130 | + |
| 131 | + - name: Display structure |
| 132 | + run: ls -R artifacts/ |
| 133 | + |
| 134 | + - name: Create release directory |
| 135 | + run: | |
| 136 | + mkdir -p release |
| 137 | + find artifacts -name "*.dll" -exec cp {} release/ \; |
| 138 | + ls -lh release/ |
| 139 | +
|
| 140 | + - name: Upload combined artifacts |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + with: |
| 143 | + name: gwsockets-all-platforms |
| 144 | + path: release/ |
| 145 | + if-no-files-found: error |
0 commit comments