Skip to content

Commit

Permalink
Experiment with common drone utility functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Nov 25, 2020
1 parent a1e39d7 commit 7a294ff
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 40 deletions.
46 changes: 46 additions & 0 deletions .ci_playground/drone-common.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright René Ferdinand Rivera Morell 2020.


# Generate pipeline for Linux platform compilers.
def linux_cxx(name, cxx, cxxflags="", packages="", llvm_os="", llvm_ver="", arch="amd64", image="ubuntu:18.04"):
return {
"name": "Linux %s" % name,
"kind": "pipeline",
"type": "docker",
"trigger": { "branch": [ "master" ] },
"platform": {
"os": "linux",
"arch": arch
},
# Create env vars per generation arguments.
"environment": {
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver
},
"steps": [
{
"name": "Everything",
"image": image,
"commands": [
# Need some extra container setup.
"echo '==================================> SETUP'",
"apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget apt-transport-https && rm -rf /var/lib/apt/lists/*",
# The install runs a helper script to do the install and any setup.
"echo '==================================> INSTALL TOOLSET'",
"uname -a",
"./.ci_playground/linux-cxx-install.sh",
# And the compiler step just calls the compiler.
"echo '==================================> COMPILE'",
"$${CXX} --version",
"$${CXX} $${CXXFLAGS} -v src/main.cpp"
]
}
]
}
42 changes: 2 additions & 40 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.

load(".ci_playground/drone-common.star", "linux_cxx")

def main(ctx):
return [
# All the GCC's and Clang's available for our default of Ubuntu Bionic.
Expand All @@ -25,43 +27,3 @@ def main(ctx):
linux_cxx("Clang 6.0", "clang++-6.0", packages="clang-6.0", llvm_os="bionic", llvm_ver="6.0"),
linux_cxx("Clang 5.0", "clang++-5.0", packages="clang-5.0", llvm_os="bionic", llvm_ver="5.0")
]

# Generate pipeline for Linux platform compilers.
def linux_cxx(name, cxx, cxxflags="", packages="", llvm_os="", llvm_ver="", arch="amd64", image="ubuntu:18.04"):
return {
"name": "Linux %s" % name,
"kind": "pipeline",
"type": "docker",
"trigger": { "branch": [ "master" ] },
"platform": {
"os": "linux",
"arch": arch
},
# Create env vars per generation arguments.
"environment": {
"CXX": cxx,
"CXXFLAGS": cxxflags,
"PACKAGES": packages,
"LLVM_OS": llvm_os,
"LLVM_VER": llvm_ver
},
"steps": [
{
"name": "Everything",
"image": image,
"commands": [
# Need some extra container setup.
"echo '==================================> SETUP'",
"apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget apt-transport-https && rm -rf /var/lib/apt/lists/*",
# The install runs a helper script to do the install and any setup.
"echo '==================================> INSTALL TOOLSET'",
"uname -a",
"./.ci_playground/linux-cxx-install.sh",
# And the compiler step just calls the compiler.
"echo '==================================> COMPILE'",
"$${CXX} --version",
"$${CXX} $${CXXFLAGS} -v src/main.cpp"
]
}
]
}

0 comments on commit 7a294ff

Please sign in to comment.