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