Skip to content

Commit f7391ed

Browse files
author
Peter Kubov
committed
Continuous integration in Github Actions
This commit provides configuration and support script for running RetDec build, tests & artifact creation in Github Actions CI.
1 parent 085666b commit f7391ed

File tree

14 files changed

+300
-0
lines changed

14 files changed

+300
-0
lines changed

.github/workflows/Linux/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/bash
2+
3+
RD_DIR=$PWD
4+
mkdir -p build
5+
cd build
6+
7+
cmake $RD_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRETDEC_TESTS=on -DCMAKE_INSTALL_PREFIX=$RD_DIR/install
8+
make -j$(nproc) install
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/bash
2+
3+
sudo apt-get update
4+
sudo apt-get install openssl gcc-multilib python3-venv doxygen graphviz
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/bash
2+
3+
wget --no-proxy https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O llvm.tar.xz
4+
tar -xJf llvm.tar.xz
5+
mv clang* $CLANG_DIR_OUT
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/bash
2+
3+
cat <<EOF > $PWD/retdec-regression-tests-framework/config_local.ini
4+
[runner]
5+
; Path to the extracted Clang package containing subdirectories such as bin, include, lib, share.
6+
clang_dir = $PWD/clang
7+
; Path to the cloned repository containing regression tests.
8+
tests_root_dir = $PWD/retdec-regression-tests
9+
; Path to the RetDec's installation directory.
10+
retdec_install_dir = $PWD/install
11+
EOF
12+
13+
cd "$PWD/retdec-regression-tests-framework"
14+
15+
python3 -m venv .venv
16+
17+
. .venv/bin/activate
18+
pip3 install -r requirements.txt
19+
20+
python3 ./runner.py

.github/workflows/Windows/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/bash
2+
3+
RD_DIR=$PWD
4+
5+
# The C:/ drive on Windows has significanly larger space to work with.
6+
mkdir -p /c/build
7+
cd /c/build
8+
9+
cmake $RD_DIR -DRETDEC_TESTS=on -DCMAKE_INSTALL_PREFIX="$RD_DIR/install"
10+
cmake --build . -j $NUMBER_OF_PROCESSORS --config $BUILD_TYPE -- -m
11+
cmake --build . --config $BUILD_TYPE --target "$PWD/install"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/bash
2+
3+
choco install --no-progress openssl 7zip
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/bash
2+
3+
curl https://releases.llvm.org/3.9.1/LLVM-3.9.1-win64.exe -o llvm.exe
4+
5+
# Save download path.
6+
download_path=$PWD
7+
8+
# Create output dir for clang.
9+
mkdir -p $CLANG_DIR_OUT
10+
cd $CLANG_DIR_OUT
11+
12+
# Extract clang there.
13+
7z x $download_path/llvm.exe
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# We need to specify each path in Windows format.
2+
WIN_PWD=D:$(echo $PWD | sed 's/^\/d//' | sed 's/\//\\/g')
3+
4+
cat <<EOF > $PWD/retdec-regression-tests-framework/config_local.ini
5+
[runner]
6+
; Path to the extracted Clang package containing subdirectories such as bin, include, lib, share.
7+
clang_dir = $WIN_PWD\\clang
8+
; Path to the cloned repository containing regression tests.
9+
tests_root_dir = $WIN_PWD\\retdec-regression-tests
10+
; Path to the RetDec's installation directory.
11+
retdec_install_dir = $WIN_PWD\\install
12+
EOF
13+
14+
cd "$PWD/retdec-regression-tests-framework"
15+
16+
python -m pip install virtualenv
17+
python -m venv .venv
18+
19+
. .venv/Scripts/activate
20+
pip3 install -r requirements.txt
21+
22+
python3 ./runner.py
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/bash
2+
3+
RD=$PWD
4+
5+
# Get current branch of RetDec
6+
# > GITHUB_BASE_REF is set on PR, empty otherwise.
7+
RD_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}
8+
9+
echo "RetDec branch: $RD_BRANCH"
10+
11+
# Clone regression tests.
12+
git clone https://github.com/avast/retdec-regression-tests
13+
cd retdec-regression-tests
14+
15+
# Checkout the same branch if possible.
16+
git checkout "$RD_BRANCH" || git checkout master
17+
18+
echo "RetDec RT branch: $(git rev-parse --abbrev-ref HEAD)"
19+
20+
# Get back to the base repo.
21+
cd $RD
22+
23+
# Clone regression tests framework.
24+
git clone https://github.com/avast/retdec-regression-tests-framework
25+
cd retdec-regression-tests-framework
26+
27+
# Checkout the same branch if possible.
28+
git checkout "$RD_BRANCH" || git checkout master
29+
30+
echo "RetDec RT Framework: $(git rev-parse --abbrev-ref HEAD)"

.github/workflows/macOS/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/bash
2+
3+
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
4+
export OPENSSL_ROOT_DIR="/usr/local/opt/[email protected]/"
5+
6+
RD_DIR=$PWD
7+
mkdir -p build
8+
cd build
9+
10+
cmake $RD_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRETDEC_TESTS=on -DCMAKE_INSTALL_PREFIX=$RD_DIR/install
11+
make -j$(sysctl -n hw.ncpu) install

0 commit comments

Comments
 (0)