-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (149 loc) · 5.69 KB
/
ccls.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
name: ccls
permissions:
contents: write
on:
# schedule:
# - cron: '0 18 * * *'
# push:
# branches: [ master, test ]
workflow_dispatch:
env:
llvm_ver: 17.0.6
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: linux, platform: linux-x64, container: 'ubuntu:22.04' }
- { os: windows-latest, target: windows, platform: win32-x64 }
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.container }}
steps:
- name: Prepare container
if: ${{ matrix.target == 'linux' }}
run: |
mkdir /tmp/tools
apt-get update
apt-get install -y build-essential git ninja-build wget curl
apt-get install -y zlib1g-dev libncurses-dev libzstd-dev libxml2-dev
wget -qOcmake.tgz https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.tar.gz
tar xzf cmake.tgz
cp -rf cmake-*/* /usr/local/ || true
cmake --version
ninja --version
- name: Prepare linux code
if: ${{ matrix.target == 'linux' }}
run: |
#wget -qOllvm.txz "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvm_ver}/clang+llvm-${llvm_ver}-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
wget -qOllvm.txz "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvm_ver}/clang+llvm-${llvm_ver}-x86_64-linux-gnu-ubuntu-22.04.tar.xz"
tar xJf llvm.txz
pwd && ls -la
mv clang* llvm
git clone --recursive https://github.com/MaskRay/ccls
- name: Build linux
if: ${{ matrix.target == 'linux' }}
id: build
run: |
cd ccls
# static build with llvm 12.0.1
# /usr/bin/ld: cannot find -lgcc_s
#sed 's/project(ccls LANGUAGES CXX C)/project(ccls LANGUAGES CXX)/' -i CMakeLists.txt
#cmake -S. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../llvm -DCMAKE_CXX_FLAGS="-static -pthread -lrt -ldl -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -Os -s -flto"
# build with llvm
cmake -S. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../llvm -DCMAKE_CXX_FLAGS="-Os -s -flto"
ninja -C Release
mv Release/ccls .
chmod a+x ./ccls
./ccls --version
ver=$(./ccls --version | grep -Po "(?<=ccls version ).*")
ldd ./ccls || true
XZ_OPT=-9 tar cJvf /tmp/tools/ccls_linux_amd64.txz ccls
echo "version=$ver" >> $GITHUB_OUTPUT
echo "ccls version: $ver"
-
if: ${{ matrix.target == 'windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Prepare windows code
if: ${{ matrix.target == 'windows' }}
shell: cmd
run: |
cd /d c:\
curl -L -ollvm.7z https://github.com/fcying/tools/releases/download/llvm-v${{ env.llvm_ver }}/llvm_msvc.7z
#curl -L -ollvm.7z https://github.com/fcying/tools/releases/download/llvm-latest/llvm_msvc.7z
7z x llvm.7z
git clone --depth=1 --recursive https://github.com/MaskRay/ccls
dir
- name: Build windows
if: ${{ matrix.target == 'windows' }}
shell: cmd
run: |
cd /d c:\ccls
cmake -H. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_PREFIX_PATH="c:/llvm/Release"
ninja -C Release
.\Release\ccls.exe --version
mkdir ccls
copy Release\ccls.exe .\ccls\
copy c:\Windows\System32\vcruntime140_1.dll .\ccls\
copy c:\Windows\System32\vcruntime140.dll .\ccls\
copy c:\Windows\System32\msvcp140.dll .\ccls\
7z -mx9 a c:\ccls_windows_amd64.zip ccls
- name: Setting up workflow variables
id: vars
shell: bash
run: |
# Package suffix relative to the platform
if [[ "${{ matrix.target }}" = windows ]]; then
PKG_PATH="c:\ccls_windows_amd64.zip"
else
PKG_PATH="/tmp/tools/ccls_linux_amd64.txz"
fi
echo "PKG_PATH: $PKG_PATH"
echo "PKG_PATH=$PKG_PATH" >> $GITHUB_OUTPUT
- uses: cloudposse/github-action-matrix-outputs-write@main
id: out
with:
matrix-step-name: ${{ github.job }}
matrix-key: ${{ matrix.platform }}
outputs: |-
version: ${{ steps.build.outputs.version }}
- uses: actions/upload-artifact@v4
with:
name: tools-ccls-${{ matrix.target }}
path: ${{ steps.vars.outputs.PKG_PATH }}
retention-days: 1
publish:
needs: [build]
runs-on: ubuntu-latest
outputs:
version: "${{ fromJson(steps.read.outputs.result).version.linux-x64 }}"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: tools
pattern: tools-*
merge-multiple: true
- run: ls -la tools
- uses: cloudposse/github-action-matrix-outputs-read@main
id: read
with:
matrix-step-name: build
- name: Publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITEE_KEY: ${{ secrets.GITEE_KEY }}
run: |
#upload to draft, publish after clangd build end
echo "ccls version: ${{ fromJson(steps.read.outputs.result).version.linux-x64 }}"
tag_name=release_temp
for _ in {1..60}; do
if [ $(gh release list | grep $tag_name -c) -ne 0 ]; then
gh release upload $tag_name --clobber ./tools/*
break
fi
sleep 10
done