-
Notifications
You must be signed in to change notification settings - Fork 11
143 lines (122 loc) · 4.21 KB
/
ci.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
name: ci
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true # needs fcitx5/.clang-format
- name: Install dependencies
run: brew install clang-format swift-format
- name: Lint
run: ./scripts/lint.sh
build:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15, macos-13]
type: [Release, Debug]
include:
- { os: macos-15, arch: arm64, type: Release, postfix: '' }
- { os: macos-15, arch: arm64, type: Debug, postfix: -debug }
- { os: macos-13, arch: x86_64, type: Release, postfix: '' }
- { os: macos-13, arch: x86_64, type: Debug, postfix: -debug }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update && brew upgrade || true
brew install \
nlohmann-json \
extra-cmake-modules \
librsvg \
md5sha1sum \
ninja
./scripts/install-deps.sh ${{ matrix.arch }}
npm i -g pnpm
pnpm --prefix=fcitx5-webview i
- name: Bypass download.fcitx-im.org
run: wget -P fcitx5/src/modules/spell https://github.com/fcitx-contrib/fcitx5/releases/download/20241204/en_dict-20121020.tar.gz
- name: Build
run: |
cmake -B build -G Ninja \
-DCMAKE_Swift_COMPILER=`which swiftc` \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
-DCMAKE_BUILD_TYPE=${{ matrix.type }}
cmake --build build
sudo cmake --install build
- name: Package and remove dev files
run: |
if [[ ${{ matrix.type }} == "Release" ]]; then
tar cjf Fcitx5-${{ matrix.arch }}-dev.tar.bz2 -C "/Library/Input Methods" Fcitx5.app/Contents/{include,lib}
fi
sudo rm -rf "/Library/Input Methods/Fcitx5.app/Contents"/{bin/fcitx5-{configtool,diagnose},include,lib/{cmake,pkgconfig},share/{applications,metainfo}}
tar cjf Fcitx5-${{ matrix.arch }}${{ matrix.postfix }}.tar.bz2 -C "/Library/Input Methods" Fcitx5.app
./scripts/code-sign.sh # after tar to avoid local signature in tarball
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Fcitx5-${{ matrix.arch }}${{ matrix.postfix }}
path: |
Fcitx5-${{ matrix.arch }}*.tar.bz2
- name: Check validity
run: |
./scripts/check-validity.sh
md5sum -c checksum
- name: Generate meta.json
if: ${{ matrix.os == 'macos-15' && matrix.type == 'Release' }}
run: |
echo "{\"object\": {\"sha\": \"$(git rev-parse HEAD)\"}}" > meta.json
- name: Upload meta.json
if: ${{ matrix.os == 'macos-15' && matrix.type == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: meta.json
path: |
meta.json
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
compare:
if: ${{ github.ref != 'refs/heads/master' }}
needs: build
uses: ./.github/workflows/compare.yml
release:
needs: build
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '!release') }}
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Nightly release
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: "Nightly Build"
files: |
Fcitx5-*.tar.bz2
meta.json