Skip to content

Commit 15350b7

Browse files
committed
Github actions parsing test.
1 parent 149aef0 commit 15350b7

1 file changed

Lines changed: 225 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 225 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,21 @@ jobs:
3737
steps:
3838
- uses: actions/checkout@v2
3939

40-
- name: Update apt-get
41-
run: sudo apt-get update
42-
43-
- name: Install required packages Ubuntu 20
44-
if: ${{ matrix.os == 'ubuntu-20.04' }}
45-
run: sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10 libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev ctags libgtest-dev npm
40+
#- name: Update apt-get
41+
# run: sudo apt-get update
4642

43+
# Ubuntu 18.04 commands
4744
- name: Install required packages Ubuntu 18
4845
if: ${{ matrix.os == 'ubuntu-18.04' }}
49-
run: sudo apt-get install -y git cmake make g++ gcc-7-plugin-dev libboost-all-dev llvm-10-dev clang-10 libclang-10-dev default-jdk libssl1.0-dev libgraphviz-dev libmagic-dev libgit2-dev ctags libgtest-dev npm
50-
51-
- name: Install Postgresql Ubuntu 20
52-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
53-
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
46+
run: >
47+
sudo apt-get install -y git cmake make g++ gcc-7-plugin-dev libboost-all-dev
48+
llvm-10-dev clang-10 libclang-10-dev default-jdk libssl1.0-dev libgraphviz-dev
49+
libmagic-dev libgit2-dev ctags libgtest-dev npm
5450
5551
- name: Install Postgresql Ubuntu 18
5652
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
5753
run: sudo apt-get install postgresql-server-dev-10
5854

59-
- name: Install SQLite3 Ubuntu 20
60-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'sqlite3' }}
61-
run: sudo apt-get install libodb-sqlite-dev libsqlite3-dev
62-
6355
- name: Install SQLite3 Ubuntu 18
6456
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'sqlite3' }}
6557
run: sudo apt-get install libsqlite3-dev
@@ -74,12 +66,23 @@ jobs:
7466

7567
- name: Install Thrift
7668
if: ${{ matrix.os == 'ubuntu-18.04' && steps.thrift-cache.outputs.cache-hit != 'true' }}
77-
run: |
69+
run: >
7870
cd $HOME
79-
wget -O thrift-0.13.0.tar.gz "http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.13.0/thrift-0.13.0.tar.gz"
71+
72+
wget -O thrift-0.13.0.tar.gz
73+
"http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.13.0/thrift-0.13.0.tar.gz"
74+
8075
tar -xvf ./thrift-0.13.0.tar.gz
76+
8177
cd thrift-0.13.0
82-
./configure --prefix=$HOME/thrift_install --without-python --enable-libtool-lock --enable-tutorial=no --enable-tests=no --with-libevent --with-zlib --without-nodejs --without-lua --without-ruby --without-csharp --without-erlang --without-perl --without-php --without-php_extension --without-dart --without-haskell --without-go --without-rs --without-haxe --without-dotnetcore --without-d --without-qt4 --without-qt5 --without-java --without-swift
78+
79+
./configure --prefix=$HOME/thrift_install --without-python --enable-libtool-lock
80+
--enable-tutorial=no --enable-tests=no --with-libevent --with-zlib --without-nodejs
81+
--without-lua --without-ruby --without-csharp --without-erlang --without-perl
82+
--without-php --without-php_extension --without-dart --without-haskell --without-go
83+
--without-rs --without-haxe --without-dotnetcore --without-d --without-qt4 --without-qt5
84+
--without-java --without-swift
85+
8386
make install -j $(nproc)
8487
8588
- name: Cache ODB Ubuntu 18
@@ -118,6 +121,23 @@ jobs:
118121
echo "CMAKE_PREFIX_PATH=$HOME/thrift_install:$HOME/odb_install:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
119122
echo "PATH=$HOME/thrift_install/bin:$HOME/odb_install/bin:$PATH" >> $GITHUB_ENV
120123
124+
# Ubuntu 20.04 commands
125+
- name: Install required packages Ubuntu 20
126+
if: ${{ matrix.os == 'ubuntu-20.04' }}
127+
run: >
128+
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10
129+
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev
130+
libgraphviz-dev libmagic-dev libgit2-dev ctags libgtest-dev npm
131+
132+
- name: Install Postgresql Ubuntu 20
133+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
134+
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
135+
136+
- name: Install SQLite3 Ubuntu 20
137+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'sqlite3' }}
138+
run: sudo apt-get install libodb-sqlite-dev libsqlite3-dev
139+
140+
# Common commands
121141
- name: Install GoogleTest
122142
run: |
123143
echo $PATH
@@ -140,12 +160,25 @@ jobs:
140160
- name: Run CMake (Postgresql)
141161
if: ${{ matrix.db == 'postgresql' }}
142162
working-directory: ${{github.workspace}}/build
143-
run: cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DDATABASE=pgsql -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_DIR=/usr/lib/llvm-10/cmake -DClang_DIR=/usr/lib/cmake/clang-10 -DTEST_DB="pgsql:host=localhost;username=postgres;password=postgres;port=5432;database=cc_test"
163+
run: >
164+
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
165+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/${{ matrix.os }}/${{ matrix.db }}/install
166+
-DDATABASE=pgsql
167+
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
168+
-DLLVM_DIR=/usr/lib/llvm-10/cmake
169+
-DClang_DIR=/usr/lib/cmake/clang-10
170+
-DTEST_DB="pgsql:host=localhost;username=postgres;password=postgres;port=5432;database=cc_test"
144171
145172
- name: Run CMake (SQLite3)
146173
if: ${{ matrix.db == 'sqlite3' }}
147174
working-directory: ${{github.workspace}}/build
148-
run: cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DDATABASE=sqlite -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_DIR=/usr/lib/llvm-10/cmake -DClang_DIR=/usr/lib/cmake/clang-10 -DTEST_DB="sqlite:database=$HOME/mydatabase.sqlite"
175+
run: >
176+
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
177+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/${{ matrix.os }}/${{ matrix.db }}/install
178+
-DDATABASE=sqlite -DCMAKE_BUILD_TYPE=$BUILD_TYPE
179+
-DLLVM_DIR=/usr/lib/llvm-10/cmake
180+
-DClang_DIR=/usr/lib/cmake/clang-10
181+
-DTEST_DB="sqlite:database=$HOME/mydatabase.sqlite"
149182
150183
- name: Build
151184
working-directory: ${{github.workspace}}/build
@@ -158,3 +191,175 @@ jobs:
158191
- name: Run tests
159192
working-directory: ${{github.workspace}}/build
160193
run: make test ARGS=-V
194+
195+
- name: Parse CodeCompass Postgresql
196+
if: ${{ matrix.db == 'postgresql' }}
197+
run: >
198+
mkdir $HOME/ws_pgsql
199+
200+
${{github.workspace}}/${{ matrix.os }}/${{ matrix.db }}/install/bin/CodeCompass_parser
201+
-d "pgsql:host=localhost;port=5432;user=postgres;password=postgres;database=codecompass"
202+
-w $HOME/ws_pgsql/
203+
-n "CodeCompass"
204+
-i ${{github.workspace}}
205+
-i ${{github.workspace}}/build/compile_commands.json
206+
-j $(nproc)
207+
208+
- name: Parse CodeCompass SQLite3
209+
if: ${{ matrix.db == 'sqlite3' }}
210+
run: >
211+
mkdir $HOME/ws_pgsql
212+
213+
${{github.workspace}}/${{ matrix.os }}/${{ matrix.db }}/install/bin/CodeCompass_parser
214+
-d "sqlite:database=$HOME/codecompass.sqlite"
215+
-w $HOME/ws_pgsql/
216+
-n "CodeCompass"
217+
-i ${{github.workspace}}
218+
-i ${{github.workspace}}/build/compile_commands.json
219+
-j $(nproc)
220+
221+
- name: Archive CodeCompass binaries
222+
uses: actions/upload-artifact@v2
223+
with:
224+
name: codecompass-${{ matrix.os }}-${{ matrix.db }}-bin
225+
path: ${{github.workspace}}/${{ matrix.os }}/${{ matrix.db }}/install
226+
227+
parse:
228+
needs: build
229+
strategy:
230+
matrix:
231+
db: [ postgresql, sqlite3 ]
232+
os: [ ubuntu-20.04, ubuntu-18.04 ]
233+
fail-fast: false
234+
235+
runs-on: ${{ matrix.os }}
236+
237+
# Service containers to run with `runner-job`
238+
services:
239+
# Label used to access the service container
240+
postgres:
241+
# Docker Hub image
242+
image: postgres
243+
# Provide the password for postgres
244+
env:
245+
POSTGRES_USER: postgres
246+
POSTGRES_PASSWORD: postgres
247+
# Set health checks to wait until postgres has started
248+
options: >-
249+
--health-cmd pg_isready
250+
--health-interval 10s
251+
--health-timeout 5s
252+
--health-retries 5
253+
ports:
254+
# Maps tcp port 5432 on service container to the host
255+
- 5432:5432
256+
257+
steps:
258+
# Ubuntu 18.04 commands
259+
- name: Install required packages Ubuntu 18
260+
if: ${{ matrix.os == 'ubuntu-18.04' }}
261+
run: >
262+
sudo apt-get install -y git cmake make g++ gcc-7-plugin-dev libboost-all-dev
263+
llvm-10-dev clang-10 libclang-10-dev default-jdk libssl1.0-dev libgraphviz-dev
264+
libmagic-dev libgit2-dev ctags libgtest-dev npm
265+
266+
- name: Install Postgresql Ubuntu 18
267+
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
268+
run: sudo apt-get install postgresql-server-dev-10
269+
270+
- name: Install SQLite3 Ubuntu 18
271+
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'sqlite3' }}
272+
run: sudo apt-get install libsqlite3-dev
273+
274+
- name: Cache ODB Ubuntu 18
275+
id: odb-cache
276+
if: ${{ matrix.os == 'ubuntu-18.04' }}
277+
uses: actions/cache@v2
278+
with:
279+
path: ~/odb_install
280+
key: ${{ matrix.db }}-odb-v2
281+
282+
- name: Cache Thrift Ubuntu 18
283+
id: thrift-cache
284+
if: ${{ matrix.os == 'ubuntu-18.04' }}
285+
uses: actions/cache@v2
286+
with:
287+
path: ~/thrift_install
288+
key: ${{ matrix.db }}-thrift-v2
289+
290+
- name: Export environment variables Ubuntu 18
291+
if: ${{ matrix.os == 'ubuntu-18.04' }}
292+
run: |
293+
echo "LD_LIBRARY_PATH=$HOME/thrift_install/lib:$HOME/odb_install/lib:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
294+
echo "PATH=$HOME/thrift_install/bin:$HOME/odb_install/bin:$PATH" >> $GITHUB_ENV
295+
296+
# Ubuntu 20.04 commands
297+
- name: Install required packages Ubuntu 20
298+
if: ${{ matrix.os == 'ubuntu-20.04' }}
299+
run: >
300+
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev
301+
clang-10 libclang-10-dev odb libodb-dev libthrift-dev default-jdk
302+
libssl-dev libmagic-dev libgit2-dev ctags
303+
304+
- name: Install Postgresql Ubuntu 20
305+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
306+
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
307+
308+
- name: Install SQLite3 Ubuntu 20
309+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'sqlite3' }}
310+
run: sudo apt-get install libodb-sqlite-dev libsqlite3-dev
311+
312+
# Common commands
313+
- name: Download CodeCompass binaries
314+
uses: actions/download-artifact@v2
315+
with:
316+
name: codecompass-${{ matrix.os }}-${{ matrix.db }}-bin
317+
318+
- name: Add execute right to parser
319+
run: chmod +x ${{github.workspace}}/bin/CodeCompass_parser
320+
321+
# Parsing with Postgresql
322+
- name: Parse TinyXML Postgresql
323+
if: ${{ matrix.db == 'postgresql' }}
324+
run: |
325+
cd $HOME
326+
git clone https://github.com/leethomason/tinyxml2
327+
mkdir build_tinyxml2 && cd build_tinyxml2
328+
cmake $HOME/tinyxml2 -DCMAKE_EXPORT_COMPILE_COMMANDS=1
329+
make -j $(nproc)
330+
cd ${{github.workspace}}/bin
331+
./CodeCompass_parser -d "pgsql:host=localhost;port=5432;user=postgres;password=postgres;database=tinyxml2" -w $HOME/ws_pgsql/ -n TinyXML2 -i $HOME/tinyxml2 -i $HOME/build_tinyxml2/compile_commands.json -j $(nproc)
332+
333+
- name: Parse Xerces-C Postgresql
334+
if: ${{ matrix.db == 'postgresql' }}
335+
run: |
336+
cd $HOME
337+
git clone https://github.com/apache/xerces-c/
338+
mkdir build_xerces-c && cd build_xerces-c
339+
cmake $HOME/xerces-c -DCMAKE_EXPORT_COMPILE_COMMANDS=1
340+
make -j $(nproc)
341+
cd ${{github.workspace}}/bin
342+
./CodeCompass_parser -d "pgsql:host=localhost;port=5432;user=postgres;password=postgres;database=xerces_c" -w $HOME/ws_pgsql/ -n "Xerces-C" -i $HOME/xerces-c -i $HOME/build_xerces-c/compile_commands.json -j $(nproc)
343+
344+
# Parsing with SQLite3
345+
- name: Parse TinyXML Sqlite3
346+
if: ${{ matrix.db == 'sqlite3' }}
347+
run: |
348+
cd $HOME
349+
git clone https://github.com/leethomason/tinyxml2
350+
mkdir build_tinyxml2 && cd build_tinyxml2
351+
cmake $HOME/tinyxml2 -DCMAKE_EXPORT_COMPILE_COMMANDS=1
352+
make -j $(nproc)
353+
cd ${{github.workspace}}/bin
354+
./CodeCompass_parser -d "sqlite:database=$HOME/tinyxml2.sqlite" -w $HOME/ws_pgsql/ -n TinyXML2 -i $HOME/tinyxml2 -i $HOME/build_tinyxml2/compile_commands.json -j $(nproc)
355+
356+
- name: Parse Xerces-C SQLite3
357+
if: ${{ matrix.db == 'sqlite3' }}
358+
run: |
359+
cd $HOME
360+
git clone https://github.com/apache/xerces-c/
361+
mkdir build_xerces-c && cd build_xerces-c
362+
cmake $HOME/xerces-c -DCMAKE_EXPORT_COMPILE_COMMANDS=1
363+
make -j $(nproc)
364+
cd ${{github.workspace}}/bin
365+
./CodeCompass_parser -d "sqlite:database=$HOME/xerces.sqlite" -w $HOME/ws_pgsql/ -n "Xerces-C" -i $HOME/xerces-c -i $HOME/build_xerces-c/compile_commands.json -j $(nproc)

0 commit comments

Comments
 (0)