Skip to content

Commit 2ac058e

Browse files
authored
Create build.yml
1 parent 98fa506 commit 2ac058e

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build
2+
3+
on: push
4+
5+
jobs:
6+
win-build:
7+
runs-on: windows-latest
8+
name: Windows Build
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: setup-msbuild
14+
uses: microsoft/setup-msbuild@v1.1
15+
16+
- name: Configure CMake
17+
shell: cmd
18+
run: |
19+
cmake -DCMAKE_BUILD_TYPE=Release -DDynamicBinaryInstrument=OFF -DPlugin.SymbolResolver=OFF -A x64 -B build64
20+
cmake -DCMAKE_BUILD_TYPE=Release -DDynamicBinaryInstrument=OFF -DPlugin.SymbolResolver=OFF -A Win32 -B build32
21+
22+
- name: Build x86
23+
run: |
24+
msbuild -m -p:Configuration=Release -t:dobby build32/Dobby.sln
25+
26+
- name: Build x64
27+
run: |
28+
msbuild -m -p:Configuration=Release -t:dobby build64/Dobby.sln
29+
30+
- name: Collect artifacts
31+
shell: cmd
32+
run: |
33+
mkdir build_result
34+
copy "build32\Release\dobby.dll" "build_result\dobby_x86.dll"
35+
copy "build64\Release\dobby.dll" "build_result\dobby_x64.dll"
36+
37+
- name: Upload a Build Artifact
38+
uses: actions/upload-artifact@v3.1.0
39+
with:
40+
name: Windows
41+
path: build_result
42+
43+
linux-build:
44+
runs-on: ubuntu-latest
45+
name: Linux Build
46+
47+
steps:
48+
- uses: actions/checkout@v3
49+
50+
- name: Install deps
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get -y install gcc-multilib g++-multilib libc6-dev-i386
54+
55+
- name: Configure CMake
56+
run: |
57+
cmake -DCMAKE_BUILD_TYPE=Release -DDynamicBinaryInstrument=OFF -DPlugin.SymbolResolver=OFF -B build64
58+
cmake -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_C_FLAGS="-m32" -DCMAKE_SHARED_LINKER_FLAGS="-m32" -DCMAKE_BUILD_TYPE=Release -DDynamicBinaryInstrument=OFF -DPlugin.SymbolResolver=OFF -B build86
59+
60+
- name: Build x64
61+
run: |
62+
cd build64 && make dobby
63+
64+
- name: Build x86
65+
run: |
66+
cd build86 && make dobby
67+
68+
- name: Collect artifacts
69+
run: |
70+
mkdir build_result
71+
cp build64/libdobby.so build_result/libdobby_x64.so
72+
cp build86/libdobby.so build_result/libdobby_x86.so
73+
74+
- name: Upload a Build Artifact
75+
uses: actions/upload-artifact@v3.1.0
76+
with:
77+
name: Linux
78+
path: build_result
79+
80+
macos-build:
81+
runs-on: macos-latest
82+
name: macOS Build
83+
84+
steps:
85+
- uses: actions/checkout@v3
86+
87+
- name: Configure CMake
88+
run: |
89+
cmake -DCMAKE_BUILD_TYPE=Release -DDynamicBinaryInstrument=OFF -DPlugin.SymbolResolver=OFF -B build64
90+
91+
- name: Build x64
92+
run: |
93+
cd build64 && make dobby
94+
95+
- name: Collect artifacts
96+
run: |
97+
mkdir build_result
98+
cp build64/libdobby.dylib build_result/libdobby_x64.dylib
99+
100+
- name: Upload a Build Artifact
101+
uses: actions/upload-artifact@v3.1.0
102+
with:
103+
name: macOS
104+
path: build_result
105+
106+
collect:
107+
runs-on: ubuntu-latest
108+
name: Collect build
109+
if: github.ref == 'refs/heads/master'
110+
needs: [win-build, linux-build, macos-build]
111+
112+
steps:
113+
- name: Download a Build Artifact
114+
uses: actions/download-artifact@v3.0.0
115+
116+
- name: ZIP versions
117+
run: |
118+
zip -r -j dobby-win.zip Windows/*.dll
119+
zip -r -j dobby-linux.zip Linux/*.so
120+
zip -r -j dobby-macos.zip macOS/*.dylib
121+
122+
- name: Automatic Releases
123+
uses: marvinpinto/action-automatic-releases@latest
124+
with:
125+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
126+
automatic_release_tag: "latest"
127+
prerelease: true
128+
title: "CI"
129+
files: |
130+
dobby-win.zip
131+
dobby-linux.zip
132+
dobby-macos.zip

0 commit comments

Comments
 (0)