Skip to content

Commit

Permalink
Update to Clang 15 and add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dc-mak committed Nov 2, 2024
1 parent 4964af4 commit a0f59e3
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 262 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
pull_request:
push:
branches:
- main
- cheri-tests

# cancel in-progress job when a new push is performed
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
version: [4.14.1]


runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

# clang-15 seems to be required for ClangConfig.cmake
# libclang-14-dev and libclang-cpp14-dev seem to be for the opam conf-libclang package
# llvm-15-dev seems to be for the LLVM cmake files/package
- name: System dependencies (ubuntu)
run: |
sudo apt-get install clang-15 cmake libclang-14-dev libclang-15-dev libclang-cpp14-dev llvm-15-dev opam python3
- name: Restore cached opam
id: cache-opam-restore
uses: actions/cache/restore@v4
with:
path: ~/.opam
key: ${{ matrix.version }}

- name: Setup opam
if: steps.cache-opam-restore.outputs.cache-hit != 'true'
run: |
opam init --yes --no-setup --shell=sh --compiler=${{ matrix.version }}
opam install --with-test --deps-only --yes .
- name: Save cached opam
if: steps.cache-opam-restore.outputs.cache-hit != 'true'
id: cache-opam-save
uses: actions/cache/save@v4
with:
path: ~/.opam
key: ${{ steps.cache-opam-restore.outputs.cache-primary-key }}

- name: Install c-tree-carver
run: |
opam switch ${{ matrix.version }}
eval $(opam env --switch=${{ matrix.version }})
opam install --with-test --yes .
- name: Run CI tests
run: |
opam switch ${{ matrix.version }}
eval $(opam env --switch=${{ matrix.version }})
dune runtest && cd cpp && python3 ./test/run_test.py make && python3 ./test/run_test.py for --carver clang-tree-carve.exe
97 changes: 0 additions & 97 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions c-tree-carver.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ authors: ["Dhruv Makwana <[email protected]"]
license: ["MIT" "BSD-2-Clause"]
tags: ["topics" "c" "clang" "tool" "tree-carving"]
homepage: "https://github.com/rems-project/c-tree-carver"
doc: "https://github.com/rems-project/c-tree-carver"
bug-reports: "https://github.com/rems-project/c-tree-carver/issues"
depends: [
"dune" {>= "3.7"}
"ocaml" {>= "4.12.0"}
"ocaml" {>= "4.14.1"}
"conf-c++"
"conf-cmake" {dev}
"conf-llvm" {= "12.0.1"}
"conf-python3" {with-test}
"conf-libclang" {= "15"}
"conf-python-3" {with-test}
"fileutils" {>= "0.6.4"}
"shexp" {>= "v0.15.0"}
"ocamlformat" {>= "0.25.1" & dev}
Expand Down
28 changes: 0 additions & 28 deletions conf-libclang-12-dev.opam

This file was deleted.

26 changes: 0 additions & 26 deletions conf-libclang-12-dev.opam.template

This file was deleted.

11 changes: 10 additions & 1 deletion cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@
cmake_minimum_required(VERSION 3.16.3)
project(clang-tree-carver)

find_package(LLVM "12.0.0" REQUIRED CONFIG)
find_package(LLVM "15.0.7" REQUIRED CONFIG)
# Not sure what the correct/idiomatic CMake is for a situation where packages
# aren't version but CMake defaults to a wrong but earlier one instead of a
# correct later one.
# /usr/lib/cmake/clang-12/ClangConfig.cmake, version: unknown
# /usr/lib/cmake/clang-15/ClangConfig.cmake, version: unknown
# /lib/cmake/clang-12/ClangConfig.cmake, version: unknown
# /lib/cmake/clang-15/ClangConfig.cmake, version: unknown
# So I'm hard-coding it.
set(Clang_DIR "/usr/lib/cmake/clang-15")
find_package(Clang REQUIRED CONFIG)

set(CLANG_LIBS
Expand Down
13 changes: 4 additions & 9 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

(license MIT BSD-2-Clause)

; (documentation https://url/to/documentation)
(documentation https://github.com/rems-project/c-tree-carver)

(package
(name c-tree-carver)
(synopsis "Clang-based tool for tree-carving C source trees")
(description "")
(depends
(ocaml (>= 4.12.0))
(ocaml (>= 4.14.1))
conf-c++
(conf-cmake :dev)
(conf-llvm (= 12.0.1))
(conf-python3 :with-test)
(conf-libclang (= 15))
(conf-python-3 :with-test)
(fileutils (>= 0.6.4))
(shexp (>= v0.15.0))
(ocamlformat (and (>= 0.25.1) :dev))
Expand All @@ -34,11 +34,6 @@
(tags
(topics c clang tool tree-carving)))

(package
(name conf-libclang-12-dev)
(allow_empty))


(formatting)

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
98 changes: 0 additions & 98 deletions files/configure.sh

This file was deleted.

0 comments on commit a0f59e3

Please sign in to comment.