Skip to content

Commit

Permalink
ci, docker: Disaggregate Clang and LLVM versions
Browse files Browse the repository at this point in the history
Bump Clang version in next commit
  • Loading branch information
langston-barrett committed Oct 21, 2022
1 parent b26c4ac commit 5af10f7
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 26 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ env:
SPHINXOPTS: "-W --keep-going"
# This will be empty on events that aren't pull requests.
ACTUAL_GITHUB_SHA_ON_PULL_REQUEST: "${{ github.event.pull_request.head.sha }}"
# TODO(#12): Upgrade to Ubuntu 22.04 (jammy), Clang 15, LLVM 15
LLVM_VERSION: "10"
CLANG_VERSION: "10"
UBUNTU_VERSION: "20.04"
UBUNTU_NAME: "focal"

jobs:
doc:
runs-on: ubuntu-latest
runs-on: ubuntu-${UBUNTU_VERSION}
steps:
- uses: actions/checkout@v3

Expand All @@ -31,7 +36,7 @@ jobs:
publish_dir: doc/_build/html

build:
runs-on: ubuntu-latest
runs-on: ubuntu-${UBUNTU_VERSION}
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -115,7 +120,7 @@ jobs:
./scripts/gha-docker-build "dist" "cclyzerpp-dist"
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-${UBUNTU_VERSION}
steps:
- uses: actions/checkout@v3

Expand All @@ -137,7 +142,7 @@ jobs:
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -G Ninja -S . -B build
cmake -DCLANG_VERSION=${CLANG_VERSION} -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -G Ninja -S . -B build
docker run \
--rm \
Expand All @@ -147,7 +152,7 @@ jobs:
bash scripts/lint.sh
release:
runs-on: ubuntu-latest
runs-on: ubuntu-${UBUNTU_VERSION}
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,18 @@ endforeach()

# -----------------------------------------------------------------------------

if(NOT (DEFINED CLANG_VERSION))
set(CLANG_VERSION ${LLVM_VER})
endif()

find_program(
CLANG_TIDY
NAMES "clang-tidy" "clang-tidy-${LLVM_VER}"
NAMES "clang-tidy" "clang-tidy-${CLANG_VERSION}"
DOC "Path to clang-tidy executable.")

find_program(
CLANG_FORMAT
NAMES "clang-format" "clang-format-${LLVM_VER}"
NAMES "clang-format" "clang-format-${CLANG_VERSION}"
DOC "Path to clang-format executable.")

if(CLANG_TIDY)
Expand Down
4 changes: 2 additions & 2 deletions contrib/nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

pkgs.mkShell {
buildInputs = [
pkgs.clang_11
pkgs.clang_10
pkgs.cmake
pkgs.llvm_11
pkgs.llvm_10
pkgs.ninja
];
}
31 changes: 26 additions & 5 deletions doc/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,32 @@ Many thanks to the authors of cclyzer for their contributions! The cclyzer
license is included with the source distribution of cclyzer++ as
``LICENSE-cclyzer.txt``.

.. _tutorial: http://yanniss.github.io/points-to-tutorial15.pdf

Project Status
--------------

cclyzer++ is not currently actively developed or maintained by Galois, Inc.
Points of contact are: Langston Barrett (email: langston at galois dot com)
Scott Moore (email: scott at galois dot com).
cclyzer++ is actively developed and maintained by Galois, Inc. Points of contact
are: Langston Barrett (email: langston at galois dot com) Scott Moore (email:
scott at galois dot com).


Versioning
----------

Since v0.4.0, cclyzer++ has attempted to follow `semantic versioning 2.0.0
<semver>`_.

LLVM Library Version
********************

cclyzer++ currently builds against LLVM 10. There are plans to support multiple
versions and more recent versions.

Development Tools
*****************

cclyzer++ currently builds with Clang 10 (including other Clang tools such as
clang-format and clang-tidy). There are plans to build with more recent versions
of Clang.

.. _tutorial: http://yanniss.github.io/points-to-tutorial15.pdf
.. _semver: https://semver.org/spec/v2.0.0.html
27 changes: 16 additions & 11 deletions docker/dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
# Image with all cclyzer++ development tools, i.e., everything needed by
# cclyzer++ developers to build and test cclyzer++.

# TODO(#12): Upgrade to 22.04, LLVM 15
ARG BASE=ubuntu:20.04
FROM $BASE as dev
# TODO(#12): Upgrade to Ubuntu 22.04 (jammy), Clang 15, LLVM 15
ARG UBUNTU_NAME=focal
ARG UBUNTU_VERSION=20.04
FROM ubuntu:$UBUNTU_VERSION as dev
ARG CLANG_VERSION=10
ARG LLVM_VERSION=10
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG UBUNTU_NAME
ARG UBUNTU_VERSION
SHELL ["/bin/bash", "-c", "-o", "pipefail"]
ENV DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -41,19 +46,19 @@ RUN apt-get update && \
apt-get update && \
apt-get --yes install --no-install-recommends souffle && \
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | tee /etc/apt/sources.list.d/llvm.list && \
echo "deb http://apt.llvm.org/${UBUNTU_NAME}/ llvm-toolchain-${UBUNTU_NAME} main" | tee /etc/apt/sources.list.d/llvm.list && \
apt-get update && \
apt-get --yes install --no-install-recommends \
clang-${LLVM_VERSION} \
clang-format-${LLVM_VERSION} \
clang-tidy-${LLVM_VERSION} \
clang-${CLANG_VERSION} \
clang-format-${CLANG_VERSION} \
clang-tidy-${CLANG_VERSION} \
libomp-${LLVM_VERSION}-dev \
llvm-${LLVM_VERSION} \
llvm-${LLVM_VERSION}-dev && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${LLVM_VERSION} 60 && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${LLVM_VERSION} 60 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 60 && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 60 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${CLANG_VERSION} 60 && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} 60 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 60 && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 60 && \
update-alternatives --install /usr/bin/opt opt /usr/bin/opt-${LLVM_VERSION} 60 && \
rm -rf /var/lib/apt/lists/*
RUN gem install fpm -v 1.14.2
Expand Down
4 changes: 4 additions & 0 deletions scripts/gha-docker-build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ cd docker
docker build \
--file "${file}" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg "UBUNTU_NAME=${UBUNTU_NAME:?Please set UBUNTU_NAME}" \
--build-arg "CLANG_VERSION=${CLANG_VERSION:?Please set CLANG_VERSION}" \
--build-arg "LLVM_VERSION=${LLVM_VERSION:?Please set LLVM_VERSION}" \
--build-arg "UBUNTU_VERSION=${UBUNTU_VERSION:?Please set UBUNTU_VERSION}" \
--cache-from "${full_image_name}:${prev_ref}" \
--cache-from "${full_image_name}:main" \
--tag "${full_image_name}:${ref}" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eo pipefail

for f in ./src/*.cpp ./FactGenerator/**/*.cpp; do
clang-format-10 "${f}" | diff "${f}" -
"clang-format-${CLANG_VERSION}" "${f}" | diff "${f}" -
done

if ! [[ -f build/compile_commands.json ]]; then
Expand Down

0 comments on commit 5af10f7

Please sign in to comment.