-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (168 loc) · 5.23 KB
/
build.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
name: Build Software
on:
push:
paths-ignore:
- 'report/**'
- 'matlab/**'
- 'README.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'report/**'
- 'matlab/**'
- 'README.md'
- 'LICENSE'
jobs:
try_create_release:
name: Try create release
runs-on: ubuntu-latest
steps:
- name: Do nothing
run: echo nothing
- name: Create Release
if: startsWith(github.event.ref, 'refs/tags/')
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Output Release URL File
if: startsWith(github.event.ref, 'refs/tags/')
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
if: startsWith(github.event.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt
windows:
name: Build on Windows
needs: try_create_release
runs-on: windows-latest
strategy:
matrix:
qt_arch: [win64_msvc2017_64, win32_msvc2017]
include:
- qt_arch: win64_msvc2017_64
msvc_arch: x64
- qt_arch: win32_msvc2017
msvc_arch: x86
steps:
- name: Install Qt
uses: jurplel/[email protected]
with:
arch: ${{ matrix.qt_arch }}
modules: qtcharts
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build msvc
shell: cmd
env:
vc_arch: ${{ matrix.msvc_arch }}
run: |
cd DIP-src
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%
qmake
nmake
windeployqt ../bin/
- name: Package
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: Compress-Archive -Path bin ${{ matrix.qt_arch }}
- name: Load Release URL File from release job
if: startsWith(github.event.ref, 'refs/tags/')
uses: actions/download-artifact@v1
with:
name: release_url
- name: Get Release File Name & Upload URL
if: startsWith(github.event.ref, 'refs/tags/')
id: get_release_info
shell: bash
run: |
echo ::set-output name=file_name::DIP-${QT_ARCH##*/}-${TAG_REF_NAME##*/v}
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
env:
TAG_REF_NAME: ${{ github.ref }}
QT_ARCH: ${{ matrix.qt_arch }}
- name: Upload Release Asset
if: startsWith(github.event.ref, 'refs/tags/')
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./${{ matrix.qt_arch }}.zip
asset_name: ${{ steps.get_release_info.outputs.file_name }}.zip
asset_content_type: application/zip
macos:
name: Build on MacOS
needs: try_create_release
runs-on: macos-latest
steps:
- name: Install Qt
uses: jurplel/[email protected]
with:
modules: qtcharts
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build macos
run: |
cd DIP-src
export PATH=$PATH:$Qt5_Dir
qmake
make
macdeployqt ../bin/DIP.app -verbose=1 -dmg
- name: Load Release URL File from release job
if: startsWith(github.event.ref, 'refs/tags/')
uses: actions/download-artifact@v1
with:
name: release_url
- name: Get Release File Name & Upload URL
if: startsWith(github.event.ref, 'refs/tags/')
id: get_release_info
shell: bash
run: |
echo ::set-output name=file_name::DIP-macos-${TAG_REF_NAME##*/v}
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
env:
TAG_REF_NAME: ${{ github.ref }}
- name: Upload Release Asset
if: startsWith(github.event.ref, 'refs/tags/')
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./bin/DIP.dmg
asset_name: ${{ steps.get_release_info.outputs.file_name }}.dmg
asset_content_type: application/applefile
ubuntu:
name: Build on Ubuntu
needs: try_create_release
runs-on: ubuntu-latest
steps:
- name: Install Qt
uses: jurplel/[email protected]
with:
modules: qtcharts
- name: ubuntu install GL library
run: sudo apt-get install -y libglew-dev libglfw3-dev
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build ubuntu
run: |
cd DIP-src
export PATH=$PATH:$Qt5_Dir
qmake
make