windows #38
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: windows | |
on: | |
workflow_dispatch: | |
jobs: | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
ver: | |
- { cv: 3.4.18, 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: 2022, vs_name: vs2022, vs_ver: v143 } | |
- list: { win_ver: 2019, vs_name: vs2015, vs_ver: v140 } | |
arch: arm64 | |
- list: { win_ver: 2019, vs_name: vs2017, vs_ver: v141 } | |
arch: arm64 | |
runs-on: windows-${{ matrix.list.win_ver }} | |
name: windows-${{ matrix.list.vs_name }}-${{ matrix.arch }}-${{ matrix.crt }} | |
env: | |
BUILD_SCRIPT: build-opencv3-win.ps1 | |
BUILD_OPTIONS: opencv3_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 }} |