-
Notifications
You must be signed in to change notification settings - Fork 6
113 lines (94 loc) · 4.18 KB
/
windows-rel-build.yml
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
name: CMake
on:
push:
tags:
- "*"
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# 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: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha
- name: Export Actions runtime info for Actions caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
#cache: true # It never successfully found cache from previous runs, disabling it
- name: Initialize MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Configure Qt5 path
shell: bash
run: |
echo "QT_DIR=$Qt5_Dir" | sed 's/\\/\//g' >> $GITHUB_ENV
echo "GH_WORKSPACE=${{github.workspace}}" | sed 's/\\/\//g' >> $GITHUB_ENV
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: b346ee32f13f3bf2ef19ac02f982f6938f7a84ea # Grabbed on 2024-04-20 20:49 +0800
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Build Vcpkg packages
shell: cmd
working-directory: ${{github.workspace}}/vcpkg
run: |
vcpkg.exe install --x-manifest-root=../scripts/vcpkg-manifest --x-install-root=./installed --binarysource="clear;x-gha,readwrite" --triplet=x64-windows
env:
QT_DIR: ${{env.QT_DIR}}
Qt5_DIR: ${{env.QT_DIR}}
VCPKG_KEEP_ENV_VARS: 'QT_DIR;Qt5_DIR'
- name: Install OnnxRuntime
shell: cmd
working-directory: ${{github.workspace}}/src/libs
run: |
cmake -Dep=cpu -P ../../scripts/setup-onnxruntime.cmake
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
shell: bash
working-directory: ${{github.workspace}}
run: cmake -B ${{env.GH_WORKSPACE}}/build -G Ninja -DBUILD_TESTS:BOOL=FALSE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.GH_WORKSPACE}}/deploy -DCMAKE_PREFIX_PATH=${{env.QT_DIR}}/lib/cmake/Qt5/ -DCMAKE_TOOLCHAIN_FILE=${{env.GH_WORKSPACE}}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --target all
- name: Deploy
run: cmake --build ${{github.workspace}}/build --target install
- name: Set Commit ID
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cd $GITHUB_WORKSPACE
export VERSION=`git log --format="%H" -n 1 | head -c 7`
echo "VERSION="$VERSION >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dataset-tools-msvc2022-x64-${{env.VERSION}}
path: ${{github.workspace}}/deploy
- name: Compress release archive
shell: bash
working-directory: ${{env.GH_WORKSPACE}}/deploy/
run: |
export VERSION=`git log --format="%H" -n 1 | head -c 7`
7z a dataset-tools-msvc2022-x64-${VERSION}.zip ./*
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{env.GH_WORKSPACE}}/deploy/dataset-tools-msvc2022-x64-${{env.VERSION}}.zip