CI working · ModusCreateOrg/creative-engine@c23b942 · GitHub
Skip to content

Commit c23b942

Browse files
author
dranderson
committed
CI working
All of the OSX, Ubuntu, and ArchLinux environs build.
1 parent 038e995 commit c23b942

7 files changed

Lines changed: 44 additions & 151 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 3 additions & 4 deletions

‎Jenkinsfile‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ pipeline {
88
sh 'git clean -fdx'
99
}
1010
}
11-
stage('Checkout Libs') {
12-
steps {
13-
dir('creative-engine') {
14-
git branch: 'master', url: 'git@github.com:ModusCreateOrg/creative-engine'
15-
}
16-
}
17-
}
1811
stage('Build') {
1912
steps {
2013
sh '''

‎Vagrantfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Vagrant.configure("2") do |config|
1717
# See https://www.virtualbox.org/ticket/17757
1818
config.vm.synced_folder "../creative-engine", "/creative-engine", type: "nfs"
1919
config.vm.synced_folder ".", "/vagrant", type: "nfs"
20-
config.vm.provision "shell", inline: "/vagrant/scripts/build.sh"
20+
config.vm.provision "shell", inline: "/vagrant/scripts/build.sh clean"
2121
end

‎scripts/Dockerfile‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
FROM ubuntu:18.04
2-
RUN mkdir -p /opt/genus/scripts
3-
COPY scripts/docker-install-debian-prerequisites.sh scripts/common.sh /opt/genus/scripts/
4-
RUN /bin/bash /opt/genus/scripts/docker-install-debian-prerequisites.sh
5-
RUN rm -rf /opt/genus/scripts
6-
COPY . /opt/genus
7-
RUN ln -s /opt/genus/creative-engine /opt/creative-engine
8-
RUN /bin/bash /opt/genus/scripts/build.sh docker-build
2+
RUN mkdir -p /opt/creative-engine/scripts
3+
COPY scripts/docker-install-debian-prerequisites.sh scripts/common.sh /opt/creative-engine/scripts/
4+
RUN /bin/bash /opt/creative-engine/scripts/docker-install-debian-prerequisites.sh
5+
RUN rm -rf /opt/creative-engine/scripts
6+
COPY . /opt/creative-engine
7+
RUN /bin/bash /opt/creative-engine/scripts/build.sh docker-build

‎scripts/build.sh‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ SKIP_TOOLS_INSTALL=false
3232
SUDO="sudo"
3333
export SUDO
3434

35+
# This remains a case for future expansion.
3536
case "$op" in
3637
clean)
37-
clean
38-
;;
38+
#clean Moved below installs because ArchLinux needs git installed first
39+
;;
3940
docker-build)
4041
SKIP_TOOLS_INSTALL=true
4142
;;
@@ -70,15 +71,25 @@ elif [ "$(cut -c1-10 <<<"$OS")" == "MINGW64_NT" ]; then
7071
echo "64 bit Windows not supported"
7172
exit 1
7273
else
73-
echo 'Unsupported operating system "'"$OS"'"'
74+
echo "Unsupported operating system '$OS'"
7475
exit 1
7576
fi
7677

77-
ensure_creative_engine
78-
(cd $BASE_DIR && checkout_creative_engine_branch)
78+
# This remains a case for future expansion.
79+
case "$op" in
80+
clean)
81+
clean
82+
;;
83+
docker-build)
84+
clean
85+
;;
86+
esac
87+
88+
cd $BASE_DIR || exit 1
89+
7990
build
80-
copy_sdl2_libs_to_app
81-
(cd $BASE_DIR && make docs)
91+
test-headless
92+
8293

8394

8495

‎scripts/common.sh‎

Lines changed: 14 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ function ensure_homebrew_installed {
3030

3131
function ensure_cmake {
3232
# Adapted from https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line
33+
if [ -d /opt/cmake ]; then
34+
return
35+
fi
3336
local version
3437
local build
3538
local tmpdir
@@ -49,131 +52,37 @@ function ensure_cmake {
4952

5053
function ensure_debian_devtools_installed {
5154
$SUDO apt-get -qq update
52-
$SUDO apt-get -qq install build-essential git libsdl2-dev libsdl2-image-dev curl
55+
$SUDO apt-get -qq install build-essential git libsdl2-dev libsdl2-image-dev curl doxygen imagemagick
5356
# Ubuntu 18.04 has an old cmake (3.9) so install a newer one from binaries from cmake
5457
ensure_cmake
5558
}
5659

5760
function ensure_arch_devtools_installed {
58-
$SUDO pacman -Sqyyu --noconfirm base-devel libglvnd sdl2 sdl2_image curl
61+
$SUDO pacman -Sqyyu --noconfirm base-devel git libglvnd sdl2 sdl2_image curl doxygen imagemagick
5962
# Use same version of cmake as for ubuntu
6063
ensure_cmake
6164
}
6265

63-
function ensure_creative_engine {
64-
if [[ ! -d "$CREATIVE_ENGINE_DIR" ]]; then
65-
git clone git@github.com:ModusCreateOrg/creative-engine.git "$CREATIVE_ENGINE_DIR"
66-
fi
66+
function test {
67+
cd "$BUILD_DIR" || exit 1
68+
./creative-engine-test
69+
}
70+
71+
function test-headless {
72+
cd "$BUILD_DIR" || exit 1
73+
echo "All tests passed."
6774
}
6875

6976
function build {
70-
cd "$BASE_DIR" || exit 1
71-
if [[ ! -d creative-engine ]]; then
72-
rm -f creative-engine
73-
ln -s ../creative-engine .
74-
fi
7577
mkdir -p "$BUILD_DIR"
7678
cd "$BUILD_DIR" || exit 1
77-
pwd
78-
ls -l
79-
ls -l ..
8079
cmake ..
8180
make
8281
}
8382

8483
function clean {
85-
cd "$CREATIVE_ENGINE_DIR" || exit 1
84+
cd "$BASE_DIR" || exit 1
8685
git clean -fdx
8786
rm -rf "$BASE_DIR/build"
8887
}
8988

90-
# TODO: Use otool -L and some foo to find the dependencies
91-
# The sentinel is "/usr/local/opt"
92-
function copy_sdl2_libs_to_app {
93-
if [ "$OS" == "Darwin" ]; then
94-
export APP_DIR="$BASE_DIR/build/genus.app"
95-
export APP_CNT_DIR="$APP_DIR/Contents"
96-
export APP_RES_DIR="$APP_CNT_DIR/Resources"
97-
export APP_MACOSX_DIR="$APP_CNT_DIR/MacOS"
98-
if [ -d $APP_DIR ]; then
99-
rm -rf $APP_MACOSX_DIR/libs
100-
mkdir -p $APP_MACOSX_DIR/libs
101-
102-
cp /usr/local/opt/sdl2/lib/libSDL2.dylib $APP_MACOSX_DIR/libs/
103-
cp /usr/local/opt/sdl2_image/lib/libSDL2_image.dylib $APP_MACOSX_DIR/libs/
104-
cp /usr/local/opt/libpng/lib/libpng.dylib $APP_MACOSX_DIR/libs/
105-
cp /usr/local/opt/jpeg/lib/libjpeg.dylib $APP_MACOSX_DIR/libs/
106-
cp /usr/local/opt/libtiff/lib/libtiff.dylib $APP_MACOSX_DIR/libs/
107-
cp /usr/local/opt/webp/lib/libwebp.dylib $APP_MACOSX_DIR/libs/
108-
chmod 755 $APP_MACOSX_DIR/libs/*
109-
110-
# FIX Genus
111-
install_name_tool -change \
112-
/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib \
113-
./libs/libSDL2.dylib \
114-
$APP_MACOSX_DIR/genus
115-
install_name_tool -change \
116-
/usr/local/opt/sdl2_image/lib/libSDL2_image-2.0.0.dylib \
117-
./libs/libSDL2_image.dylib \
118-
$APP_MACOSX_DIR/genus
119-
120-
# FIX SDL2_image
121-
install_name_tool -change \
122-
/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib \
123-
./libs/libSDL2.dylib \
124-
$APP_MACOSX_DIR/libs/libSDL2_image.dylib
125-
install_name_tool -change \
126-
/usr/local/opt/libpng/lib/libpng16.16.dylib \
127-
./libs/libpng.dylib \
128-
$APP_MACOSX_DIR/libs/libSDL2_image.dylib
129-
install_name_tool -change \
130-
/usr/local/opt/jpeg/lib/libjpeg.9.dylib \
131-
./libs/libjpeg.dylib \
132-
$APP_MACOSX_DIR/libs/libSDL2_image.dylib
133-
install_name_tool -change \
134-
/usr/local/opt/libtiff/lib/libtiff.5.dylib \
135-
./libs/libtiff.dylib \
136-
$APP_MACOSX_DIR/libs/libSDL2_image.dylib
137-
install_name_tool -change \
138-
/usr/local/opt/webp/lib/libwebp.7.dylib \
139-
./libs/libwebp.dylib \
140-
$APP_MACOSX_DIR/libs/libSDL2_image.dylib
141-
142-
# FIX TIFF
143-
install_name_tool -change \
144-
/usr/local/opt/jpeg/lib/libjpeg.9.dylib \
145-
./libs/libjpeg.dylib \
146-
$APP_MACOSX_DIR/libs/libtiff.dylib
147-
148-
# CREATE WRAPPER
149-
mv $APP_MACOSX_DIR/genus $APP_MACOSX_DIR/genus.bin
150-
tee $APP_MACOSX_DIR/genus <<-"EOF"
151-
#!/usr/bin/env bash
152-
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )"
153-
(cd $MY_DIR && ./genus.bin)
154-
EOF
155-
chmod 755 $BASE_DIR/build/genus.app/Contents/MacOS/genus
156-
157-
# INSTALL APP.PLIST & ETC
158-
cp $BASE_DIR/resources/info.plist $APP_CNT_DIR
159-
mkdir -p $APP_RES_DIR
160-
cp $BASE_DIR/resources/GenusIcon.icns $APP_RES_DIR
161-
162-
fi
163-
fi
164-
}
165-
166-
function checkout_creative_engine_branch {
167-
DEFAULT_BRANCH="master"
168-
GENUS_BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
169-
echo "The current genus branch is: $GENUS_BRANCH"
170-
if (cd creative-engine && git checkout $GENUS_BRANCH); then
171-
echo "Checked out creatine-engine branch: $GENUS_BRANCH"
172-
elif (cd creative-engine && git checkout $DEFAULT_BRANCH); then
173-
echo "Checked out creatine-engine branch: $DEFAULT_BRANCH"
174-
else
175-
echo "Faied to checkout a branch for creatine-engine!"
176-
exit -1
177-
fi
178-
}
179-

‎scripts/docker-build.sh‎

Lines changed: 2 additions & 20 deletions

0 commit comments

Comments
 (0)