-
Notifications
You must be signed in to change notification settings - Fork 0
244 lines (201 loc) · 10.8 KB
/
workflow_pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: MultiSense Viewer Pull request workflow
on:
pull_request:
types: [opened, synchronize, reopened]
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
VersionJob:
name: "Set Version"
runs-on: ubuntu-latest
outputs:
install_path: ${{ steps.install_path_id.outputs.install_path }}
install_path_ubuntu: ${{ steps.install_path_id.outputs.install_path }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # Mandatory to use the extract version from tag action
- name: Extract version from tag
uses: damienaicheh/[email protected]
- name: Print version
run: echo "The version is ${{ env.MAJOR }}.${{ env.MINOR }}-${{ env.PATCH }}"
- name: Set Output
id: install_path_id
run: echo "install_path=multisense_${{ env.MAJOR }}.${{ env.MINOR }}-${{ env.PATCH }}_amd64" >> $GITHUB_OUTPUT
- name: Set Output Ubuntu
id: install_path_id_ubuntu
run: echo "install_path_ubuntu=multisense_${{ env.MAJOR }}.${{ env.MINOR }}-${{ env.PATCH }}_amd64/opt/multisense" >> $GITHUB_OUTPUT
- name: Fetch all tags
run: git fetch --tags
- name: Get the latest tag
id: get_tag
run: echo "::set-output name=TAG::$(git describe --tags --abbrev=0)"
- name: Print version
run: echo "The version is ${{ steps.get_tag.outputs.TAG }}"
- name: Set Output
id: install_path_id
run: echo "install_path=multisense_${{ steps.get_tag.outputs.TAG }}_amd64" >> $GITHUB_OUTPUT
- name: Set Output Ubuntu
id: install_path_id_ubuntu
run: echo "install_path_ubuntu=multisense_${{ steps.get_tag.outputs.TAG }}_amd64/opt/multisense" >> $GITHUB_OUTPUT
BuildWindows:
name: Build For Windows
needs: [VersionJob]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGIT_SUBMODULE=OFF -DWARNINGS_AS_ERRORS=FALSE #-D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11
- name: Build project
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install -- /m:10
- name: zipFiles
uses: vimtor/action-zip@v1
with:
files: ./build/${{ needs.VersionJob.outputs.install_path }}
dest: MultiSense_viewer.zip
- name: "Create Artifact"
uses: actions/upload-artifact@v4
with:
name: multisense-zip
path: ${{github.workspace}}/MultiSense_viewer.zip
BuildUbuntu20:
name: Build and package for Ubuntu 20_04
needs: [VersionJob]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-20.04
steps:
- name: print install location
run: echo "My output is ${{ needs.VersionJob.outputs.install_path }}"
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Install dependencies
run: sudo apt-get install -y cmake libx11-dev build-essential xorg-dev libtbb-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libssl-dev libgtk-3-dev libsystemd-dev
#- name: update gcc11
#run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt update && sudo apt install -y gcc-11 g++-11
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGIT_SUBMODULE=OFF -DWARNINGS_AS_ERRORS=FALSE #-D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build -- -j3
- name: Install
working-directory: ${{github.workspace}}/build
run: cmake --install . --config ${{env.BUILD_TYPE}}
- name: Prepare package step
working-directory: ${{github.workspace}}/build
run: |
mkdir ${{ needs.VersionJob.outputs.install_path }}/DEBIAN && cp ${{github.workspace}}/Assets/Tools/Ubuntu/control ${{ needs.VersionJob.outputs.install_path }}/DEBIAN/
mkdir -p ${{ needs.VersionJob.outputs.install_path }}/usr/share/applications && cp ${{github.workspace}}/Assets/Tools/Ubuntu/multisense.desktop ${{ needs.VersionJob.outputs.install_path }}/usr/share/applications/
cp ${{github.workspace}}/Assets/Tools/Ubuntu/start.sh ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/include
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/lib
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/share
- name: Package
working-directory: ${{github.workspace}}/build
run: dpkg-deb --build --root-owner-group ${{ needs.VersionJob.outputs.install_path }}
BuildUbuntu22:
name: Build and package for Ubuntu 22_04
needs: [VersionJob]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
steps:
- name: print install location
run: echo "My output is ${{ needs.VersionJob.outputs.install_path }}"
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Install dependencies
run: sudo apt-get install -y cmake libx11-dev build-essential xorg-dev libtbb-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libssl-dev libgtk-3-dev libsystemd-dev libwebp-dev
#- name: update gcc11
#run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt update && sudo apt install -y gcc-11 g++-11
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGIT_SUBMODULE=OFF -DWARNINGS_AS_ERRORS=FALSE #-D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build -- -j3
- name: Install
working-directory: ${{github.workspace}}/build
run: cmake --install . --config ${{env.BUILD_TYPE}}
- name: Prepare package step
working-directory: ${{github.workspace}}/build
run: |
mkdir ${{ needs.VersionJob.outputs.install_path }}/DEBIAN && cp ${{github.workspace}}/Assets/Tools/Ubuntu/control ${{ needs.VersionJob.outputs.install_path }}/DEBIAN/
mkdir -p ${{ needs.VersionJob.outputs.install_path }}/usr/share/applications && cp ${{github.workspace}}/Assets/Tools/Ubuntu/multisense.desktop ${{ needs.VersionJob.outputs.install_path }}/usr/share/applications/
cp ${{github.workspace}}/Assets/Tools/Ubuntu/start.sh ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/include
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/lib
rm -rf ${{ needs.VersionJob.outputs.install_path }}/opt/multisense/share
- name: Package
working-directory: ${{github.workspace}}/build
run: dpkg-deb --build --root-owner-group ${{ needs.VersionJob.outputs.install_path }}
build:
name: Create Windows Installer
needs: [BuildWindows]
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Artifacts
uses: actions/download-artifact@v2
with:
name: multisense-zip
- name: Extract some files
run: |
mkdir files
tar -xf .\MultiSense_viewer.zip -C .\files\
mv .\files\Assets\Tools\windows\inno_setup_script.iss .\
mv .\files\Assets\Tools\compile.sh .\
mv .\files\Assets\Tools\install_spirv_compiler.sh .\
mv .\files\Assets\Tools\monitor_memory_usage.py .\
mv .\files\Assets\Tools\Windows\build_installer.ps1 .\
mv .\files\Assets\Tools\how_to_release .\
rm -R .\files\Assets\Tools\Ubuntu
rm -R .\files\bin
rm -R .\files\include
rm -R .\files\lib
shell: cmd
- name: Building the installer
run: |
"%programfiles(x86)%\inno Setup 6\iscc.exe" "inno_setup_script.iss"
shell: cmd