Skip to content

Commit

Permalink
Merge branch 'dev' into dev-new-api
Browse files Browse the repository at this point in the history
  • Loading branch information
GengGode committed Feb 10, 2024
2 parents a20c481 + 65f184f commit 4e2f53d
Show file tree
Hide file tree
Showing 101 changed files with 3,102 additions and 2,796 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: dev-window-dynamic
name: dev

on:
push:
branches: [ "dev" ]
paths:
- 'source/**'
- '.github/workflows/dev-window-dynamic.yml'
- '.github/workflows/dev.yml'
pull_request:
branches: [ "dev" ]
paths:
- 'source/**'
- '.github/workflows/dev-window-dynamic.yml'
- '.github/workflows/dev.yml'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack.Depends
path: ${{github.workspace}}/build/bin/Release/opencv_world480.dll
path: ${{github.workspace}}/build/bin/Release/opencv_*.dll
if-no-files-found: 'warn'

release:
Expand Down
152 changes: 152 additions & 0 deletions .github/workflows/release-and-publish-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: release-and-publish-core
on:
push:
branches: [ "release-core" ]
paths:
- 'source/**'
- '.github/workflows/release-and-publish-core.yml'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# 跳过提交信息开头为doc:或者docs:的提交
if: "!startsWith(github.event.head_commit.message, 'doc:') && !startsWith(github.event.head_commit.message, 'docs:')"
runs-on: self-hosted
outputs:
version: ${{ steps.get_version.outputs._version }}

steps:
- uses: actions/checkout@v3

- name: test env
run: |
dir
echo "github.workspace: ${{github.workspace}}"
echo "github.ref: ${{github.ref}}"
dir ${{github.workspace}}
- name: clone third party submodule
run: git submodule update --init --recursive

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Get the Version
id: get_version
run: |
$version = (Get-Content -Path ${{github.workspace}}/build/bin/Release/version -TotalCount 1).Trim()
echo "dll version: $version"
echo "_version=$version" >> $env:GITHUB_OUTPUT
- name: zip all dll
run: |
$version = '${{steps.get_version.outputs._version}}'
echo "dll version: $version"
Compress-Archive -Path ${{github.workspace}}/build/bin/Release/cvAutoTrack.dll -DestinationPath ${{github.workspace}}/build/bin/Release/cvAutoTrack-$version.zip
$files = $(ls ${{github.workspace}}/build/bin/Release/opencv_*.dll)
foreach ($file_str in $files)
{
$file = New-Object System.IO.FileInfo("$file_str")
$fileNmae = $file.BaseName
$hash = $(Get-FileHash -Path $file_str -Algorithm MD5).Hash
Compress-Archive -Path $file -DestinationPath ${{github.workspace}}/build/bin/Release/$fileNmae-$hash.zip
}
- name: Upload a Build Artifact for Release
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack
path: ${{github.workspace}}/build/bin/Release/cvAutoTrack-*.zip
if-no-files-found: 'warn'
- name: Upload a Build Artifact for Core pdb
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack pdb
path: ${{github.workspace}}/build/bin/Release/cvAutoTrack.pdb
if-no-files-found: 'warn'

- name: Upload a Build Artifact for Release.Depends
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack.Depends
path: ${{github.workspace}}/build/bin/Release/opencv_*.zip
if-no-files-found: 'warn'

push-file:
if: github.ref == 'refs/heads/release-core'
needs: build
runs-on: self-hosted
env:
Version: ${{ needs.build.outputs.version }}
loginToken: ${{ secrets.AlistLoginToken }}
UpdataToken: ${{ secrets.TianLiUpdateServiceToken }}
steps:
- name: Download a Build Artifact for Core
uses: actions/download-artifact@v3
with:
name: cvAutoTrack
path: ${{github.workspace}}/Release/

- name: Download a Build Artifact for Depends
uses: actions/download-artifact@v3
with:
name: cvAutoTrack.Depends
path: ${{github.workspace}}/Release/

- name: push core file
run: |
. ${{github.workspace}}/ci/AlistProxy.ps1
$version = '${{ needs.build.outputs.version }}'
$login_password = '${{ env.loginToken }}'
Write-Host "Login ..."
$token = Get-LoginToken -username 'GitAction' -password $login_password
$file = Get-ChildItem ${{github.workspace}}/Release/cvAutoTrack-*.zip
$upload_core_paths = @('/sync/TianLiUpdateService.tianyi/cvAutoTrack.Core/',
'/sync/TianLiUpdateService.object/cvAutoTrack.Core/',
'/sync/TianLiUpdateService.local/cvAutoTrack.Core/')
Write-Host "upload file: $file"
Put-FileToAlist -token $token -file $file -target_filename $file.Name -upload_paths $upload_core_paths
- name: push deps file
run: |
. ${{github.workspace}}/ci/AlistProxy.ps1
$version = '${{ needs.build.outputs.version }}'
$login_password = '${{ env.loginToken }}'
Write-Host "Login ..."
$token = Get-LoginToken -username 'GitAction' -password $login_password
$files = Get-ChildItem -Path '${{github.workspace}}/Release/opencv_*' -Filter '*.zip'
$upload_deps_paths = @('/sync/TianLiUpdateService.tianyi/cvAutoTrack.Core/deps/',
'/sync/TianLiUpdateService.object/cvAutoTrack.Core/deps/',
'/sync/TianLiUpdateService.local/cvAutoTrack.Core/deps/')
foreach ($file in $files) {
Write-Host "upload file: $file"
Put-FileToAlist -token $token -file $file -target_filename $file.Name -upload_paths $upload_deps_paths
}
- name: push version
run: |
. ${{github.workspace}}/ci/UpdateServiceProxy.ps1
$deps_files = Get-ChildItem -Path '${{github.workspace}}/Release/opencv_*' -Filter '*.zip'
$parent_dir_url = "https://download.weixitianli.com/d/TianLiUpdateService/cvAutoTrack.Core/deps/"
$depsJson = GenDepsJson -deps_files $deps_files -parent_dir_url $parent_dir_url
$version = '${{ needs.build.outputs.version }}'
$cvAutoTrackFile = Get-ChildItem ${{github.workspace}}/Release/cvAutoTrack-*.zip
$log = "Auto Build"
$downloadUrl = "https://download.weixitianli.com/d/TianLiUpdateService/cvAutoTrack.Core/cvAutoTrack-" + $version + ".zip"
$jsonBody = GenVersionPostBody -version $version -cvAutoTrackFile $cvAutoTrackFile -log $log -downloadUrl $downloadUrl -depsJson $depsJson
echo $jsonBody > ${{github.workspace}}/Release/version.json
$token = '${{ env.UpdataToken }}'
$info = PostVersion -token $token -jsonBody $jsonBody
Write-Host "PostVersion: $info"
142 changes: 142 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: release-and-publish
on:
push:
branches: [ "dev", "master"]
paths:
- 'source/**'
- '.github/workflows/release-and-publish.yml'
pull_request:
branches: [ "dev", "master" ]
paths:
- 'source/**'
- '.github/workflows/drelease-and-publish.yml'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# 跳过提交信息开头为doc:或者docs:的提交
if: "!startsWith(github.event.head_commit.message, 'doc:') && !startsWith(github.event.head_commit.message, 'docs:')"
runs-on: self-hosted
outputs:
version: ${{ steps.get_version.outputs._version }}

steps:
- uses: actions/checkout@v3

- name: test env
run: |
dir
echo "github.workspace: ${{github.workspace}}"
echo "github.ref: ${{github.ref}}"
dir ${{github.workspace}}
- name: clone third party submodule
run: git submodule update --init --recursive

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Get the Version
id: get_version
run: |
$version = (Get-Content -Path ${{github.workspace}}/build/bin/Release/version -TotalCount 1).Trim()
echo "dll version: $version"
echo "_version=$version" >> $env:GITHUB_OUTPUT
- name: Upload a Build Artifact for Release
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack
path: ${{github.workspace}}/build/bin/Release/cvAutoTrack.dll
if-no-files-found: 'warn'

- name: Upload a Build Artifact for Release.Depends
uses: actions/upload-artifact@v3
with:
name: cvAutoTrack.Depends
path: ${{github.workspace}}/build/bin/Release/opencv_*.dll
if-no-files-found: 'warn'

release:
# only run in master branch
if: github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v3
with:
name: cvAutoTrack
path: ${{github.workspace}}/Release/

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
Version: ${{ needs.build.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.Version }}
release_name: Release ${{ env.Version }}
draft: false
prerelease: false
- name: Upload a Inface Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{github.workspace}}/Release/*.dll
asset_content_type: application/x-msdownload

#push-version:
# if: github.ref == 'refs/heads/master'
# needs: release
# runs-on: ubuntu-latest
# outputs:
# version: ${{ steps.get_new_version.outputs.new_version }}
# steps:
# - uses: actions/checkout@v3
#
# - name: Download a Build Artifact
# uses: actions/download-artifact@v3
# with:
# name: cvAutoTrack
# path: ${{github.workspace}}/Release/
#
# - name: Get Current Version
# id: get_new_version
# run: |
# version=$(cat ${{github.workspace}}/Release/version)
# # 需要取出可能的行尾
# version=${version%$'\r'}
# echo "Current version: $version"
# # split version
# version_pack=(${version//./ })
# major=${version_pack[0]}
# minor=${version_pack[1]}
# patch=${version_pack[2]}
# echo "major: $major, minor: $minor, patch: $patch"
# # update version
# patch=$((patch+1))
# echo "new version: $major.$minor.$patch"
# #echo "new_version=$major.$minor.$patch" >> $env:GITHUB_OUTPUT
# #需要清空版本文件
# echo "$major.$minor.$patch" > ${{github.workspace}}/source/version
#
# - name: Update Version
# run: |
# new_version=$(cat ${{github.workspace}}/source/version)
# echo "new version: $new_version"
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git add ${{github.workspace}}/source/version
# git commit -m "update:version to $new_version"
# git push

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: test-window-dynamic
name: test

on:
push:
branches: [ "*" ]
paths:
- 'source/**'
- 'tests/**'
- '.github/workflows/test-window-dynamic.yml'
- '.github/workflows/test.yml'
pull_request:
# 除了master分支,其他分支都不触发
branches: [ master ]
paths:
- 'source/**'
- 'tests/**'
- '.github/workflows/test-window-dynamic.yml'
- '.github/workflows/test.yml'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "third_party/opencv-highgui-shared"]
path = third_party/opencv-highgui-shared
url = https://github.com/GengGode/opencv-highgui-shared.git
[submodule "third_party/opencv-cvv-dll"]
path = third_party/opencv-cvv-dll
url = https://github.com/GengGode/opencv-cvv-dll.git
Loading

0 comments on commit 4e2f53d

Please sign in to comment.