Setting up CircleCI

This commit is contained in:
Kyle Isom 2023-10-18 04:21:32 -07:00
parent 5edb920881
commit f19b301aed
5 changed files with 71 additions and 13 deletions

27
.circleci/config.yml Normal file
View File

@ -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

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
build build
cmake-build-* cmake-build-*
compile_commands.json
TAGS TAGS
tags tags

18
Dockerfile Normal file
View File

@ -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/*

View File

@ -4,39 +4,47 @@ set -eu
source /etc/lsb-release source /etc/lsb-release
SUDO="sudo"
USE_CMAKE_RC="${USE_CMAKE_RC:-}"
preinstall () { preinstall () {
echo "[+] preparing to install" echo "[+] preparing to install"
sudo apt-get update if [ "$(whoami)" == "root" ]
sudo apt-get install ca-certificates gpg wget then
SUDO=
fi
$SUDO apt-get -y update
$SUDO apt-get -y install ca-certificates gpg wget
} }
do_install () { do_install () {
if [ ! -f /etc/apt/sources.list.d/kitware.list ] if [ ! -f /etc/apt/sources.list.d/kitware.list ]
then then
echo "[+] fetching initial keyring" 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 "[+] 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" | \ 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 tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update $SUDO apt-get -y update
echo "[+] installing kitware keyring" echo "[+] installing kitware keyring"
if [ -f "/usr/share/keyrings/kitware-archive-keyring.gpg" ] if [ -f "/usr/share/keyrings/kitware-archive-keyring.gpg" ]
then then
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg $SUDO rm /usr/share/keyrings/kitware-archive-keyring.gpg
fi fi
sudo apt-get install kitware-archive-keyring $SUDO apt-get -y install kitware-archive-keyring
fi fi
if [ "${USE_CMAKE_RC}" = "YES" ] if [ "${USE_CMAKE_RC}" = "YES" ]
then then
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${DISTRIB_RELEASE}-rc main' | \ 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 tee -a /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update $SUDO apt-get update
fi fi
} }
preinstall
do_install do_install
sudo apt-get install cmake $SUDO apt-get install -y cmake

View File

@ -14,6 +14,11 @@ AUTOMATED_MODE=${AUTOMATED_MODE:-}
install_debianesque () { install_debianesque () {
APTARGS="" APTARGS=""
SUDO="sudo"
if [ "$(whoami)" == "root" ]
then
SUDO=
fi
if [ ! -z "${AUTOMATED_MODE}" ] if [ ! -z "${AUTOMATED_MODE}" ]
then then
@ -25,11 +30,10 @@ install_debianesque () {
if [ -z "$(command -v cmake)" ] if [ -z "$(command -v cmake)" ]
then then
./scripts/install-cmake-debian.sh ./scripts/install-cmake-debian.sh
fi
echo "[+] installing tools" echo "[+] installing tools"
sudo apt-get $APTARGS install git cmake clang scdoc python3-pip sudo $SUDO apt-get $APTARGS install git clang scdoc python3-pip
( cd docs/ && python3 -m pip install -r requirements.txt )
} }
install_unsupported () { install_unsupported () {