forked from rime/weasel
-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (169 loc) · 6.29 KB
/
ci.yml
File metadata and controls
191 lines (169 loc) · 6.29 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
on:
push:
branches:
- '*'
tags:
- '[0-9]+.*'
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout last commit
uses: actions/checkout@v4
- name: Install clang-format 18
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo gpg --dearmor < llvm-snapshot.gpg.key > /usr/share/keyrings/llvm-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain-jammy-18.list
sudo apt-get update
sudo apt-get install -y clang-format-18
sudo ln -sf /usr/bin/clang-format-18 /usr/local/bin/clang-format
clang-format --version
- name: Code style lint
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
shell: bash
run: ./clang-format.sh -i
build:
needs: lint
runs-on: windows-2022
env:
boost_version: 1.84.0
BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_84_0
SDKVER: 10.0.19041.0
strategy:
matrix:
variant: [msbuild, xmake]
steps:
- name: Checkout last commit
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Fetch all tags
run: git fetch --tags
- name: Configure build environment
shell: bash
run: |
cp env.vs2022.bat env.bat
echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV
- name: Cache Boost
id: cache-boost
uses: actions/cache@v4
with:
path: |
${{ env.BOOST_ROOT }}
key: ${{ runner.os }}-boost-${{ env.boost_version }}
- name: Install Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
shell: bash
run: |
./install_boost.bat
./build.bat boost arm64
- uses: ilammy/msvc-dev-cmd@v1
with:
sdk: ${{ env.SDKVER }}
# bundled winsparkle v0.9.2 to disable auto open ReleaseNoteUrl in default browser
- name: cache bundled winsparkle
id: cache-winsparkle
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}\winsparkle\x64\Release\WinSparkle.dll
${{ github.workspace }}\winsparkle\x64\Release\WinSparkle.lib
${{ github.workspace }}\winsparkle\Release\WinSparkle.dll
${{ github.workspace }}\winsparkle\Release\WinSparkle.lib
key: ${{ runner.os }}-winsparkle-v0.9.2-bundled
restore-keys: |
winsparkle-v0.9.2-bundled
- name: Build bundled winsparkle
if: steps.cache-winsparkle.outputs.cache-hit != 'true'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if (Test-Path winsparkle) { Remove-Item -Recurse -Force winsparkle }
# Clone winsparkle repo v0.9.2
git clone https://github.com/vslavik/winsparkle.git -b v0.9.2 --depth 1
cd winsparkle
git submodule update --init --recursive
copy ..\bundled_winsparkle.patch .
git apply bundled_winsparkle.patch
nuget restore
msbuild -m -t:Build -p:Configuration=Release -p:Platform=x64 WinSparkle.sln
msbuild -m -t:Build -p:Configuration=Release -p:Platform=Win32 WinSparkle.sln
- name: Install WinSparkle files
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
copy .\winsparkle\x64\Release\WinSparkle.dll .\output\
copy .\winsparkle\x64\Release\WinSparkle.lib .\lib64\
copy .\winsparkle\Release\WinSparkle.dll .\output\Win32\
copy .\winsparkle\Release\WinSparkle.lib .\lib\
- name: Get Rime files
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
.\get-rime.ps1 -use dev
- name: Build data
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
.\build.bat data
- name: Setup xmake
if: matrix.variant == 'xmake'
uses: xmake-io/github-action-setup-xmake@v1
- name: Build Weasel
shell: pwsh
id: build_weasel
env:
RELEASE_BUILD: ${{ (github.repository == 'rime/weasel' && startsWith(github.ref, 'refs/tags/')) && '1' || '' }}
run: |
$ErrorActionPreference = 'Stop'
if ('${{ matrix.variant }}' -eq 'msbuild') {
.\build.bat arm64 installer
} else {
.\xbuild.bat arm64 installer
}
- name: Compress Debug Symbols
if: matrix.variant == 'msbuild'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
output\7z.exe a -t7z "./output/archives/debug_symbols.7z" "output/*.pdb" -r
- name: Upload artifacts
if: matrix.variant == 'msbuild'
uses: actions/upload-artifact@v4
with:
name: weasel-artifact-${{ env.git_ref_name }}
if-no-files-found: error
path: |
.\output\archives\weasel*.exe
.\output\archives\debug_symbols.7z
# Release-only steps (run on tags or master)
- name: Extract changelog
if: ${{ github.repository == 'rime/weasel' && startsWith(github.ref, 'refs/tags/') && matrix.variant == 'msbuild' }}
shell: pwsh
run: .\extract_changelog.ps1
- name: Create Nightly release
if: ${{ github.repository == 'rime/weasel' && github.ref == 'refs/heads/master' && matrix.variant == 'msbuild' }}
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: "Nightly Build"
files: |
./output/archives/weasel*.exe
./output/archives/debug_symbols.7z
- name: Release (stable)
if: ${{ github.repository == 'rime/weasel' && startsWith(github.ref, 'refs/tags/') && matrix.variant == 'msbuild' }}
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
./output/archives/weasel*.exe
./output/archives/debug_symbols.7z
body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md