Skip to content

Commit 962ff6c

Browse files
committed
master the use of docker. maybe
1 parent 41c297b commit 962ff6c

9 files changed

Lines changed: 266 additions & 139 deletions

File tree

.dockerignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Python (Bytecode)
2+
*.pyc
3+
4+
# ninja files
5+
*.ninja
6+
7+
# Visual Studio
8+
*.props
9+
*.user
10+
.vs/
11+
Debug/
12+
Release/
13+
x64/
14+
x86/
15+
*.pyproj
16+
*.vcxproj
17+
*.vcxproj.filters
18+
*.tlog
19+
*.lastbuildstate
20+
*.idb
21+
*.sln
22+
*.gitattributes
23+
24+
# VSCode
25+
.vscode/
26+
27+
# CMake
28+
build/
29+
build-sol2/
30+
CMakeCache.txt
31+
CMakeFiles/
32+
33+
# Compiler outputs
34+
obj/*
35+
bin/*
36+
main.exe
37+
main.o
38+
lua53.dll
39+
lua-5.3.4.dll
40+
main.ilk
41+
main.pdb
42+
43+
# Dropbox interference
44+
.dropbox*
45+
46+
# QtCreator
47+
*.creator.user.*
48+
*.config
49+
*.creator
50+
*.files
51+
*.includes
52+
53+
# Scratchpad Files
54+
m.lua
55+
catch_mock.hpp
56+
main_aux.cpp
57+
main.hpp
58+
main2.cpp
59+
main.cpp
60+
61+
# Local Lua Testbeds
62+
lua-5.3.4-cxx/
63+
lua-5.3.4/
64+
lua-5.3.2/
65+
lua-5.3.1/
66+
lua-5.3.0/
67+
lua-5.2.4/
68+
lua-5.2.2/
69+
lua-5.2.3/
70+
lua-5.1.5/
71+
LuaJIT-2.1.0/
72+
luajit-2.0.5/
73+
luajit-2.0.3/
74+
include/
75+
liblua.a
76+
lib/liblua5.2.a
77+
78+
# Docs Artefacts
79+
docs/build/
80+
81+
# Sublime Text
82+
*.sublime-workspace
83+
*.sublime-project
84+
85+
86+
# Windows Crap
87+
desktop.ini
88+
*.db
89+
90+
# Miscellaneous
91+
external/

.gitignore

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
Debug/
1212
Release/
1313
x64/
14+
x86/
15+
*.pyproj
1416
*.vcxproj
1517
*.vcxproj.filters
1618
*.tlog
@@ -24,12 +26,19 @@ x64/
2426

2527
# CMake
2628
build/
29+
build-sol2/
2730
CMakeCache.txt
2831
CMakeFiles/
2932

3033
# Compiler outputs
3134
obj/*
3235
bin/*
36+
main.exe
37+
main.o
38+
lua53.dll
39+
lua-5.3.4.dll
40+
main.ilk
41+
main.pdb
3342

3443
# Dropbox interference
3544
.dropbox*
@@ -42,51 +51,42 @@ bin/*
4251
*.includes
4352

4453
# Scratchpad Files
54+
m.lua
55+
main.lua
56+
catch_mock.hpp
57+
main_aux.cpp
58+
main.hpp
4559
main2.cpp
4660
main.cpp
4761

4862
# Local Lua Testbeds
63+
lua-5.3.4-cxx/
64+
lua-5.3.4/
4965
lua-5.3.2/
5066
lua-5.3.1/
5167
lua-5.3.0/
5268
lua-5.2.4/
5369
lua-5.2.2/
5470
lua-5.2.3/
5571
lua-5.1.5/
72+
LuaJIT-2.1.0/
5673
luajit-2.0.5/
5774
luajit-2.0.3/
5875
include/
5976
liblua.a
6077
lib/liblua5.2.a
6178

62-
# Windows Crap
63-
desktop.ini
64-
*.sublime-workspace
79+
# Docs Artefacts
6580
docs/build/
81+
82+
# Sublime Text
83+
*.sublime-workspace
6684
*.sublime-project
67-
m.lua
68-
single/sol.hpp
85+
86+
87+
# Windows Crap
88+
desktop.ini
6989
*.db
70-
lua53.dll
71-
main.exe
72-
main.o
73-
lua-5.3.4/
74-
main.lua
75-
LuaJIT-2.1.0/
76-
lua-5.3.4-cxx/
77-
lua-5.3.4.vcxproj-cxx.filters
78-
sol.pyproj
79-
lua-5.3.4.dll
80-
main.ilk
81-
main.pdb
82-
lua-5.3.4-cxx/
83-
lua-5.3.4/
84-
temp.bad_runtime.lua
85-
temp.bad_syntax.lua
86-
temp.good.lua
87-
catch_mock.hpp
88-
main_aux.cpp
89-
main.hpp
90-
tmp_thingy_user.lua
91-
tmp_thingy.lua
90+
91+
# Miscellaneous
9292
external/

.travis.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,61 @@
2323
sudo: required
2424
language: cpp
2525

26+
git:
27+
depth: 5
28+
2629
services:
2730
- docker
2831

2932
before_install:
30-
- sudo apt install -y git zsh
31-
- sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
32-
- sudo chmod +x /usr/local/bin/docker-compose
33-
- sudo usermod -aG docker ${USER}
34-
- sudo docker-compose --version
33+
- sudo apt install -y git
3534

3635
script:
37-
- sudo docker-compose build
38-
- sudo docker-compose run -e "LUA_VERSION=$LUA_VERSION" -e "LLVM_VERSION=$LLVM_VERSION" -e "GCC_VERSION=$GCC_VERSION" test
36+
- sudo docker image build --tag sol2:ci --build-arg "CI=${CI}" --build-arg "LUA_VERSION=${LUA_VERSION}" --build-arg "GCC_VERSION=${GCC_VERSION}" --build-arg "LLVM_VERSION=${LLVM_VERSION}" .
37+
- sudo docker run --name "sol2.test" --tty --env "CI=${CI}" --env "LUA_VERSION=${LUA_VERSION}" --env "GCC_VERSION=${GCC_VERSION}" --env "LLVM_VERSION=${LLVM_VERSION}" sol2:ci
38+
- sudo docker rm $(sudo docker ps -a -q)
39+
- sudo docker rmi $(sudo docker image ls -q)
3940

4041
env:
4142
# GCC 4.9.x, 5.x, 6.x, 7.x
4243
- LUA_VERSION=5.3.4
4344
GCC_VERSION=4.9
45+
CI=true
4446
- LUA_VERSION=5.3.4
4547
GCC_VERSION=5
48+
CI=true
4649
- LUA_VERSION=5.3.4
4750
GCC_VERSION=6
51+
CI=true
4852
- LUA_VERSION=5.3.4
4953
GCC_VERSION=7
54+
CI=true
5055
# LLVM 3.6.x -> 5.0.x
5156
- LUA_VERSION=5.3.4
5257
LLVM_VERSION=3.6.2
58+
CI=true
5359
- LUA_VERSION=5.3.4
5460
LLVM_VERSION=3.7.1
61+
CI=true
5562
- LUA_VERSION=5.3.4
5663
LLVM_VERSION=3.8.1
64+
CI=true
5765
- LUA_VERSION=5.3.4
5866
LLVM_VERSION=3.9.0
67+
CI=true
5968
- LUA_VERSION=5.3.4
6069
LLVM_VERSION=4.0.1
70+
CI=true
6171
- LUA_VERSION=5.3.4
6272
LLVM_VERSION=5.0.1
73+
CI=true
6374
# Lua Versions 5.2.4, 5.1.5, and maybe LuaJIT (as well as x86)
6475
- LUA_VERSION=5.2.4
6576
GCC_VERSION=7
77+
CI=true
6678
- LUA_VERSION=5.1.5
6779
GCC_VERSION=7
80+
CI=true
6881

6982
matrix:
7083
fast_finish: true

CMakeLists.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,23 @@ if (TESTS OR TESTS_SINGLE OR EXAMPLES OR TESTS_EXAMPLES)
199199
endif()
200200
find_package(Threads)
201201
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
202-
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
203202
if (BUILD_LUA OR BUILD_LUAJIT)
204203
include(LuaBuild)
205-
elseif (NORMALIZED_LUA_VERSION MATCHES "5.1")
206-
find_package(Lua 5.1 EXACT REQUIRED)
207-
elseif(NORMALIZED_LUA_VERSION MATCHES "5.2")
208-
find_package(Lua 5.2 EXACT REQUIRED)
209-
elseif(NORMALIZED_LUA_VERSION MATCHES "5.3")
210-
find_package(Lua 5.3 EXACT REQUIRED)
211-
elseif(NORMALIZED_LUA_VERSION MATCHES "luajit")
212-
find_package(LuaJIT REQUIRED)
204+
elseif (NOT LUA_VERSION)
205+
# can't do anything
213206
else()
214-
include(LuaBuild)
207+
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
208+
if (NORMALIZED_LUA_VERSION MATCHES "5.1")
209+
find_package(Lua 5.1 EXACT REQUIRED)
210+
elseif(NORMALIZED_LUA_VERSION MATCHES "5.2")
211+
find_package(Lua 5.2 EXACT REQUIRED)
212+
elseif(NORMALIZED_LUA_VERSION MATCHES "5.3")
213+
find_package(Lua 5.3 EXACT REQUIRED)
214+
elseif(NORMALIZED_LUA_VERSION MATCHES "luajit")
215+
find_package(LuaJIT REQUIRED)
216+
else()
217+
include(LuaBuild)
218+
endif()
215219
endif()
216220

217221
if (NOT LUA_FOUND)

Dockerfile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,31 @@
2222

2323
# Start from the ubuntu:xenial image
2424
FROM ubuntu:xenial
25+
# We want our working directory to be the toplevel
26+
WORKDIR /
2527
# Everything from our current directory (repo toplevel in travis-ci)
2628
# should be copied into our container at the top-level sol2 directory
27-
ADD . /sol2
29+
ADD . sol2
30+
ARG CI=true
31+
ARG LUA_VERSION=5.3.4
32+
ARG GCC_VERSION
33+
ARG LLVM_VERSION
2834
#VOLUME /sol2
29-
# We want our working directory to be the toplevel
30-
WORKDIR /
35+
# Potential environment variables
36+
ENV LUA_VERSION=${LUA_VERSION} GCC_VERSION=${GCC_VERSION} LLVM_VERSION=${LLVM_VERSION} CI=${CI}
3137
# RUN is how you write to the image you've pulled down
3238
# RUN actions are "committed" to the image, and everything will
3339
# start from the base after all run commands are executed
34-
RUN apt update
35-
RUN apt -y install sudo zsh
36-
RUN apt -y dist-upgrade
37-
RUN mkdir -p build-sol2/Debug build-sol2/Release
38-
RUN chmod +x /sol2/scripts/preparation.linux.sh
39-
RUN ["/usr/bin/env", "zsh", "-c", "-x", "./sol2/scripts/preparation.linux.sh"]
40+
RUN apt-get update
41+
RUN apt-get -y install sudo zsh
42+
RUN apt-get -y dist-upgrade
43+
RUN mkdir -p /build-sol2/Debug /build-sol2/Release
44+
RUN chmod +x /sol2/scripts/preparation.linux.sh /sol2/scripts/run.linux.sh
45+
RUN ["/usr/bin/env", "zsh", "-e", "/sol2/scripts/preparation.linux.sh"]
4046
# CMD/ENTRYPOINT is different from RUN
4147
# these are done on a per-instantiation and essentially describe
4248
# the DEFAULT behavior of this container when its started, not what state it
4349
# gets "saved" in...
4450
# it only runs the last CMD/ENTRYPOINT as the default behavior:
4551
# multiple CMDs will not be respected
46-
CMD ["/usr/bin/env", "zsh", "-c", "-x", "chmod +x /sol2/scripts/run.linux.sh && ./sol2/scripts/run.linux.sh"]
52+
ENTRYPOINT ["/usr/bin/env", "zsh", "-x", "-e", "/sol2/scripts/run.linux.sh"]

cmake/Modules/LuaVanillaBuild.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ target_compile_definitions(${liblua}
304304
if (MSVC)
305305
target_compile_options(${liblua}
306306
PRIVATE /W1)
307+
else()
308+
target_compile_options(${liblua}
309+
PRIVATE -w -Wno-implicit-fallthrough)
307310
endif()
308311
if (WIN32)
309312
#target_compile_definitions(${liblua}

0 commit comments

Comments
 (0)