-
Notifications
You must be signed in to change notification settings - Fork 540
171 lines (149 loc) · 5.13 KB
/
windows-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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Windows build
on:
workflow_call:
inputs:
repository:
default: ${{ github.repository }}
required: false
type: string
rime_plugins:
required: false
type: string
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
compiler: [msvc, clang]
env:
boost_version: 1.83.0
BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_83_0
build_script: ${{ matrix.compiler == 'msvc' && './build.bat' || './build-clang.bat' }}
RIME_PLUGINS: ${{ inputs.rime_plugins }}
steps:
- name: Checkout last commit
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
submodules: recursive
- name: Configure MSVC
if: ${{ matrix.compiler == 'msvc' }}
run: |
copy env.vs2022.bat env.bat
- name: Configure clang
if: ${{ matrix.compiler == 'clang' }}
run: |
choco upgrade -y llvm
pip install ninja
- name: Configure build environment
run: |
$git_ref_name = git describe --always
echo "git_ref_name=$git_ref_name" >> $env:GITHUB_ENV
git submodule > submodule-status
- name: Cache Boost source
id: cache-boost-src
uses: actions/cache@v3
with:
path: |
${{ env.BOOST_ROOT }}.7z
key: ${{ runner.os }}-boost-${{ env.boost_version }}-${{ matrix.compiler }}-src
- name: Download Boost source
if: steps.cache-boost-src.outputs.cache-hit != 'true'
run: |
aria2c https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.7z -d deps
- name: Extract Boost source tarball
run: |
pushd deps
7z x ${{ env.BOOST_ROOT }}.7z
popd
- name: Cache Boost lib
id: cache-boost-lib
uses: actions/cache@v3
with:
path: |
${{ env.BOOST_ROOT }}\stage
key: ${{ runner.os }}-boost-${{ env.boost_version }}-${{ matrix.compiler }}-lib
- name: Install Boost
if: steps.cache-boost-lib.outputs.cache-hit != 'true'
run: ${{ env.build_script }} boost
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: |
bin
include
lib
share
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('submodule-status') }}
- name: Build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ${{ env.build_script }} deps
- name: Install Rime plugins
run: .\action-install-plugins-windows.bat
- name: Build and test
run: ${{ env.build_script }} test
- name: Create distributable
run: |
7z a rime-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z `
dist version-info.txt
7z a -x'!*/.placeholder' rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z `
bin include lib share
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: |
rime-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z
rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z
build-mingw:
runs-on: windows-latest
env:
RIME_PLUGINS: ${{ inputs.rime_plugins }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
- name: Checkout last commit
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
- name: Install dependencies
run: |
pacman -S --noconfirm git base-devel mingw-w64-x86_64-toolchain ninja \
mingw64/mingw-w64-x86_64-cmake \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-glog \
mingw-w64-x86_64-gtest \
mingw-w64-x86_64-yaml-cpp \
mingw-w64-x86_64-leveldb \
mingw-w64-x86_64-marisa \
mingw-w64-x86_64-opencc
- name: Install Rime plugins
run: ./action-install-plugins-macos.sh
- name: Build with mingw-w64
run: |
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX:PATH=`pwd`/dist \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DENABLE_LOGGING:BOOL=ON \
-DBUILD_TEST:BOOL=ON \
-DBUILD_STATIC:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON
cmake --build build
cmake --install build
cd build/test && cp ../lib/librime.dll . && ./rime_test
- name: Create distributable
run: |
tar -cjvf rime-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2 \
dist version-info.txt
tar -cjvf rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2 \
--exclude '*/.placeholder' \
bin include lib share
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: |
rime-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2