Skip to content

Commit d356604

Browse files
authored
Merge pull request #3 from pzhlkj6612/new_init
Add MinGW building
2 parents 7650e16 + ffedae3 commit d356604

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed

.github/workflows/windows-mingw.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Windows MinGW
2+
on:
3+
push:
4+
paths-ignore:
5+
- 'README.md'
6+
- 'LICENSE'
7+
pull_request:
8+
paths-ignore:
9+
- 'README.md'
10+
- 'LICENSE'
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: windows-2019
15+
strategy:
16+
matrix:
17+
include:
18+
- qt_arch: win32_mingw53
19+
qt_ver: 5.9.9
20+
qt_tools: "tools_mingw,5.3.0-2,qt.tools.win32_mingw530"
21+
qt_tools_mingw_install: mingw530_32
22+
- qt_arch: win32_mingw53
23+
qt_ver: 5.10.1
24+
qt_tools: "tools_mingw,5.3.0-2,qt.tools.win32_mingw530"
25+
qt_tools_mingw_install: mingw530_32
26+
- qt_arch: win32_mingw53
27+
qt_ver: 5.11.3
28+
qt_tools: "tools_mingw,5.3.0-2,qt.tools.win32_mingw530"
29+
qt_tools_mingw_install: mingw530_32
30+
- qt_arch: win32_mingw73
31+
qt_ver: 5.12.10
32+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win32_mingw730"
33+
qt_tools_mingw_install: mingw730_32
34+
- qt_arch: win32_mingw73
35+
qt_ver: 5.13.2
36+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win32_mingw730"
37+
qt_tools_mingw_install: mingw730_32
38+
- qt_arch: win32_mingw73
39+
qt_ver: 5.14.2
40+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win32_mingw730"
41+
qt_tools_mingw_install: mingw730_32
42+
- qt_arch: win64_mingw73
43+
qt_ver: 5.12.10
44+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win64_mingw730"
45+
qt_tools_mingw_install: mingw730_64
46+
- qt_arch: win64_mingw73
47+
qt_ver: 5.13.2
48+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win64_mingw730"
49+
qt_tools_mingw_install: mingw730_64
50+
- qt_arch: win64_mingw73
51+
qt_ver: 5.14.2
52+
qt_tools: "tools_mingw,7.3.0-1-202004170606,qt.tools.win64_mingw730"
53+
qt_tools_mingw_install: mingw730_64
54+
- qt_arch: win32_mingw81
55+
qt_ver: 5.15.2
56+
qt_tools: "tools_mingw,8.1.0-1-202004170606,qt.tools.win32_mingw810"
57+
qt_tools_mingw_install: mingw810_32
58+
- qt_arch: win64_mingw81
59+
qt_ver: 5.15.2
60+
qt_tools: "tools_mingw,8.1.0-1-202004170606,qt.tools.win64_mingw810"
61+
qt_tools_mingw_install: mingw810_64
62+
- qt_arch: win64_mingw81
63+
qt_ver: 6.0.0
64+
qt_tools: "tools_mingw,8.1.0-1-202004170606,qt.tools.win64_mingw810"
65+
qt_tools_mingw_install: mingw810_64
66+
env:
67+
targetName: HelloActions-Qt.exe
68+
steps:
69+
- name: Install Qt
70+
uses: jurplel/install-qt-action@v2.10.0
71+
with:
72+
version: ${{ matrix.qt_ver }}
73+
arch: ${{ matrix.qt_arch }}
74+
tools: ${{ matrix.qt_tools }}
75+
aqtversion: '==0.10.0'
76+
cached: 'false'
77+
- uses: actions/checkout@v1
78+
with:
79+
fetch-depth: 1
80+
- name: Qt 5 environment configuration
81+
if: ${{ startsWith( matrix.qt_ver, 5 ) }}
82+
shell: pwsh
83+
run: |
84+
Write-Output "${{ env.Qt5_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
85+
Write-Output "${{ env.Qt5_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
86+
- name: Qt 6 environment configuration
87+
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
88+
shell: pwsh
89+
run: |
90+
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
91+
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
92+
- name: where is qmake & where is mingw32-make
93+
shell: pwsh
94+
run: |
95+
Get-Command -Name 'qmake' | Format-List
96+
Get-Command -Name 'mingw32-make' | Format-List
97+
- name: mingw-build
98+
id: build
99+
shell: cmd
100+
run: |
101+
qmake
102+
mingw32-make
103+
- name: package
104+
id: package
105+
env:
106+
archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_target }}-${{ matrix.qt_arch }}
107+
shell: pwsh
108+
run: |
109+
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
110+
$name = ${env:archiveName}
111+
echo "::set-output name=packageName::$name"
112+
- uses: actions/upload-artifact@v2
113+
with:
114+
name: ${{ steps.package.outputs.packageName }}
115+
path: ${{ steps.package.outputs.packageName }}.zip
116+
- name: uploadRelease
117+
if: startsWith(github.event.ref, 'refs/tags/')
118+
uses: svenstaro/upload-release-action@v2
119+
with:
120+
repo_token: ${{ secrets.GITHUB_TOKEN }}
121+
file: ${{ steps.package.outputs.packageName }}.zip
122+
asset_name: ${{ steps.package.outputs.packageName }}.zip
123+
tag: ${{ github.ref }}
124+
overwrite: true

scripts/windows-mingw-publish.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[CmdletBinding()]
2+
param (
3+
[string] $archiveName, [string] $targetName
4+
)
5+
# 外部环境变量包括:
6+
# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
7+
8+
9+
# archiveName: 5.15.2-win64_mingw81
10+
11+
$scriptDir = $PSScriptRoot
12+
$currentDir = Get-Location
13+
Write-Host "currentDir" $currentDir
14+
Write-Host "scriptDir" $scriptDir
15+
16+
function Main() {
17+
18+
New-Item -ItemType Directory $archiveName
19+
# 拷贝exe
20+
Copy-Item bin\release\$targetName $archiveName\
21+
# 拷贝依赖
22+
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
23+
# 删除不必要的文件
24+
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
25+
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
26+
# 打包zip
27+
Compress-Archive -Path $archiveName $archiveName'.zip'
28+
}
29+
30+
if ($null -eq $archiveName || $null -eq $targetName) {
31+
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
32+
return
33+
}
34+
Main
35+
36+

0 commit comments

Comments
 (0)