-
Notifications
You must be signed in to change notification settings - Fork 540
114 lines (100 loc) · 3.3 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
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 }}-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.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
if: ${{ matrix.compiler == 'msvc' }}
run: |
7z a rime-${{ env.git_ref_name }}-${{ runner.os }}.7z `
dist version-info.txt
7z a -x'!*/.placeholder' rime-deps-${{ env.git_ref_name }}-${{ runner.os }}.7z `
bin include lib share
- name: Upload artifacts
if: ${{ matrix.compiler == 'msvc' }}
uses: actions/upload-artifact@v3
with:
path: |
rime-${{ env.git_ref_name }}-${{ runner.os }}.7z
rime-deps-${{ env.git_ref_name }}-${{ runner.os }}.7z