From 5c716395be162e73a6f38f39e8ffc3841c3ff053 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Sun, 30 Mar 2025 18:53:47 -0600 Subject: [PATCH] builds.sr.ht ci --- .builds/14.yaml | 33 +++++++++++++++++++++++++++++++++ .builds/16.yaml | 33 +++++++++++++++++++++++++++++++++ .builds/8.yaml | 33 +++++++++++++++++++++++++++++++++ .ci/debian_setup_docker.sh | 17 +++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 .builds/14.yaml create mode 100644 .builds/16.yaml create mode 100644 .builds/8.yaml create mode 100644 .ci/debian_setup_docker.sh diff --git a/.builds/14.yaml b/.builds/14.yaml new file mode 100644 index 0000000..0bdce2e --- /dev/null +++ b/.builds/14.yaml @@ -0,0 +1,33 @@ +image: debian/bookworm + +secrets: + - a19cbc4c-b6a1-414e-bf1c-1e06abc684eb + +tasks: + - print-env: | + echo "$JOB_ID" + echo "$JOB_URL" + echo "$BUILD_SUBMITTER" + echo "$BUILD_REASON" + echo "$GIT_REF" + - setup-env: | + sudo timedatectl set-timezone America/Denver + echo "SLUG=ghcr.io/cwpearson/clang-format-14" >> ~/.buildenv + echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv + - prerequisites: | + bash clang-format/.ci/debian_setup_docker.sh + - build: | + cd clang-format + docker build . --file clang-format-14.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest" + - deploy: | + if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi + set +x + cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin + set -x + docker push "$SLUG:latest" + docker push "$SLUG:$DATE" + +triggers: + - action: email + condition: failure + to: Carl Pearson diff --git a/.builds/16.yaml b/.builds/16.yaml new file mode 100644 index 0000000..b10d3c8 --- /dev/null +++ b/.builds/16.yaml @@ -0,0 +1,33 @@ +image: debian/bookworm + +secrets: + - a19cbc4c-b6a1-414e-bf1c-1e06abc684eb + +tasks: + - print-env: | + echo "$JOB_ID" + echo "$JOB_URL" + echo "$BUILD_SUBMITTER" + echo "$BUILD_REASON" + echo "$GIT_REF" + - setup-env: | + sudo timedatectl set-timezone America/Denver + echo "SLUG=ghcr.io/cwpearson/clang-format-16" >> ~/.buildenv + echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv + - prerequisites: | + bash clang-format/.ci/debian_setup_docker.sh + - build: | + cd clang-format + docker build . --file clang-format-16.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest" + - deploy: | + if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi + set +x + cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin + set -x + docker push "$SLUG:latest" + docker push "$SLUG:$DATE" + +triggers: + - action: email + condition: failure + to: Carl Pearson diff --git a/.builds/8.yaml b/.builds/8.yaml new file mode 100644 index 0000000..81d3db8 --- /dev/null +++ b/.builds/8.yaml @@ -0,0 +1,33 @@ +image: debian/bookworm + +secrets: + - a19cbc4c-b6a1-414e-bf1c-1e06abc684eb + +tasks: + - print-env: | + echo "$JOB_ID" + echo "$JOB_URL" + echo "$BUILD_SUBMITTER" + echo "$BUILD_REASON" + echo "$GIT_REF" + - setup-env: | + sudo timedatectl set-timezone America/Denver + echo "SLUG=ghcr.io/cwpearson/clang-format-8" >> ~/.buildenv + echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv + - prerequisites: | + bash clang-format/.ci/debian_setup_docker.sh + - build: | + cd clang-format + docker build . --file clang-format-8.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest" + - deploy: | + if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi + set +x + cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin + set -x + docker push "$SLUG:latest" + docker push "$SLUG:$DATE" + +triggers: + - action: email + condition: failure + to: Carl Pearson diff --git a/.ci/debian_setup_docker.sh b/.ci/debian_setup_docker.sh new file mode 100644 index 0000000..53db75d --- /dev/null +++ b/.ci/debian_setup_docker.sh @@ -0,0 +1,17 @@ +# Add Docker's official GPG key: +sudo apt-get update +sudo apt-get install -y ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc + +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update + +sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +sudo usermod -aG docker $(whoami)