diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..3fdf736 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,27 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference +version: 2.1 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/configuration-reference/#jobs +jobs: + ctest: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/configuration-reference/#executor-job + docker: + - image: cimg/base:stable + # Add steps to the job + # See: https://circleci.com/docs/configuration-reference/#steps + steps: + - checkout + - run: + name: "Install dependencies" + command: "./scripts/install-dependencies.sh" + - + +# Orchestrate jobs using workflows +# See: https://circleci.com/docs/configuration-reference/#workflows +workflows: + say-hello-workflow: + jobs: + - say-hello diff --git a/.gitignore b/.gitignore index 979d0c0..9b258c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build cmake-build-* +compile_commands.json TAGS tags diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..87f0a10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:jammy +LABEL authors="kyle" + +ARG DEBIAN_FRONTEND=noninteractive +ARG AUTOMATED_MODE=yes +WORKDIR /tmp +ENV TZ=America/Los_Angeles +RUN apt-get update -y && apt-get install -y gpg sudo ca-certificates apt-transport-https ssh tar gzip + +RUN mkdir scripts +WORKDIR scripts +ADD scripts . +WORKDIR /tmp +RUN bash ./scripts/install-depdendencies.sh && rm -r * +RUN apt-get autoclean && \ + apt-get autoremove && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/scripts/install-cmake-debian.sh b/scripts/install-cmake-debian.sh index 1b4bd5c..3822e10 100755 --- a/scripts/install-cmake-debian.sh +++ b/scripts/install-cmake-debian.sh @@ -4,39 +4,47 @@ set -eu source /etc/lsb-release +SUDO="sudo" +USE_CMAKE_RC="${USE_CMAKE_RC:-}" preinstall () { echo "[+] preparing to install" - sudo apt-get update - sudo apt-get install ca-certificates gpg wget + if [ "$(whoami)" == "root" ] + then + SUDO= + fi + + $SUDO apt-get -y update + $SUDO apt-get -y install ca-certificates gpg wget } do_install () { if [ ! -f /etc/apt/sources.list.d/kitware.list ] then echo "[+] fetching initial keyring" - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | $SUDO tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null echo "[+] adding repo to sources.list.d" echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${DISTRIB_CODENAME} main" | \ - sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null - sudo apt-get update + $SUDO tee /etc/apt/sources.list.d/kitware.list >/dev/null + $SUDO apt-get -y update echo "[+] installing kitware keyring" if [ -f "/usr/share/keyrings/kitware-archive-keyring.gpg" ] then - sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg + $SUDO rm /usr/share/keyrings/kitware-archive-keyring.gpg fi - sudo apt-get install kitware-archive-keyring + $SUDO apt-get -y install kitware-archive-keyring fi if [ "${USE_CMAKE_RC}" = "YES" ] then echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${DISTRIB_RELEASE}-rc main' | \ - sudo tee -a /etc/apt/sources.list.d/kitware.list >/dev/null - sudo apt-get update + $SUDO tee -a /etc/apt/sources.list.d/kitware.list >/dev/null + $SUDO apt-get update fi } +preinstall do_install -sudo apt-get install cmake +$SUDO apt-get install -y cmake diff --git a/scripts/install-depdendencies.sh b/scripts/install-depdendencies.sh index 3aa7684..780d05b 100755 --- a/scripts/install-depdendencies.sh +++ b/scripts/install-depdendencies.sh @@ -14,6 +14,11 @@ AUTOMATED_MODE=${AUTOMATED_MODE:-} install_debianesque () { APTARGS="" + SUDO="sudo" + if [ "$(whoami)" == "root" ] + then + SUDO= + fi if [ ! -z "${AUTOMATED_MODE}" ] then @@ -25,11 +30,10 @@ install_debianesque () { if [ -z "$(command -v cmake)" ] then ./scripts/install-cmake-debian.sh + fi echo "[+] installing tools" - sudo apt-get $APTARGS install git cmake clang scdoc python3-pip - - ( cd docs/ && python3 -m pip install -r requirements.txt ) + sudo $SUDO apt-get $APTARGS install git clang scdoc python3-pip } install_unsupported () {