1
+ name : QMake Build Matrix
2
+
3
+ on : [push]
4
+
5
+ env :
6
+ QT_VERSION : 6.8.0
7
+
8
+ jobs :
9
+ build :
10
+ name : ${{ matrix.config.name }}
11
+ runs-on : ${{ matrix.config.os }}
12
+ strategy :
13
+ matrix :
14
+ config :
15
+ - {
16
+ name : " Windows Latest x64" ,
17
+ artifact : " Windows-x64.zip" ,
18
+ arch : win64_msvc2022_64,
19
+ os : windows-latest,
20
+ environment_script : " C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
21
+ }
22
+ - {
23
+ name : " Windows Latest x86" ,
24
+ artifact : " Windows-x86.zip" ,
25
+ arch : win64_msvc2022_64,
26
+ os : windows-latest,
27
+ environment_script : " C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
28
+ }
29
+ - {
30
+ name : " Linux Latest x64" ,
31
+ artifact : " Linux-x64.zip" ,
32
+ arch : " " ,
33
+ os : ubuntu-latest
34
+ }
35
+ # - {
36
+ # name: "macOS Latest x64",
37
+ # artifact: "macOS-x64.zip",
38
+ # arch: "",
39
+ # os: macos-latest
40
+ # }
41
+
42
+ steps :
43
+ - uses : actions/checkout@v1
44
+
45
+ - name : Installing system libs
46
+ shell : cmake -P {0}
47
+ run : |
48
+ if ("${{ runner.os }}" STREQUAL "Linux")
49
+ execute_process(
50
+ COMMAND sudo apt install libusb-1.0-0-dev
51
+ )
52
+ endif()
53
+
54
+ - name : Download Qt
55
+ id : qt
56
+ uses : jurplel/install-qt-action@v4
57
+ with :
58
+ version : " ${{ env.QT_VERSION }}"
59
+ arch : " ${{ matrix.config.arch }}"
60
+
61
+ - name : Configure
62
+ shell : cmake -P {0}
63
+ run : |
64
+ if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
65
+ execute_process(
66
+ COMMAND "${{ matrix.config.environment_script }}" && set
67
+ OUTPUT_FILE environment_script_output.txt
68
+ )
69
+ file(STRINGS environment_script_output.txt output_lines)
70
+ foreach(line IN LISTS output_lines)
71
+ if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
72
+ set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
73
+
74
+ # Set for other steps
75
+ message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}")
76
+ endif()
77
+ endforeach()
78
+ endif()
79
+
80
+ file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir)
81
+
82
+ execute_process(
83
+ COMMAND qmake
84
+ $ENV{PLUGIN_PRO}
85
+ CONFIG+=release
86
+ QTC_SOURCE="${qtcreator_dir}"
87
+ QTC_BUILD="${qtcreator_dir}"
88
+ RESULT_VARIABLE result
89
+ )
90
+ if (NOT result EQUAL 0)
91
+ message(FATAL_ERROR "Bad exit status")
92
+ endif()
93
+
94
+ - name : Build
95
+ shell : cmake -P {0}
96
+ run : |
97
+ if (NOT "${{ runner.os }}" STREQUAL "Windows")
98
+ set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}")
99
+ endif()
100
+
101
+ include(ProcessorCount)
102
+ ProcessorCount(N)
103
+
104
+ set(make_program make -j ${N})
105
+ if ("${{ runner.os }}" STREQUAL "Windows")
106
+ set(make_program "qtcreator/bin/jom")
107
+ endif()
108
+
109
+ execute_process(
110
+ COMMAND ${make_program}
111
+ RESULT_VARIABLE result
112
+ )
113
+ if (NOT result EQUAL 0)
114
+ message(FATAL_ERROR "Bad exit status")
115
+ endif()
116
+
117
+ file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact)
118
+
119
+ execute_process(COMMAND
120
+ ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}"
121
+ WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}"
122
+ )
123
+
124
+ - uses : actions/upload-artifact@v4
125
+ id : upload_artifact
126
+ with :
127
+ path : ./qtusb-${{ matrix.config.artifact }}
128
+ name : qtusb-${{ matrix.config.artifact }}
129
+
130
+ release :
131
+ if : contains(github.ref, 'tags/v')
132
+ runs-on : ubuntu-latest
133
+ needs : build
134
+
135
+ steps :
136
+ - name : Create Release
137
+ id : create_release
138
+
139
+ env :
140
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141
+ with :
142
+ tag_name : ${{ github.ref }}
143
+ release_name : Release ${{ github.ref }}
144
+ draft : false
145
+ prerelease : false
146
+
147
+ - name : Store Release url
148
+ run : |
149
+ echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
150
+
151
+ - uses : actions/upload-artifact@v1
152
+ with :
153
+ path : ./upload_url
154
+ name : upload_url
155
+
156
+ publish :
157
+ if : contains(github.ref, 'tags/v')
158
+
159
+ name : ${{ matrix.config.name }}
160
+ runs-on : ${{ matrix.config.os }}
161
+ strategy :
162
+ matrix :
163
+ config :
164
+ - {
165
+ name : " Windows Latest x64" ,
166
+ artifact : " Windows-x64.zip" ,
167
+ os : ubuntu-latest
168
+ }
169
+ - {
170
+ name : " Windows Latest x86" ,
171
+ artifact : " Windows-x86.zip" ,
172
+ os : ubuntu-latest
173
+ }
174
+ - {
175
+ name : " Linux Latest x64" ,
176
+ artifact : " Linux-x64.zip" ,
177
+ os : ubuntu-latest
178
+ }
179
+ # - {
180
+ # name: "macOS Latest x64",
181
+ # artifact: "macOS-x64.zip",
182
+ # os: macos-latest
183
+ # }
184
+ needs : release
185
+
186
+ steps :
187
+ - name : Download artifact
188
+ uses : actions/download-artifact@v1
189
+ with :
190
+ name : ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
191
+ path : ./
192
+
193
+ - name : Download URL
194
+ uses : actions/download-artifact@v1
195
+ with :
196
+ name : upload_url
197
+ path : ./
198
+ - id : set_upload_url
199
+ run : |
200
+ upload_url=`cat ./upload_url`
201
+ echo ::set-output name=upload_url::$upload_url
202
+
203
+ - name : Upload to Release
204
+ id : upload_to_release
205
+
206
+ env :
207
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
208
+ with :
209
+ upload_url : ${{ steps.set_upload_url.outputs.upload_url }}
210
+ asset_path : ./qtusb-${{ matrix.config.artifact }}
211
+ asset_name : qtusb}-${{ matrix.config.artifact }}
212
+ asset_content_type : application/zip
0 commit comments