Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
build/
.cache/
.ci/
report/
.git/
.github/
**/*.md
!README.md
tests/
docs/
plugins/
scripts/fuzz-*
scripts/lint*
scripts/tidy*
scripts/static-check.sh
scripts/coverage*
scripts/dependency-audit.sh
scripts/sbom.sh
234 changes: 234 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: read

defaults:
run:
shell: bash

env:
LLVM_VERSION: "22"

jobs:
build-release:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
runner: ubuntu-24.04
platform: linux
arch: x86_64
python_cmd: python3
binary_path: build/build/Release/bin/beez
- name: linux-aarch64
runner: ubuntu-24.04-arm
platform: linux
arch: aarch64
python_cmd: python3
binary_path: build/build/Release/bin/beez
- name: macos-x86_64
runner: macos-15-intel
platform: macos
arch: x86_64
python_cmd: python3
binary_path: build/build/Release/bin/beez
- name: macos-aarch64
runner: macos-15
platform: macos
arch: aarch64
python_cmd: python3
binary_path: build/build/Release/bin/beez

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Beez toolchain (Linux)
if: runner.os == 'Linux'
uses: ./.github/actions/setup-beez
with:
install-cppcheck: "false"
install-cmakelang: "false"

- name: Install Linux packaging prerequisites
if: runner.os == 'Linux'
run: sudo apt-get install -y --no-install-recommends zstd

- name: Install macOS prerequisites
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_UPGRADE: 1
run: |
set -euo pipefail
missing=()
command -v ninja >/dev/null || missing+=(ninja)
command -v zstd >/dev/null || missing+=(zstd)
command -v cmake >/dev/null || missing+=(cmake)
if ((${#missing[@]} > 0)); then
brew install "${missing[@]}"
fi
pipx install conan
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Build release binary
env:
RELEASE_PLATFORM: ${{ matrix.platform }}
RELEASE_ARCH: ${{ matrix.arch }}
run: |
set -euo pipefail
chmod +x scripts/ci/release-build.sh scripts/ci/release-conan-profile.sh
./scripts/ci/release-build.sh

- name: Package release artifact
run: |
set -euo pipefail
${{ matrix.python_cmd }} scripts/ci/package_binary.py \
--version "$GITHUB_REF_NAME" \
--platform "${{ matrix.platform }}" \
--arch "${{ matrix.arch }}" \
--binary "${{ matrix.binary_path }}" \
--output-dir dist

- name: Package ReqPack artifact
run: |
set -euo pipefail
${{ matrix.python_cmd }} scripts/ci/package_reqpack.py \
--version "$GITHUB_REF_NAME" \
--platform "${{ matrix.platform }}" \
--arch "${{ matrix.arch }}" \
--binary "${{ matrix.binary_path }}" \
--output-dir dist

- name: Package Beez plugins
run: |
set -euo pipefail
lua scripts/ci/package_all_plugins.lua \
--version "$GITHUB_REF_NAME" \
--platform "${{ matrix.platform }}" \
--arch "${{ matrix.arch }}" \
--output-dir dist/plugins

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.platform }}-${{ matrix.arch }}
path: |
dist/*.tar.gz
dist/*.rqp
dist/plugins/*.rqp
if-no-files-found: error

release:
needs: build-release
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download packaged artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: dist

- name: Build ReqPack repository index
run: |
set -euo pipefail
python3 scripts/ci/build_reqpack_index.py --dist-dir dist --output dist/index.json
lua scripts/ci/build_plugin_index.lua --dist-dir dist/plugins --output dist/plugins/index.json

- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
NOTES_FILE="$(mktemp)"
cat > "${NOTES_FILE}" <<EOF
Automated release for Beez ${VERSION}.

## Assets
- Platform binaries (\`.tar.gz\`) for Linux and macOS
- ReqPack CLI packages (\`beez-cli-*.rqp\`) for Linux and macOS
- ReqPack plugin packages (\`coditary-*.rqp\`) and plugin index (\`plugins/index.json\`)
- ReqPack repository index (\`index.json\`)
- Container image: \`ghcr.io/coditary/beez:${VERSION}\`
EOF
if ! gh release view "$GITHUB_REF_NAME" --repo "$GH_REPO" >/dev/null 2>&1; then
gh release create "$GITHUB_REF_NAME" --repo "$GH_REPO" --title "Beez ${VERSION}" --notes-file "${NOTES_FILE}"
fi
gh release edit "$GITHUB_REF_NAME" --repo "$GH_REPO" --draft=false --latest --title "Beez ${VERSION}" --notes-file "${NOTES_FILE}"
shopt -s nullglob
assets=(dist/*.tar.gz dist/*.rqp dist/index.json dist/plugins/*.rqp dist/plugins/index.json)
if ((${#assets[@]} == 0)); then
echo "No release assets found in dist/." >&2
exit 1
fi
gh release upload "$GITHUB_REF_NAME" "${assets[@]}" --repo "$GH_REPO" --clobber

docker:
needs: build-release
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Compute image metadata
id: meta
run: |
set -euo pipefail
IMAGE_NAME=$(printf '%s' "ghcr.io/coditary/beez" | tr '[:upper:]' '[:lower:]')
VERSION="${GITHUB_REF_NAME#v}"
CREATED=$(date -u +%Y-%m-%dT%H:%M:%SZ)
echo "image_name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "created=${CREATED}" >> "$GITHUB_OUTPUT"

- name: Log in to GHCR
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
printf '%s' "$GH_TOKEN" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin

- name: Enable QEMU
run: |
set -euo pipefail
docker run --privileged --rm tonistiigi/binfmt --install amd64,arm64

- name: Create buildx builder
run: |
set -euo pipefail
docker buildx create --name beez-builder --use
docker buildx inspect --bootstrap

- name: Build and push Docker image
run: |
set -euo pipefail
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg BEEZ_VERSION="${{ steps.meta.outputs.version }}" \
--build-arg BUILD_DATE="${{ steps.meta.outputs.created }}" \
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
-t "${{ steps.meta.outputs.image_name }}:${{ steps.meta.outputs.version }}" \
-t "${{ steps.meta.outputs.image_name }}:${GITHUB_REF_NAME}" \
-t "${{ steps.meta.outputs.image_name }}:latest" \
--push .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Build
build/
out/
dist/
.cache/
cmake-build-*/

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.24)

project(
Beez
VERSION 0.1.0
VERSION 1.0.3
DESCRIPTION "Beez - A modern C++ project"
HOMEPAGE_URL "https://github.com/Leodoras/Beez"
LANGUAGES CXX
Expand Down
81 changes: 81 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# syntax=docker/dockerfile:1.7

ARG UBUNTU_VERSION=24.04

FROM --platform=$BUILDPLATFORM ubuntu:${UBUNTU_VERSION} AS build

ARG DEBIAN_FRONTEND=noninteractive
ARG BEEZ_VERSION=1.0.2
ARG LLVM_VERSION=22
ARG UBUNTU_CODENAME=noble

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
curl \
git \
ninja-build \
pipx \
pkg-config \
python3 \
python3-venv \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN wget -qO- "https://apt.llvm.org/llvm-snapshot.gpg.key" \
| tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null \
&& echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-${LLVM_VERSION} main" \
> "/etc/apt/sources.list.d/llvm-${LLVM_VERSION}.list" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
"clang-${LLVM_VERSION}" \
"clang-tools-${LLVM_VERSION}" \
&& update-alternatives --install /usr/bin/clang clang "/usr/bin/clang-${LLVM_VERSION}" 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ "/usr/bin/clang++-${LLVM_VERSION}" 100 \
&& rm -rf /var/lib/apt/lists/*

ENV CC=clang \
CXX=clang++ \
PATH="/root/.local/bin:${PATH}"

RUN pipx install conan

WORKDIR /src
COPY . .

ENV RELEASE_PLATFORM=linux
RUN case "${TARGETARCH}" in \
amd64) export RELEASE_ARCH=x86_64 ;; \
arm64) export RELEASE_ARCH=aarch64 ;; \
*) echo "unsupported TARGETARCH=${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& chmod +x scripts/ci/release-build.sh scripts/ci/release-conan-profile.sh \
&& ./scripts/ci/release-build.sh

FROM ubuntu:${UBUNTU_VERSION} AS runtime

ARG DEBIAN_FRONTEND=noninteractive
ARG BEEZ_VERSION=1.0.2
ARG BUILD_DATE

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libtbb12 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --uid 10001 beez

COPY --from=build /src/build/build/Release/bin/beez /usr/local/bin/beez

LABEL org.opencontainers.image.title="Beez" \
org.opencontainers.image.description="Build and task orchestrator with Lua DSL" \
org.opencontainers.image.version="${BEEZ_VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.source="https://github.com/Coditary/Beez"

USER beez
WORKDIR /work

ENTRYPOINT ["/usr/local/bin/beez"]
CMD ["--help"]
12 changes: 6 additions & 6 deletions build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ reqpack {
{ name = "coditary/ctest", path = "./plugins/coditary/ctest", version = "1.0.0" },
{ name = "coditary/coverage", path = "./plugins/coditary/coverage", version = "1.0.0" },
{ name = "coditary/fuzzer", path = "./plugins/coditary/fuzzer", version = "1.0.0" },
{ name = "coditary/clang-build", path = "./plugins/coditary/clang-build", version = "1.0.0" },
{ name = "coditary/clang", path = "./plugins/coditary/clang", version = "1.0.0" },
{ name = "coditary/pipeline", path = "./plugins/coditary/pipeline", version = "1.0.0" },
},
}
Expand All @@ -37,21 +37,21 @@ configure({
{ "coditary/ctest", { reports_dir = REPORTS_DIR, test_rev = "4" } },
{ "coditary/coverage", { report_rev = "1" } },
{ "coditary/fuzzer", { fuzz_rev = "4" } },
{ "coditary/clang-build", { compile_rev = "4", link_rev = "10" } },
{ "coditary/clang", { compile_rev = "4", link_rev = "10" } },
})

-- ── Tasks ────────────────────────────────────────────────────────────────────

task("debug", {
{ plugin = "coditary/conan", step = "configure[debug]" },
{ plugin = "coditary/clang-build", step = "compile[debug]" },
{ plugin = "coditary/clang-build", step = "link[debug]" },
{ plugin = "coditary/clang", step = "compile[debug]" },
{ plugin = "coditary/clang", step = "link[debug]" },
})

task("fuzzer", {
{ plugin = "coditary/conan", step = "configure[fuzzer]" },
{ plugin = "coditary/clang-build", step = "compile[fuzzer]" },
{ plugin = "coditary/clang-build", step = "link[fuzzer]" },
{ plugin = "coditary/clang", step = "compile[fuzzer]" },
{ plugin = "coditary/clang", step = "link[fuzzer]" },
})

task("clean_reports", "rm -rf " .. REPORTS_DIR)
Expand Down
Loading
Loading