Skip to content

Commit 2e02409

Browse files
committed
Add macOS build and parse to CI.
1 parent 999dd59 commit 2e02409

File tree

12 files changed

+155
-21
lines changed

12 files changed

+155
-21
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
3+
# Compile dependencies that cannot be acquired via the official repositories
4+
5+
mkdir -p ${INSTALL_PATH}
6+
7+
## Compile Thrift
8+
CXXFLAGS_OLD=$CXXFLAGS
9+
LDFLAGS_OLD=$LDFLAGS
10+
export CXXFLAGS="$CXXFLAGS -I/opt/homebrew/include"
11+
export LDFLAGS="$LDFLAGS -L/opt/homebrew/lib"
12+
export CXXFLAGS="$CXXFLAGS -Wno-error"
13+
14+
tar -xvf ${DOWNLOAD_PATH}/thrift-0.16.0.tar.gz
15+
cd thrift-0.16.0
16+
./configure --prefix=${INSTALL_PATH}/thrift --silent --without-python \
17+
--enable-libtool-lock --enable-tutorial=no --enable-tests=no \
18+
--with-libevent --with-zlib --without-nodejs --without-lua \
19+
--without-ruby --without-csharp --without-erlang --without-perl \
20+
--without-php --without-php_extension --without-dart \
21+
--without-haskell --without-go --without-rs --without-haxe \
22+
--without-dotnetcore --without-d --without-qt4 --without-qt5 \
23+
--without-java --without-swift \
24+
--with-openssl=/opt/homebrew/opt/openssl
25+
26+
make install -j $(nproc)
27+
28+
export CXXFLAGS=$CXXFLAGS_OLD
29+
export LDFLAGS=$LDFLAGS_OLD
30+
31+
## Compile build2
32+
33+
sh "${DOWNLOAD_PATH}/install_latest_build2.sh" ${INSTALL_PATH}/build2
34+
35+
## Compile libodb runtime libraries
36+
mkdir -p ${DOWNLOAD_PATH}/libodb
37+
cd ${DOWNLOAD_PATH}/libodb
38+
${INSTALL_PATH}/build2/bin/bpkg create --quiet --jobs $(nproc) cc \
39+
config.cxx=g++ \
40+
config.cc.coptions=-O3 \
41+
config.bin.rpath=${INSTALL_PATH}/odb/lib \
42+
config.install.root=${INSTALL_PATH}/odb
43+
44+
### Getting the source
45+
${INSTALL_PATH}/build2/bin/bpkg add https://pkg.cppget.org/1/beta --trust-yes
46+
${INSTALL_PATH}/build2/bin/bpkg fetch --trust-yes
47+
48+
### Building ODB runtime library
49+
${INSTALL_PATH}/build2/bin/bpkg build libodb --yes
50+
${INSTALL_PATH}/build2/bin/bpkg build libodb-sqlite --yes
51+
${INSTALL_PATH}/build2/bin/bpkg build libodb-pgsql --yes
52+
${INSTALL_PATH}/build2/bin/bpkg install --all --recursive
53+
54+
## Compile odb compiler
55+
mkdir -p ${DOWNLOAD_PATH}/odb
56+
cd ${DOWNLOAD_PATH}/odb
57+
bpkg create --quiet --jobs $(nproc) cc \
58+
config.cxx=g++-13 \
59+
config.cc.poptions=-I/opt/homebrew/include \
60+
config.cc.coptions=-O3 \
61+
config.bin.rpath=${INSTALL_PATH}/odb/lib \
62+
config.install.root=${INSTALL_PATH}/odb
63+
64+
### Getting the source
65+
bpkg add https://pkg.cppget.org/1/beta --trust-yes
66+
bpkg fetch --trust-yes
67+
68+
### Building ODB Compiler
69+
bpkg build odb --yes
70+
bpkg install odb
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Download installers for compiled dependencies
4+
5+
mkdir -p "${DOWNLOAD_PATH}"
6+
7+
## Thrift 0.16
8+
9+
wget -O ${DOWNLOAD_PATH}/thrift-0.16.0.tar.gz "http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz"
10+
11+
## ODB
12+
13+
wget -O "${DOWNLOAD_PATH}/install_latest_build2.sh" "https://github.com/Ericsson/CodeCompass/raw/master/scripts/install_latest_build2.sh"
14+
build2_version=$(sh "${DOWNLOAD_PATH}/install_latest_build2.sh" --version)
15+
odb_signature=$(wget -qO- https://pkg.cppget.org/1/beta/signature.manifest)
16+
17+
# Calculate hash of dependencies for Github Cache Action
18+
19+
dependencies_to_hash=("thrift-0.16.0.tar.gz")
20+
21+
concatenated_hashes=""
22+
for file in "${dependencies_to_hash[@]}"; do
23+
file_hash=$(md5sum "${DOWNLOAD_PATH}/${file}" | awk '{print $1}')
24+
concatenated_hashes="${concatenated_hashes}${file_hash}"
25+
done
26+
concatenated_hashes="${concatenated_hashes}${build2_version}${odb_signature}"
27+
28+
hash_value=$(echo -n "$concatenated_hashes" | md5sum | awk '{print $1}')
29+
30+
## Save said hash
31+
32+
### Restore action
33+
echo "macos-12-compile-hash-key=${hash_value}" >> "$GITHUB_OUTPUT"
34+
35+
### Save action
36+
echo "CACHE_KEY=${hash_value}" >> "$GITHUB_ENV"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Post compilation configuration for building (environmental variables, library location settings etc..)
4+
5+
echo "${INSTALL_PATH}/odb/bin" >> $GITHUB_PATH
6+
echo "CMAKE_PREFIX_PATH=${INSTALL_PATH}/odb:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Install available dependencies from HomeBrew
4+
brew install wget
5+
brew install node
6+
brew install sqlite
7+
brew install cmake
8+
brew install llvm@15
9+
brew install gcc
10+
brew install boost
11+
brew install bison
12+
brew install graphviz
13+
brew install googletest
14+
brew install libgit2
15+
brew install libmagic
16+
brew install openssl@3
17+
brew install gnu-sed
18+
brew install coreutils
19+
20+
# Place Bison on the PATH
21+
echo "/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Install PostgreSQL
4+
brew install postgresql@14
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Install SQLite3
4+
brew install sqlite

.github/scripts/ubuntu-20.04/postcompile_build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22

33
echo "${INSTALL_PATH}/thrift/bin" >> $GITHUB_PATH
44
echo "CMAKE_PREFIX_PATH=${INSTALL_PATH}/thrift:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
5-
6-
# Clean up dependency sources and intermediate binaries to save space
7-
rm -f ${DOWNLOAD_PATH}/thrift-0.16.0.tar.gz
8-
rm -rf ${DOWNLOAD_PATH}/thrift-0.16.0/

.github/scripts/ubuntu-20.04/setup_build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# Update package repository
4+
sudo apt-get update
5+
36
# Add official LLVM repositories
47
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
58
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" | sudo tee /etc/apt/sources.list.d/llvm.list

.github/scripts/ubuntu-22.04/postcompile_build.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44

55
echo "${INSTALL_PATH}/odb/bin" >> $GITHUB_PATH
66
echo "CMAKE_PREFIX_PATH=${INSTALL_PATH}/odb:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
7-
8-
# Clean up dependency sources and intermediate binaries to save space
9-
rm -rf ${DOWNLOAD_PATH}/odb

.github/scripts/ubuntu-22.04/setup_build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# Update package repository
4+
sudo apt-get update
5+
36
# Install required packages for CodeCompass build
47
sudo apt install git cmake make g++ libboost-all-dev \
58
llvm-15-dev clang-15 libclang-15-dev \

0 commit comments

Comments
 (0)