adopting some best practices for cmake #2627
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: linux | |
on: | |
push: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-and-test: | |
name: Build and test ${{matrix.build-type}} mode | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build-type: [Debug, Release] | |
steps: | |
- name: Clone recursively | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Cache LLVM and Clang | |
id: cache-llvm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./llvm | |
key: llvm-14.0.0-ubuntu | |
- name: Install LLVM and Clang | |
uses: KyleMayes/[email protected] | |
with: | |
version: "14.0.0" | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
- name: Install FileCheck | |
uses: i3h/download-release-asset@v1 | |
with: | |
owner: fodinabor | |
repo: FileCheckBuild | |
tag: latest | |
file: FileCheck-x86_64-ubuntu | |
path: ${{github.workspace}}/bin | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install newest g++, valgrind | |
run: | | |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install g++-11 valgrind | |
export CXX=g++-11 | |
sudo python -m pip install lit psutil | |
sudo ln -s ${{github.workspace}}/bin/FileCheck-x86_64-ubuntu /usr/bin/FileCheck | |
sudo chmod +x /usr/bin/FileCheck | |
- name: Setup ccache | |
uses: Chocobo1/setup-ccache-action@v1 | |
with: | |
update_packager_index: false | |
ccache_options: max_size=500M | |
override_cache_key: ubuntu-latest-ccache-${{matrix.build-type}} | |
- name: Configure Debug | |
if: matrix.build-type == 'Debug' | |
run: CXX=g++-11 cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBUILD_TESTING=ON -DTHORIN_BUILD_EXAMPLES=ON | |
- name: Configure Release | |
if: matrix.build-type == 'Release' | |
run: CXX=g++-11 cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBUILD_TESTING=ON -DTHORIN_BUILD_EXAMPLES=ON -DTHORIN_LIT_WITH_VALGRIND=ON | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build -v | |
- name: Run lit test suite | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build ${{github.workspace}}/build -v --target check | |
- name: Test with Valgrind | |
working-directory: ${{github.workspace}}/build | |
run: ctest --verbose -C ${{matrix.build-type}} --output-on-failure -T memcheck |