Update QQ group #83
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake-windows-x86-x64 | |
on: | |
push: | |
branches: | |
- 'develop' | |
tags: | |
- "*" | |
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 |