-
Notifications
You must be signed in to change notification settings - Fork 25
172 lines (145 loc) · 5.15 KB
/
Copy pathwindows.yml
File metadata and controls
172 lines (145 loc) · 5.15 KB
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
name: windows
on:
workflow_dispatch:
jobs:
windows:
strategy:
fail-fast: false
matrix:
ver:
- { cv: 4.11.0, jdk: 8, ant: 1.10.14 }
list:
- { win_ver: 2019, vs_name: vs2015, vs_ver: v140 }
- { win_ver: 2019, vs_name: vs2017, vs_ver: v141 }
- { win_ver: 2019, vs_name: vs2019, vs_ver: v142 }
- { win_ver: 2022, vs_name: vs2022, vs_ver: v143 }
arch:
[
x64,
x86,
arm64,
]
crt:
[
md,
mt,
]
exclude:
- list: { win_ver: 2019, vs_name: vs2015, vs_ver: v140 }
arch: arm64
- list: { win_ver: 2019, vs_name: vs2017, vs_ver: v141 }
arch: arm64
- list: { win_ver: 2022, vs_name: vs2022, vs_ver: v143 }
runs-on: windows-${{ matrix.list.win_ver }}
name: windows-${{ matrix.list.vs_name }}-${{ matrix.arch }}-${{ matrix.crt }}
env:
BUILD_SCRIPT: build-opencv4-win.ps1
BUILD_OPTIONS: opencv4_cmake_options.txt
PKG_NAME: opencv-${{ matrix.ver.cv }}-windows-${{ matrix.list.vs_name }}-${{ matrix.arch }}-${{ matrix.crt }}
JAVA_PKG_NAME: opencv-${{ matrix.ver.cv }}-windows-${{ matrix.list.vs_name }}-${{ matrix.arch }}-${{ matrix.crt }}-java
steps:
# Setup JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '${{ matrix.ver.jdk }}'
distribution: 'adopt'
- uses: cedx/setup-ant@v2
with:
optional-tasks: true
version: ${{ matrix.ver.ant }}
- name: ant version
run: ant -version
# 检出代码
- uses: actions/checkout@v4
# 检出opencv
- name: checkout opencv
uses: actions/checkout@v4
with:
repository: opencv/opencv
path: opencv-${{ matrix.ver.cv }}
ref: ${{ matrix.ver.cv }}
submodules: recursive
# 复制
- name: copy
run: |
cp ${{ env.BUILD_SCRIPT }} opencv-${{ matrix.ver.cv }}
cp ${{ env.BUILD_OPTIONS }} opencv-${{ matrix.ver.cv }}
# 编译
# https://github.com/ilammy/msvc-dev-cmd
#- uses: ilammy/msvc-dev-cmd@v1
- name: build
shell: powershell
run: |
cd opencv-${{ matrix.ver.cv }}
.\${{ env.BUILD_SCRIPT }} -VsArch ${{ matrix.arch }} -VsVer ${{ matrix.list.vs_ver }} -VsCRT ${{ matrix.crt }}
- name: 7zip libs
run: |
cp -r opencv-${{ matrix.ver.cv }}/build-${{ matrix.arch }}-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install ${{ env.PKG_NAME }}
7z a ${{ env.PKG_NAME }}.7z ${{ env.PKG_NAME }}
rm ${{ env.PKG_NAME }} -r -fo
- name: build java
shell: powershell
run: |
cd opencv-${{ matrix.ver.cv }}
.\${{ env.BUILD_SCRIPT }} -VsArch ${{ matrix.arch }} -VsVer ${{ matrix.list.vs_ver }} -VsCRT ${{ matrix.crt }} -BuildJava
- name: 7zip java
run: |
cp -r opencv-${{ matrix.ver.cv }}/build-${{ matrix.arch }}-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install/java ${{ env.JAVA_PKG_NAME }}
7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }}
rm ${{ env.JAVA_PKG_NAME }} -r -fo
# 上传artifact
- name: upload lib
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: ${{ env.PKG_NAME }}.7z
- name: upload java lib
uses: actions/upload-artifact@v4
with:
name: ${{ env.JAVA_PKG_NAME }}
path: ${{ env.JAVA_PKG_NAME }}.7z
release:
needs: [ windows ]
runs-on: ubuntu-latest
steps:
# 检出代码
- uses: actions/checkout@v4
# 获取所有的git log和tag
# - name: Unshallow
# run: git fetch --prune --unshallow
# 获取git log 从 previousTag 到 lastTag
# - name: Get git log
# id: git-log
# run: |
# previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
# lastTag=$(git describe --abbrev=0 --tags)
# echo "previousTag:$previousTag ~ lastTag:$lastTag"
# log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S')
# echo "$log"
# echo "log_state="$log"" >> $GITHUB_ENV
# 创建Changelog文件 triggered by git tag push
# - name: Generate Changelog
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# echo -e '${{ env.log_state }}' > release.md
# 下载artifact
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
# 查看artifact
- name: list artifact
run: |
tree artifacts
# 创建release 上传release
# https://github.com/marketplace/actions/create-release
- name: upload-windows
uses: ncipollo/release-action@v1
with:
prerelease: false
bodyFile: release.md
artifacts: artifacts/*/*.7z
allowUpdates: true
artifactContentType: application/x-7z-compressed
token: ${{ secrets.GITHUB_TOKEN }}