Skip to content

Холин Кирилл. Лабораторная работа 1: Clang AST. Вариант 4. #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
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
17 changes: 17 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,20 @@ clang/test/AST/Interp/ @tbaederr
/llvm/**/DWARFLinker/ @JDevlieghere
/llvm/**/dsymutil/ @JDevlieghere
/llvm/**/llvm-dwarfutil/ @JDevlieghere

# BEGIN COMPILER COURSE
# CI
.github/** @aobolensk @Kuznetsov-Artyom

# Clang
/clang/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom
/clang/test/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom

# LLVM
/llvm/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom
/llvm/test/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom

# MLIR
/mlir/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom
/mlir/test/compiler-course/** @aobolensk @m-ly4 @Kuznetsov-Artyom
# END COMPILER COURSE
36 changes: 36 additions & 0 deletions .github/deadline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import sys
from github import Github
from datetime import datetime
from zoneinfo import ZoneInfo


def main():
moscow_tz = ZoneInfo("Europe/Moscow")
current_date = datetime.now(moscow_tz)
deadline_date = {
"lab:clang": datetime(2025, 6, 1, hour=19, tzinfo=moscow_tz),
"lab:llvm ir": datetime(2025, 6, 1, hour=19, tzinfo=moscow_tz),
"lab:backend": datetime(2025, 6, 1, hour=19, tzinfo=moscow_tz),
"lab:mlir": datetime(2025, 6, 1, hour=19, tzinfo=moscow_tz),
}

gh = Github(os.environ["GITHUB_TOKEN"])
repo = gh.get_repo(os.environ["GITHUB_REPOSITORY"])
pr = repo.get_pull(int(os.environ["PR_NUMBER"]))
labels = ["lab:clang", "lab:llvm ir", "lab:backend", "lab:mlir"]
lab_label = None

for label in pr.get_labels():
if label.name in labels:
lab_label = label.name

if not lab_label:
return

if current_date > deadline_date[lab_label]:
pr.add_to_labels("delayed")


if __name__ == "__main__":
sys.exit(main())
16 changes: 16 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'lab:clang':
- "clang/compiler-course/**"
'lab:llvm ir':
- "llvm/compiler-course/llvm-ir/**"
'lab:backend':
- "llvm/compiler-course/backend/**"
'lab:mlir':
- "mlir/compiler-course/**"

tests:
- "clang/test/compiler-course/**"
- "llvm/test/compiler-course/**"
- "mlir/test/compiler-course/**"

ci:
- ".github/**"
117 changes: 117 additions & 0 deletions .github/workflows/compiler-course-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build LLVM
on: [push, pull_request]

jobs:
ubuntu-gcc-build:
runs-on: ubuntu-latest
strategy:
matrix:
assertions: [ON, OFF]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup environment
run: |
sudo apt-get install -y \
build-essential \
ninja-build \
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 500M
key: ccache-${{ github.job }}
- name: Build
run: |
cmake -S llvm -B build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_ENABLE_ASSERTIONS=${{ matrix.assertions }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-G Ninja
cmake --build build --config Release -j $(nproc)
- name: Test
run: |
cmake --build build --config Release -t \
check-llvm-compiler-course \
check-clang-compiler-course \
check-mlir-compiler-course -j $(nproc)
macos-build:
runs-on: macOS-latest
strategy:
matrix:
assertions: [ON, OFF]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup environment
run: |
brew install \
ninja
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 500M
key: ccache-${{ github.job }}
- name: Build
run: |
cmake -S llvm -B build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_ENABLE_ASSERTIONS=${{ matrix.assertions }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-G Ninja
cmake --build build --config Release -j $(nproc)
- name: Test
run: |
cmake --build build --config Release -t \
check-llvm-compiler-course \
check-clang-compiler-course \
check-mlir-compiler-course -j $(nproc)
windows-build:
runs-on: windows-latest
strategy:
matrix:
assertions: [ON, OFF]
steps:
- name: Setup Windows
uses: llvm/actions/setup-windows@main
with:
arch: amd64
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- uses: actions/checkout@v4
with:
fetch-depth: 250
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 2G
variant: sccache
- name: Build
shell: bash
id: build-llvm
run: |
builddir="$(pwd)"/build
echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
cmake -G Ninja \
-B "$builddir" \
-S llvm \
-DLLVM_ENABLE_PROJECTS="clang" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=${{ matrix.assertions }} \
-DLLDB_INCLUDE_TESTS=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
${{ inputs.extra_cmake_args }}
ninja -C "$builddir" all
43 changes: 43 additions & 0 deletions .github/workflows/compiler-course-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Static analysis
on: [pull_request]

jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: |
sudo apt-get install -y clang-format
- name: Run clang-format
run: |
git-clang-format --diff `git merge-base ${GITHUB_SHA} ${GITHUB_BASE_REF}`
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update submodules
run: git submodule update --init --recursive
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}
- uses: aobolensk/[email protected]
id: review
with:
build_dir: build
cmake_command: cmake -S llvm -B build
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_PROJECTS='clang;mlir'
-DLLVM_ENABLE_ASSERTIONS=ON
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-G Ninja
config_file: .clang-tidy
apt_packages: build-essential,ninja-build
split_workflow: true
env:
CC: clang-19
CXX: clang++-19
28 changes: 28 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Label bot"
on:
- pull_request_target

jobs:
label-bot:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Add labels
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: ".github/labeler.yml"
dot: true
- name: Install PyGithub
run: |
pip3 install PyGithub
- name: Check deadline
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_NUMBER: ${{github.event.number}}
run: |
python3 .github/deadline.py
Loading