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
95 changes: 95 additions & 0 deletions .github/actions/build-container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build Container
description: >-
Build and test a container using the standard llvm naming scheme for containers.

inputs:
tag:
description: >-
The tag to use for this container.
required: false
container-name:
description: >-
The name for the container.
required: true
dockerfile:
description: >-
Path to docker file.
required: false
target:
description: >-
The container target to build 'passed to podman via ---target option'
required: false
context:
description: >-
Path to context for the container build.
required: false
test-command:
description: >-
Test command to run to ensure the container is working correctly.
required: false

runs:
using: "composite"
steps:
# podman is not installed by default on the ARM64 images.
- name: Install Podman
if: runner.arch == 'ARM64'
shell: bash
run: |
sudo apt-get install podman

- name: Build Container
shell: bash
env:
INPUT_TAG: ${{inputs.tag }}
INPUT_CONTAINER_NAME: ${{ inputs.container-name }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_DOCKERFILE: ${{ inputs.dockerfile }}
INPUT_CONTEXT: ${{ inputs.context }}
id: build
run: |
env
tag="${INPUT_TAG:-$(git rev-parse --short=12 HEAD)}"

case "$RUNNER_ARCH" in
ARM64)
container_arch="arm64v8"
;;
*)
container_arch="amd64"
;;
esac

container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/$container_arch/$INPUT_CONTAINER_NAME:$tag"
container_filename="$(echo $container_name | sed -e 's/\//-/g' -e 's/:/-/g').tar"
if [ -n "$INPUT_TARGET" ]; then
podman_options="$podman_options --target $INPUT_TARGET"
fi
if [ -n "$INPUT_DOCKERFILE" ]; then
podman_options="$podman_options -f $INPUT_DOCKERFILE"
fi
podman_options="$podman_options ${INPUT_CONTEXT:-.}"
echo "Podman Options: $podman_options"

podman build -t $container_name $podman_options

podman save $container_name > $container_filename

echo "container-full-name=$container_name" >> $GITHUB_OUTPUT

- name: Create container artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ inputs.container-name }}-${{ runner.arch }}
path: "*.tar"
retention-days: 14

- name: Test container
shell: bash
if: inputs.test-command
env:
INPUT_TEST_COMMAND: ${{ inputs.test-command }}
CONTAINER_FULL_NAME: ${{ steps.build.outputs.container-full-name }}
run: |
podman run --pull=never --rm -it $CONTAINER_FULL_NAME /usr/bin/bash -x -c "$INPUT_TEST_COMMAND"

44 changes: 44 additions & 0 deletions .github/actions/push-container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Push Container
description: >-
Download all container artifacts for this job and push them to the GitHub registry.

inputs:
token:
description: >-
Token to use to authenticate with the container registry.
required: true

runs:
using: "composite"
steps:
- name: Download container
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0

- name: Push Container
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
run: |
function push_container {
image_name=$1
latest_name=$(echo $image_name | sed 's/:[a-f0-9]\+$/:latest/g')
podman tag $image_name $latest_name
echo "Pushing $image_name ..."
podman push --compression-format=zstd $image_name
echo "Pushing $latest_name ..."
podman push --compression-format=zstd $latest_name
}

podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
for f in $(find . -iname '*.tar'); do
image_name=$(podman load -q -i $f | sed 's/Loaded image: //g')
push_container $image_name

if echo $image_name | grep '/amd64/'; then
# For amd64, create an alias with the arch component removed.
# This matches the convention used on dockerhub.
default_image_name=$(echo $(dirname $(dirname $image_name))/$(basename $image_name))
podman tag $image_name $default_image_name
push_container $default_image_name
fi
done
79 changes: 79 additions & 0 deletions .github/instructions/lldb.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
applyTo: lldb/**/*
---

When reviewing code, focus on:

## Language, Libraries & Standards

- Target C++17 and avoid vendor-specific extensions.
- For Python scripts, follow PEP 8.
- Prefer standard library or LLVM support libraries instead of reinventing data structures.

## Comments & Documentation

- Each source file should include the standard LLVM file header.
- Header files must have proper header guards.
- Non-trivial classes and public methods should have Doxygen documentation.
- Use `//` or `///` comments normally; avoid block comments unless necessary.
- Non-trivial code should have comments explaining what it does and why. Avoid comments that explain how it does it at a micro level.

## Language & Compiler Issues

- Write portable code; wrap non-portable code in interfaces.
- Do not use RTTI or exceptions.
- Prefer C++-style casts over C-style casts.
- Do not use static constructors.
- Use `class` or `struct` consistently; `struct` only for all-public data.
- When then same class is declared or defined multiple times, make sure it's consistently done using either `class` or `struct`.

## Headers & Library Layering

- Include order: module header → local/private headers → project headers → system headers.
- Headers must compile standalone (include all dependencies).
- Maintain proper library layering; avoid circular dependencies.
- Include minimally; use forward declarations where possible.
- Keep internal headers private to modules.
- Use full namespace qualifiers for out-of-line definitions.

## Control Flow & Structure

- Prefer early exits over deep nesting.
- Do not use `else` after `return`, `continue`, `break`, or `goto`.
- Encapsulate loops that compute predicates into helper functions.

## Naming

- LLDB's code style differs from LLVM's coding style.
- Variables are `snake_case`.
- Functions and methods are `UpperCamelCase`.
- Static, global and member variables have `s_`, `g_` and `m_` prefixes respectively.

## General Guidelines

- Use `assert` liberally; prefer `llvm_unreachable` for unreachable states.
- Do not use `using namespace std;` in headers.
- Provide a virtual method anchor for classes defined in headers.
- Do not use default labels in fully covered switches over enumerations.
- Use range-based for loops wherever possible.
- Capture `end()` outside loops if not using range-based iteration.
- Including `<iostream>` is forbidded. Use LLVM’s `raw_ostream` instead.
- Don’t use `inline` when defining a function in a class definition.

## Microscopic Details

- Preserve existing style in modified code.
- Prefer pre-increment (`++i`) when value is unused.
- Use `private`, `protected`, or `public` keyword as appropriate to restrict class member visibility.
- Omit braces for single-statement `if`, `else`, `while`, `for` unless needed.

## Review Style

- Be specific and actionable in feedback.
- Explain the "why" behind recommendations.
- Link back to the LLVM Coding Standards: https://llvm.org/docs/CodingStandards.html.
- Ask clarifying questions when code intent is unclear.

Ignore formatting and assume that's handled by external tools like `clang-format` and `black`.
Remember that these standards are **guidelines**.
Always prioritize consistency with the style that is already being used by the surrounding code.
8 changes: 8 additions & 0 deletions .github/instructions/llvm.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
applyTo: llvm/**/*
---

When performing a code review, pay close attention to code modifying a function's
control flow. Could the change result in the corruption of performance profile
data? Could the change result in invalid debug information, in particular for
branches and calls?
Loading
Loading