@@ -29,7 +29,7 @@ concurrency:
2929
3030jobs :
3131
32- package :
32+ package-linux :
3333 name : Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
3434 runs-on : ubuntu-22.04
3535 timeout-minutes : 500
@@ -72,8 +72,118 @@ jobs:
7272 - name : Build packages
7373 run : pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest
7474
75- - name : Upload artifacts
76- uses : actions/upload-artifact@v3
75+ - name : Zip artifact
76+ run : zip -r ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip ${{matrix.pkg.path}}
77+
78+ - name : Upload binaries to release
79+ uses : svenstaro/upload-release-action@v2
80+ with :
81+ repo_token : ${{ secrets.GITHUB_TOKEN }}
82+ file : ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip
83+ asset_name : ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip
84+ tag : ${{ github.ref }}
85+ overwrite : true
86+
87+ package-windows :
88+ timeout-minutes : 120
89+ name : Build CPP Client on ${{ matrix.name }}
90+ runs-on : ${{ matrix.os }}
91+ env :
92+ VCPKG_ROOT : ' ${{ github.workspace }}/vcpkg'
93+ strategy :
94+ fail-fast : false
95+ matrix :
96+ include :
97+ - name : ' Windows x64'
98+ os : windows-2022
99+ triplet : x64-windows
100+ vcpkg_dir : ' C:\vcpkg'
101+ suffix : ' windows-win64'
102+ generator : ' Visual Studio 17 2022'
103+ arch : ' -A x64'
104+ - name : ' Windows x86'
105+ os : windows-2022
106+ triplet : x86-windows
107+ vcpkg_dir : ' C:\vcpkg'
108+ suffix : ' windows-win32'
109+ generator : ' Visual Studio 17 2022'
110+ arch : ' -A Win32'
111+
112+ steps :
113+ - name : checkout
114+ uses : actions/checkout@v3
115+
116+ - name : Restore vcpkg and its artifacts.
117+ uses : actions/cache@v3
118+ id : vcpkg-cache
119+ with :
120+ path : |
121+ ${{ env.VCPKG_ROOT }}
122+ vcpkg_installed
123+ !${{ env.VCPKG_ROOT }}/.git
124+ !${{ env.VCPKG_ROOT }}/buildtrees
125+ !${{ env.VCPKG_ROOT }}/packages
126+ !${{ env.VCPKG_ROOT }}/downloads
127+ key : |
128+ ${{ runner.os }}-${{ matrix.triplet }}-${{ hashFiles( 'vcpkg.json' ) }}
129+
130+ - name : Get vcpkg(windows)
131+ if : ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
132+ run : |
133+ cd ${{ github.workspace }}
134+ mkdir build -force
135+ git clone https://github.com/Microsoft/vcpkg.git
136+ cd vcpkg
137+ .\bootstrap-vcpkg.bat
138+
139+ - name : remove system vcpkg(windows)
140+ if : runner.os == 'Windows'
141+ run : rm -rf "$VCPKG_INSTALLATION_ROOT"
142+ shell : bash
143+
144+ - name : Install vcpkg packages
145+ run : |
146+ ${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet ${{ matrix.triplet }} > dependencies.txt
147+
148+ - name : Configure and build
149+ shell : bash
150+ run : |
151+ BUILD_DIR=./build
152+ mkdir -p $BUILD_DIR
153+ cmake -B $BUILD_DIR \
154+ -G "${{ matrix.generator }}" ${{ matrix.arch }} \
155+ -DBUILD_TESTS=OFF \
156+ -DVCPKG_TRIPLET=${{ matrix.triplet }} \
157+ -S .
158+ cmake --build $BUILD_DIR --parallel --config Release
159+
160+ - name : Package
161+ shell : bash
162+ run : |
163+ BUILD_DIR=./build
164+ PACKAGE_DIR=./package
165+ LIB_DIR=$PACKAGE_DIR/lib/Release
166+ VCPKG_INSTALLED_DIR=$PACKAGE_DIR/vcpkg_installed
167+ mkdir -p $PACKAGE_DIR
168+ mkdir -p $LIB_DIR
169+ mkdir -p $VCPKG_INSTALLED_DIR/${{ matrix.triplet }}
170+
171+ cp dependencies.txt $PACKAGE_DIR
172+ cp -r ./include $PACKAGE_DIR
173+ cp -r $BUILD_DIR/include/ $PACKAGE_DIR
174+ cp -r $BUILD_DIR/lib/Release/*.lib $LIB_DIR
175+ cp -r $BUILD_DIR/lib/Release/*.dll $LIB_DIR
176+ cp -r ./vcpkg_installed/${{ matrix.triplet }}/* $VCPKG_INSTALLED_DIR/${{ matrix.triplet }}
177+
178+ - name : Zip artifact
179+ shell : bash
180+ run : 7z a -tzip Windows-${{ matrix.triplet }}.zip ./package
181+
182+ - name : Upload binaries to release
183+ uses : svenstaro/upload-release-action@v2
77184 with :
78- name : ${{matrix.pkg.type}}-${{matrix.cpu.platform}}
79- path : ${{matrix.pkg.path}}
185+ repo_token : ${{ secrets.GITHUB_TOKEN }}
186+ file : Windows-${{ matrix.triplet }}.zip
187+ asset_name : Windows-${{ matrix.triplet }}.zip
188+ tag : ${{ github.ref }}
189+ overwrite : true
0 commit comments