Skip to content

Commit dbdfdba

Browse files
committed
Refactor CI into multiple workflows and remove Ubuntu 18.04 jobs, as it has been deprecated in GitHub Actions.
1 parent 44b4b4d commit dbdfdba

7 files changed

+131
-221
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Install required packages for CodeCompass build
4+
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10 \
5+
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev \
6+
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Install PostgreSQL
4+
sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Install required packages for CodeCompass runtime
4+
sudo apt-get install -y git cmake make g++ graphviz \
5+
libboost-filesystem1.65.1 libboost-log1.65.1 libboost-program-options1.65.1 \
6+
libllvm10 clang-10 libclang1-10 default-jre libssl1.0.0 libmagic1 \
7+
libgit2-28 ctags googletest libldap-2.4-2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Install SQLite3
4+
sudo apt-get install libodb-sqlite-dev libsqlite3-dev

.github/workflows/ci.yml

+25-221
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ env:
66
BUILD_TYPE: Debug
77

88
jobs:
9+
10+
## BUILD JOBS
911
build:
1012
strategy:
1113
matrix:
1214
db: [postgresql, sqlite3]
13-
os: [ubuntu-20.04, ubuntu-18.04]
15+
os: [ubuntu-20.04]
1416
fail-fast: false
1517

1618
runs-on: ${{ matrix.os }}
1719

18-
# Service containers to run with `runner-job`
1920
services:
2021
# Label used to access the service container
2122
postgres:
22-
# Docker Hub image
2323
image: postgres
2424
# Provide the password for postgres
2525
env:
@@ -35,113 +35,17 @@ jobs:
3535
- 5432:5432
3636

3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v3
3939

4040
- name: Update apt-get
4141
run: sudo apt-get update
4242

43-
# Ubuntu 18.04 commands
44-
- name: Install required packages Ubuntu 18
45-
if: ${{ matrix.os == 'ubuntu-18.04' }}
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 doxygen libgtest-dev npm libldap2-dev
50-
51-
- name: Remove default Postgresql Ubuntu 18
52-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
53-
run: sudo apt-get remove libpq5
54-
55-
- name: Install Postgresql Ubuntu 18
56-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
57-
run: sudo apt-get install postgresql-server-dev-10
58-
59-
- name: Install SQLite3 Ubuntu 18
60-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'sqlite3' }}
61-
run: sudo apt-get install libsqlite3-dev
62-
63-
- name: Cache Thrift Ubuntu 18
64-
id: thrift-cache
65-
if: ${{ matrix.os == 'ubuntu-18.04' }}
66-
uses: actions/cache@v2
67-
with:
68-
path: ~/thrift_install
69-
key: ${{ matrix.db }}-thrift-v2
70-
71-
- name: Install Thrift
72-
if: ${{ matrix.os == 'ubuntu-18.04' && steps.thrift-cache.outputs.cache-hit != 'true' }}
73-
run: >
74-
cd $HOME
75-
76-
wget -O thrift-0.13.0.tar.gz
77-
"http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.13.0/thrift-0.13.0.tar.gz"
78-
79-
tar -xvf ./thrift-0.13.0.tar.gz
80-
81-
cd thrift-0.13.0
43+
- name: Install required packages for build
44+
run: ./.github/scripts/setup_build_${{matrix.os}}.sh
8245

83-
./configure --prefix=$HOME/thrift_install --without-python --enable-libtool-lock
84-
--enable-tutorial=no --enable-tests=no --with-libevent --with-zlib --without-nodejs
85-
--without-lua --without-ruby --without-csharp --without-erlang --without-perl
86-
--without-php --without-php_extension --without-dart --without-haskell --without-go
87-
--without-rs --without-haxe --without-dotnetcore --without-d --without-qt4 --without-qt5
88-
--without-java --without-swift
46+
- name: Install database packages
47+
run: ./.github/scripts/setup_${{matrix.db}}_${{matrix.os}}.sh
8948

90-
make install -j $(nproc)
91-
92-
- name: Cache ODB Ubuntu 18
93-
id: odb-cache
94-
if: ${{ matrix.os == 'ubuntu-18.04' }}
95-
uses: actions/cache@v2
96-
with:
97-
path: ~/odb_install
98-
key: ${{ matrix.db }}-odb-v2
99-
100-
- name: Install ODB
101-
if: ${{ matrix.os == 'ubuntu-18.04' && steps.odb-cache.outputs.cache-hit != 'true' }}
102-
run: |
103-
cd $HOME
104-
mkdir /tmp/build2src
105-
cd /tmp/build2src
106-
curl -sSfO https://download.build2.org/0.15.0/build2-install-0.15.0.sh
107-
sh build2-install-0.15.0.sh --yes --trust yes "$HOME/build2_install/"
108-
export PATH=$PATH:$HOME/build2_install/bin/
109-
mkdir /tmp/odb_build
110-
cd /tmp/odb_build
111-
bpkg create --quiet --jobs $(nproc) cc config.cxx=g++ config.cc.coptions=-O3 config.bin.rpath="$HOME/odb_install/lib" config.install.root="$HOME/odb_install" config.install.sudo=sudo
112-
bpkg add https://pkg.cppget.org/1/beta --trust-yes
113-
bpkg fetch --trust-yes
114-
bpkg build odb --yes
115-
bpkg build libodb --yes
116-
bpkg build libodb-sqlite --yes
117-
bpkg build libodb-pgsql --yes
118-
bpkg install --all --recursive
119-
120-
- name: Export environment variables Ubuntu 18
121-
if: ${{ matrix.os == 'ubuntu-18.04' }}
122-
run: |
123-
ls $HOME/odb_install/bin
124-
ls $HOME/thrift_install/bin
125-
echo "CMAKE_PREFIX_PATH=$HOME/thrift_install:$HOME/odb_install:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
126-
echo "PATH=$HOME/thrift_install/bin:$HOME/odb_install/bin:$PATH" >> $GITHUB_ENV
127-
128-
# Ubuntu 20.04 commands
129-
- name: Install required packages Ubuntu 20
130-
if: ${{ matrix.os == 'ubuntu-20.04' }}
131-
run: >
132-
sudo apt-get install -y git cmake make g++ libboost-all-dev llvm-10-dev clang-10
133-
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev
134-
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev
135-
136-
- name: Install Postgresql Ubuntu 20
137-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
138-
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
139-
140-
- name: Install SQLite3 Ubuntu 20
141-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'sqlite3' }}
142-
run: sudo apt-get install libodb-sqlite-dev libsqlite3-dev
143-
144-
# Common commands
14549
- name: Install GoogleTest
14650
run: |
14751
echo $PATH
@@ -216,6 +120,8 @@ jobs:
216120
name: codecompass-${{ matrix.os }}-${{ matrix.db }}-compiletime
217121
path: ${{github.workspace}}/artifacts/codecompass-${{ matrix.os }}-${{ matrix.db }}-compiletime.zip
218122

123+
124+
## PARSING JOBS
219125
parse:
220126
needs: build
221127
strategy:
@@ -226,11 +132,9 @@ jobs:
226132

227133
runs-on: ${{ matrix.os }}
228134

229-
# Service containers to run with `runner-job`
230135
services:
231136
# Label used to access the service container
232137
postgres:
233-
# Docker Hub image
234138
image: postgres
235139
# Provide the password for postgres
236140
env:
@@ -247,73 +151,17 @@ jobs:
247151
- 5432:5432
248152

249153
steps:
250-
- uses: actions/checkout@v2
154+
- uses: actions/checkout@v3
251155

252156
- name: Update apt-get
253157
run: sudo apt-get update
254158

255-
# Ubuntu 18.04 commands
256-
- name: Install required packages Ubuntu 18
257-
if: ${{ matrix.os == 'ubuntu-18.04' }}
258-
run: >
259-
sudo apt-get install -y git cmake make g++ gcc-7-plugin-dev libgraphviz-dev
260-
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev
261-
llvm-10-dev clang-10 libclang-10-dev default-jre libssl1.0-dev libmagic-dev
262-
libgit2-dev ctags libgtest-dev libldap-2.4-2
263-
264-
- name: Remove default Postgresql Ubuntu 18
265-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
266-
run: sudo apt-get remove libpq5
267-
268-
- name: Install Postgresql Ubuntu 18
269-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
270-
run: sudo apt-get install postgresql-server-dev-10
271-
272-
- name: Install SQLite3 Ubuntu 18
273-
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'sqlite3' }}
274-
run: sudo apt-get install libsqlite3-dev
275-
276-
- name: Cache ODB Ubuntu 18
277-
id: odb-cache
278-
if: ${{ matrix.os == 'ubuntu-18.04' }}
279-
uses: actions/cache@v2
280-
with:
281-
path: ~/odb_install
282-
key: ${{ matrix.db }}-odb-v2
283-
284-
- name: Cache Thrift Ubuntu 18
285-
id: thrift-cache
286-
if: ${{ matrix.os == 'ubuntu-18.04' }}
287-
uses: actions/cache@v2
288-
with:
289-
path: ~/thrift_install
290-
key: ${{ matrix.db }}-thrift-v2
291-
292-
- name: Export environment variables Ubuntu 18
293-
if: ${{ matrix.os == 'ubuntu-18.04' }}
294-
run: |
295-
echo "LD_LIBRARY_PATH=$HOME/thrift_install/lib:$HOME/odb_install/lib:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
296-
echo "PATH=$HOME/thrift_install/bin:$HOME/odb_install/bin:$PATH" >> $GITHUB_ENV
297-
298-
# Ubuntu 20.04 commands
299-
- name: Install required packages Ubuntu 20
300-
if: ${{ matrix.os == 'ubuntu-20.04' }}
301-
run: >
302-
sudo apt-get install -y git cmake make g++ libboost-filesystem-dev
303-
libboost-log-dev libboost-program-options-dev llvm-10-dev clang-10
304-
libclang-10-dev libgraphviz-dev libgtest-dev odb libodb-dev
305-
libthrift-dev default-jre libssl1.1 libmagic-dev libgit2-dev ctags
306-
libldap-2.4-2
307-
308-
- name: Install Postgresql Ubuntu 20
309-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
310-
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
159+
- name: Install required packages for runtime
160+
run: ./.github/scripts/setup_runtime_${{matrix.os}}.sh
311161

312-
- name: Install SQLite3 Ubuntu 20
313-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'sqlite3' }}
314-
run: sudo apt-get install libodb-sqlite-dev libsqlite3-dev
162+
- name: Install database packages
163+
run: ./.github/scripts/setup_${{matrix.db}}_${{matrix.os}}.sh
315164

316-
# Common commands
317165
- name: Download CodeCompass binaries
318166
uses: actions/download-artifact@v2
319167
with:
@@ -405,70 +253,26 @@ jobs:
405253
cd ${{github.workspace}}/install/bin
406254
./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)
407255
256+
257+
## DOCKER IMAGE JOB
408258
docker:
409259
needs: parse
410260
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release/') == true) }}
411-
runs-on: ubuntu-20.04
412261

262+
runs-on: ubuntu-20.04
413263
steps:
414-
- name: Checkout
415-
uses: actions/checkout@v2
416-
417-
- name: Branch name slug
418-
uses: rlespinasse/github-slug-action@v4
419-
420-
- name: Branch name substring
421-
uses: bhowell2/[email protected]
422-
id: branch_substring
264+
- name: Build Docker images
265+
uses: ./.github/workflows/docker.yml
423266
with:
424-
value: ${{ env.GITHUB_REF_SLUG }}
425-
index_of_str: "release-"
426-
fail_if_not_found: false
427-
default_return_value: ""
267+
tag-latest: ${{ github.ref_name == 'master' }}
428268

429-
- name: Build images
430-
run: |
431-
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
432-
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
433-
docker build -t codecompass:dev -t modelcpp/codecompass:${BRANCH_PREFIX}dev --file docker/dev/Dockerfile .
434-
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
435-
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite --file docker/web/Dockerfile --no-cache .
436-
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
437-
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql --file docker/web/Dockerfile --no-cache .
438-
439-
- name: Login to DockerHub
440-
uses: docker/login-action@v2
441-
with:
442-
username: ${{ secrets.DOCKERHUB_USERNAME }}
443-
password: ${{ secrets.DOCKERHUB_TOKEN }}
444-
445-
- name: Push images
446-
run: |
447-
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
448-
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
449-
docker push modelcpp/codecompass:${BRANCH_PREFIX}dev
450-
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite
451-
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql
452-
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite
453-
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql
454-
455-
- name: Tag and push latest image
456-
if: ${{ github.ref_name == 'master' }}
457-
run: |
458-
docker tag modelcpp/codecompass:runtime-pgsql modelcpp/codecompass:latest
459-
docker push modelcpp/codecompass:latest
460269

270+
## TARBALL JOB
461271
tarball:
462272
needs: parse
463273
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release/') == true) }}
464-
runs-on: ubuntu-20.04
465274

275+
runs-on: ubuntu-20.04
466276
steps:
467-
- name: Update apt-get
468-
run: sudo apt-get update
469-
470-
- name: Install curl
471-
run: sudo apt-get install curl
472-
473-
- name: Trigger GitLab CI
474-
run: curl -X POST -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=${{ github.ref_name }} https://gitlab.inf.elte.hu/api/v4/projects/85/trigger/pipeline
277+
- name: Create Tarball
278+
uses: ./.github/workflows/tarball.yml

0 commit comments

Comments
 (0)