Skip to content

Commit

Permalink
test: run test as seperate job
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarak committed Sep 3, 2024
1 parent f9335e3 commit 86407de
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 59 deletions.
60 changes: 1 addition & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ jobs:
submodules: true
fetch-depth: 1

- name: Cache repository
uses: actions/cache@v3
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-repo-${{ github.sha }}

- name: Configure build - sanitizers ${{ matrix.sanitizers }}
run: cmake --preset ci

Expand All @@ -63,56 +57,4 @@ jobs:
#- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
# run: |
# cmake --preset ci
# ctest --preset ci --build-config ${{ matrix.build-type }}

test:
needs: build
strategy:
matrix:
llvm-version: [18]
image-version: [22.04]
build-type: [Release, Debug]
sanitizers: [ON, OFF]
runs-on: ubuntu-${{ matrix.image-version }}
env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}

steps:
- name: Restore cached repository
uses: actions/cache@v3
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-repo-${{ github.sha }}

- name: Install CTest dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
software-properties-common \
ninja-build python3-pip \
ccache cmake lld lcov \
doxygen libzstd-dev
curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh
sudo apt-get -y purge llvm-14 clang-14
pip3 install lit codespell jinja2 Pygments
curl -fsSL https://apt.llvm.org/llvm.sh -o llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh ${{ matrix.llvm-version }} all && \
rm llvm.sh
sudo apt-get install libmlir-${{ matrix.llvm-version }}-dev mlir-${{ matrix.llvm-version }}-tools
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.llvm-version }} 60
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.llvm-version }} 60
sudo ln -s /usr/bin/FileCheck-${{ matrix.llvm-version }} /usr/bin/FileCheck
- name: Run CTest
run: |
cmake --preset ci
ctest --preset ci --build-config ${{ matrix.build-type }}
# ctest --preset ci --build-config ${{ matrix.build-type }}
68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright (c) 2024, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
#

name: Test

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
test:
strategy:
matrix:
llvm-version: [18]
image-version: [22.04]
build-type: [Release, Debug]
sanitizers: [ON, OFF]
runs-on: ubuntu-${{ matrix.image-version }}
env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}

steps:
- name: Clone the Patchestry repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1

- name: Install CTest dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
software-properties-common \
ninja-build python3-pip \
ccache cmake lld lcov \
doxygen libzstd-dev
curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh
sudo apt-get -y purge llvm-14 clang-14
pip3 install lit codespell jinja2 Pygments

curl -fsSL https://apt.llvm.org/llvm.sh -o llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh ${{ matrix.llvm-version }} all && \
rm llvm.sh

sudo apt-get install libmlir-${{ matrix.llvm-version }}-dev mlir-${{ matrix.llvm-version }}-tools
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.llvm-version }} 60
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.llvm-version }} 60
sudo ln -s /usr/bin/FileCheck-${{ matrix.llvm-version }} /usr/bin/FileCheck

- name: Run CTest
run: |
cmake --preset ci
ctest --preset ci --build-config ${{ matrix.build-type }}

0 comments on commit 86407de

Please sign in to comment.