@@ -4,28 +4,72 @@ on: [push]
4
4
5
5
jobs :
6
6
build :
7
-
8
- runs-on : windows-latest
7
+ name : ${{ matrix.name }}
8
+ runs-on : ${{ matrix.os }}
9
9
10
+ strategy :
11
+ matrix :
12
+ name : [
13
+ windows,
14
+ linux,
15
+ ]
16
+
17
+ include :
18
+ - name : windows
19
+ os : windows-latest
20
+ exe-suffix : .exe
21
+ - name : linux
22
+ os : ubuntu-18.04
23
+ exe-suffix :
24
+
10
25
steps :
11
26
- uses : actions/checkout@v1
12
27
13
- - name : pre-cache
14
- id : pre-cache
28
+ - name : init
29
+ id : init
15
30
shell : bash
16
31
run : |
17
32
git ls-remote https://github.com/stevencpp/llvm-project.git master > csd.lock
18
-
19
- msvc_base="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC"
20
- msvc_dir=$msvc_base/`dir "$msvc_base"`
21
- echo "::set-output name=vsmodules-dir::$msvc_dir/ifc/x64"
22
- echo "$msvc_dir" > vsmodules.lock
23
-
24
- .github/workflows/vs_env.bat x64
25
- echo "::add-path::C:\\Program Files\\LLVM\\bin"
33
+ echo "::set-output name=vcpkg-dir::$VCPKG_INSTALLATION_ROOT"
34
+
35
+ if [ "$RUNNER_OS" = "Windows" ]; then
36
+ msvc_base="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC"
37
+ msvc_dir=$msvc_base/`dir "$msvc_base"`
38
+ echo "::set-output name=vsmodules-dir::$msvc_dir/ifc/x64"
39
+ echo "$msvc_dir" > vsmodules.lock
40
+
41
+ .github/workflows/vs_env.bat x64
42
+ echo "::add-path::C:\\Program Files\\LLVM\\bin"
43
+ else
44
+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
45
+ sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' -y
46
+ sudo apt-get update -q
47
+ sudo apt-get install -y clang-9 lld-9 libc++-9-dev libc++abi-9-dev clang-tools-9
48
+ export CXX=clang++-9; export CC=clang-9;
49
+ export CXXFLAGS="-stdlib=libc++ -fsanitize=address,undefined"; export LDFLAGS="-stdlib=libc++ -fuse-ld=lld";
50
+ export CSD_CXXFLAGS="-stdlib=libc++"
51
+ export CXXFLAGS="-stdlib=libc++"
52
+ $CXX --version
53
+
54
+ export CMAKE_VERSION=3.15.5
55
+ export CMAKE_ID=cmake-$CMAKE_VERSION-Linux-x86_64
56
+ curl -fsSL -o cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/$CMAKE_ID.tar.gz"
57
+ tar -zxf cmake.tar.gz
58
+ export PATH=$PWD/$CMAKE_ID/bin:$PATH
59
+ whereis cmake
60
+ cmake --version
61
+
62
+ curl -fsSL -o ninja.zip https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip
63
+ sudo 7z x ninja.zip -o/usr/local/bin
64
+ ninja --version
65
+
66
+ #sudo apt-get install -y ccache
67
+
68
+ export -p > env.sh
69
+ fi
26
70
27
71
- name : clang-scan-deps cache
28
- uses : actions/cache@v1
72
+ uses : actions/cache@releases/ v1
29
73
id : cache-csd
30
74
with :
31
75
path : csd
@@ -35,14 +79,18 @@ jobs:
35
79
if : steps.cache-csd.outputs.cache-hit != 'true'
36
80
shell : bash
37
81
run : |
38
- source vsenv.sh
39
-
40
- curl -fsSL -o LLVM9.exe https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe
41
- 7z x LLVM9.exe -y -o"C:/Program Files/LLVM"
42
- export PATH="/c/Program Files/LLVM/bin:$PATH"
43
- clang-cl --version
44
- export CXX=clang-cl && export CC=clang-cl
45
- set
82
+ source env.sh
83
+ export CXXFLAGS="$CSD_CXXFLAGS"
84
+
85
+ if [ "$RUNNER_OS" = "Windows" ]; then
86
+ curl -fsSL -o LLVM9.exe https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe
87
+ 7z x LLVM9.exe -y -o"C:/Program Files/LLVM"
88
+ export PATH="/c/Program Files/LLVM/bin:$PATH"
89
+ clang-cl --version
90
+ export CXX=clang-cl && export CC=clang-cl
91
+ export CMAKE_LINKER=-DCMAKE_LINKER=lld-link
92
+ set
93
+ fi
46
94
47
95
git clone --depth 1 https://github.com/stevencpp/llvm-project.git
48
96
@@ -52,77 +100,80 @@ jobs:
52
100
53
101
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ../llvm-project/llvm \
54
102
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;libunwind;compiler-rt;lld' \
55
- -DLLVM_ENABLE_MODULES=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
56
- -DCMAKE_LINKER=lld-link
57
- ninja clang-scan-deps.exe
58
- cp bin/clang-scan-deps.exe ../csd
103
+ -DLLVM_ENABLE_MODULES=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE $CMAKE_LINKER
104
+ ninja clang-scan-deps${{ matrix.exe-suffix }}
105
+ cp bin/clang-scan-deps* ../csd
59
106
60
107
ninja `ninja -t targets all | grep cmake_object_order_depends_target | sed 's/: phony//' | tr '\n' ' '`
108
+ cd ..
61
109
mkdir scan
62
- find . \( -name '*.h' -o -name '*.inc' -o -name '*.def' -o -name '*.cpp' \) -exec cp --parents {} scan \;
63
- cp compile_commands.json scan
64
- 7z a ../csd/scan.zip scan/*
110
+ find llvm-build -regextype posix-extended \
111
+ -regex '.*\.(c|cc|cpp|cxx|def|h|hh|hpp|hxx|inc|S)$' \
112
+ -exec cp --parents {} scan \;
113
+ cp --parents llvm-build/compile_commands.json scan
114
+ find llvm-project -regextype posix-extended \
115
+ -not -regex '.*/(test|INPUTS|docs).*' -and \
116
+ -regex '.*\.(c|cc|cpp|cxx|def|h|hh|hpp|hxx|inc|S)$' \
117
+ -exec cp --parents {} scan \;
118
+ cp --parents llvm-project/lld/unittests/MachOTests/empty_obj_x86_armv7.txt scan
119
+ mv scan csd
65
120
66
121
- name : clang-scan-deps upload
67
122
if : steps.cache-csd.outputs.cache-hit != 'true'
68
123
uses : actions/upload-artifact@master
69
124
with :
70
- name : clang-scan-deps.exe
71
- path : csd/clang-scan-deps.exe
125
+ name : clang-scan-deps-${{ matrix.name }}
126
+ path : csd/clang-scan-deps${{ matrix .exe-suffix }}
72
127
73
- - name : scan.zip upload
128
+ - name : llvm-scanner-input upload
74
129
if : steps.cache-csd.outputs.cache-hit != 'true'
75
130
uses : actions/upload-artifact@master
76
131
with :
77
- name : scan.zip
78
- path : csd/scan.zip
132
+ name : llvm-scanner-input-${{ matrix.name }}
133
+ path : csd/scan
79
134
80
135
- name : vcpkg cache
81
- uses : actions/cache@v1
136
+ uses : actions/cache@releases/ v1
82
137
id : cache-vcpkg
83
138
with :
84
- path : vcpkg
139
+ path : ${{ steps.init.outputs. vcpkg-dir }}/installed
85
140
key : ${{ runner.os }}-vcpkg
86
-
87
- - name : vcpkg bootstrap
88
- if : steps.cache-vcpkg.outputs.cache-hit != 'true'
89
- shell : cmd
90
- run :
91
- git clone https://github.com/microsoft/vcpkg.git &&
92
- cd vcpkg && bootstrap-vcpkg.bat && cd ..
93
141
94
142
- name : vcpkg install
95
- shell : cmd
96
- run :
97
- cd vcpkg && git pull &&
98
- vcpkg install fmt:x86-windows lmdb:x86-windows nlohmann-json:x86-windows
99
- catch2:x86-windows range-v3:x86-windows clara:x86-windows reproc:x86-windows &&
100
- vcpkg upgrade --no-dry-run &&
101
- if exist downloads rmdir /S /Q downloads &&
102
- if exist buildtrees rmdir /S /Q buildtrees &&
103
- if exist packages rmdir /S /Q packages &&
104
- cd ..
143
+ shell : bash
144
+ run : |
145
+ source env.sh
146
+ cd $VCPKG_INSTALLATION_ROOT
147
+ git reset --hard origin/master
148
+ git pull
149
+ if [ "$RUNNER_OS" = "Windows"]; then export VCPKG_TRIPLET=--triplet x86-windows; fi
150
+ vcpkg install $VCPKG_TRIPLET fmt lmdb nlohmann-json catch2 range-v3 clara reproc
151
+ vcpkg upgrade --no-dry-run
105
152
106
153
- name : visual studio modules cache
107
- uses : actions/cache@v1
154
+ if : runner.os == 'Windows'
155
+ uses : actions/cache@releases/v1
108
156
id : cache-vsmodules
109
157
with :
110
- path : ${{ steps.pre-cache .outputs.vsmodules-dir }}
158
+ path : ${{ steps.init .outputs.vsmodules-dir }}
111
159
key : ${{ runner.os }}-vsmodules-${{ hashFiles('**\vsmodules.lock') }}
112
160
113
161
- name : install visual studio modules
114
- if : steps.cache-vsmodules.outputs.cache-hit != 'true'
115
- shell : cmd
116
- run :
162
+ if : runner.os == 'Windows' && steps.cache-vsmodules.outputs.cache-hit != 'true'
163
+ shell : bash
164
+ run : |
117
165
taskkill /IM "MSBuild.exe" /F
118
166
119
- " C:/Program Files (x86)/Microsoft Visual Studio/Installer/vs_installer.exe" modify --quiet --norestart
120
- --installPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise"
121
- --add Microsoft.VisualStudio.Component.VC.Modules.x86.x64
167
+ "C:/Program Files (x86)/Microsoft Visual Studio/Installer/vs_installer.exe" modify --quiet --norestart \
168
+ --installPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise" \
169
+ --add Microsoft.VisualStudio.Component.VC.Modules.x86.x64
122
170
123
- if not exist "${{ steps.pre-cache.outputs.vsmodules-dir }}" echo failed && exit 1
171
+ if [ ! -d "${{ steps.init.outputs.vsmodules-dir }}" ]; then
172
+ echo failed; exit 1;
173
+ fi
124
174
125
175
- name : install llvm
176
+ if : runner.os == 'Windows'
126
177
shell : bash
127
178
run : |
128
179
curl -fsSL -o LLVM.exe "https://prereleases.llvm.org/win-snapshots/LLVM-10.0.0-r375090-win64.exe"
@@ -132,34 +183,54 @@ jobs:
132
183
- name : build
133
184
shell : bash
134
185
run : |
186
+ source env.sh
135
187
mkdir build
136
188
cd build
137
- cmake -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" \
138
- -G "Visual Studio 16 2019" -A "Win32" \
139
- -DCMAKE_INSTALL_PREFIX="C:/Program Files/cpp_modules" \
140
- ..
141
- cmake --build . --config "Debug" --parallel
142
- cmake --install . --config "Debug"
189
+ export VCPKG_ARG=-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
190
+ if [ "$RUNNER_OS" = "Windows" ]; then
191
+ cmake $VCPKG_ARG -G "Visual Studio 16 2019" -A "Win32" \
192
+ -DCMAKE_INSTALL_PREFIX="C:/Program Files/cpp_modules" ..
193
+ cmake --build . --config "Debug" --parallel
194
+ cmake --install . --config "Debug"
195
+ else
196
+ cmake $VCPKG_ARG -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
197
+ # -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
198
+ cmake --build . --parallel
199
+ fi
143
200
144
201
- name : test
145
202
shell : bash
146
203
run : |
147
- source vsenv.sh
204
+ source env.sh
205
+
206
+ TEST_DRIVER=cppm_test
207
+ TESTS=[lmdb],[scanner],[gen_ninja]
208
+ if [ "$RUNNER_OS" = "Windows" ]; then
209
+ TEST_DRIVER=Debug/cppm_test.exe
210
+ TESTS=$TESTS,[msbuild]
211
+ TEST_ARGS="--msbuild-test-path=tests \
212
+ --scanner_tool_path=build/src/scanner/Debug/cppm_scanner_tool.exe \
213
+ --ninja_fork_path=build/_deps/ninja-build/Debug/ninja.exe"
214
+ else
215
+ TEST_ARGS="--clang_cxx_path=`which clang++-9` \
216
+ --ninja_fork_path=build/_deps/ninja-build/ninja"
217
+ fi
218
+
219
+ build/src/test/$TEST_DRIVER $TESTS $TEST_ARGS \
220
+ --clang_scan_deps_path="$GITHUB_WORKSPACE/csd/clang-scan-deps${{ matrix.exe-suffix }}"
221
+
222
+ if [ "$RUNNER_OS" = "Windows" ]; then exit 0; fi
148
223
149
224
if [ ! -d llvm-build ]; then
150
- git clone --depth 1 https://github.com/stevencpp/llvm-project.git;
151
- 7z x csd/scan.zip
152
- mkdir llvm-build
153
- mv scan/* llvm-build
154
- curl -fsSL -o headers.zip "https://drive.google.com/uc?export=download&id=1tbrnwu4gvz9IWsyxwZ_yKExRD9AMmqMb"
155
- 7z x headers.zip -y -ollvm-build
225
+ mv csd/scan/* .
226
+ mkdir -p llvm-build/bin
227
+ mv csd/clang-scan-deps* llvm-build/bin
156
228
fi
157
-
158
229
cd llvm-build
159
- ../build/src/test/Debug/cppm_test.exe [scanner_comp_db] --scanner_comp_db="compile_commands.json" \
230
+ mkdir -p tools/clang/tools/extra/clangd/fuzzer #workaround for an include bug
231
+ mkdir -p tools/clang/tools/extra/clangd/tool #same
232
+ ../build/src/test/$TEST_DRIVER [scanner_comp_db] \
233
+ --scanner_comp_db="compile_commands.json" \
160
234
--scanner_db_path="." --scanner_item_root_path="." \
161
- --scanner_file_to_touch="../llvm-project/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp"
162
- cd ..
163
-
164
- cd build/src/test
165
- ./Debug/cppm_test.exe [lmdb],[scanner],[msbuild],[gen_ninja]
235
+ --scanner_file_to_touch="../llvm-project/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp" \
236
+ --clang_scan_deps_path="$GITHUB_WORKSPACE/llvm-build/bin/clang-scan-deps${{ matrix.exe-suffix }}"
0 commit comments