-
-
Notifications
You must be signed in to change notification settings - Fork 393
158 lines (146 loc) · 7.06 KB
/
windows-all-build.yaml
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
name: CMake-windows-x86-x64
on:
push:
branches:
- 'develop'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
name: buildsrc
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest
steps:
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- uses: actions/checkout@v2
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{github.workspace}}/buildx86
- uses: suisei-cn/actions-download-file@v1
id: downloadfile1 # Remember to give an ID if you need the output filename
name: onnxruntime 1.7.0 x64
with:
url: "https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-win-x64-1.7.0.zip"
target: public/
- uses: suisei-cn/actions-download-file@v1
id: downloadfile2 # Remember to give an ID if you need the output filename
name: Download onnxruntime 1.7.0 x86
with:
url: "https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-win-x86-1.7.0.zip"
target: public/
- uses: suisei-cn/actions-download-file@v1
id: downloadfile3 # Remember to give an ID if you need the output filename
name: Download Opencv Library
with:
url: "https://github.com/RapidOCR/OpenCVBuilder/releases/download/4.5.1/opencv-4.5.1-windows-vs2019.7z"
target: public/
- name: setup working dir
run: |
mkdir c:\rapidocr
- name: Decompress
shell: powershell
run: |
Expand-7Zip -ArchiveFileName public/onnxruntime-win-x64-1.7.0.zip -TargetPath c:\rapidocr\
Expand-7Zip -ArchiveFileName public/onnxruntime-win-x86-1.7.0.zip -TargetPath c:\rapidocr\
- name: opencv install
run: |
Expand-7Zip -ArchiveFileName public/opencv-4.5.1-windows-vs2019.7z -TargetPath c:\rapidocr\
- name: list all file
shell: cmd
run: |
dir c:\rapidocr\windows-x64
dir c:\rapidocr\windows-x86
dir c:\rapidocr\
- name: Configure CMake x64
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -A x64
- name: Build-x64
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
- name: Configure CMake for x86
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/buildx86
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -A win32
- name: Build-x86
working-directory: ${{github.workspace}}/buildx86
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE
- name: PackZip
working-directory: ${{github.workspace}}/release
shell: cmd
run: |
mkdir ${{github.workspace}}\release\x86\
mkdir ${{github.workspace}}\release\x64\
cp ${{github.workspace}}/build/release/rapidocrapi.dll ${{github.workspace}}/release/x64/
cp ${{github.workspace}}/build/release/rapidocrtest.exe ${{github.workspace}}/release/x64/
cp ${{github.workspace}}/buildx86/release/rapidocrapi.dll ${{github.workspace}}/release/x86/
cp ${{github.workspace}}/buildx86/release/rapidocrtest.exe ${{github.workspace}}/release/x86/
mkdir ${{github.workspace}}\release\libx86\
mkdir ${{github.workspace}}\release\libx64\
mkdir ${{github.workspace}}\release\include\
cp ${{github.workspace}}\build\release\rapidocrapi.lib ${{github.workspace}}\release\libx64
cp ${{github.workspace}}\buildx86\release\rapidocrapi.lib ${{github.workspace}}\release\libx86
cp ${{github.workspace}}\include\rapidocr_api.h ${{github.workspace}}\release\include\
cp c:/rapidocr/onnxruntime-win-x64-1.7.0/lib/onnxruntime.dll ${{github.workspace}}\release\x64\
cp c:/rapidocr/onnxruntime-win-x86-1.7.0/lib/onnxruntime.dll ${{github.workspace}}\release\x86\
dir /s ${{github.workspace}}\release
powershell compress-7zip -path ${{github.workspace}}\release -ArchiveFileName d:\rapidocr-win-all.zip
dir d:\*.zip
- name: prepare_release
uses: srfrnk/current-time@master
id: prepare_release
with:
format: YYYYMMDD_X
- name: create_release
id: create_release
uses: actions/create-release@v1
env:
# GitHub 会自动创建 GITHUB_TOKEN 密码以在工作流程中使用
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: V_${{ steps.prepare_release.outputs.formattedTime }}
#${{steps.prepare_release.outputs.tag_name}}
release_name: Release Rapid_OCR_v1.0_x64_x86_${{ steps.prepare_release.outputs.formattedTime }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
# 只有create_release成功得到输出才继续
if: steps.create_release.outputs.upload_url
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: d:\rapidocr-win-all.zip
asset_name: rapidocr-win-all.zip
asset_content_type: application/zip