81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
name: IWYU CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
schedule:
|
|
# Run build of master at 03:38 every day
|
|
- cron: '38 3 * * *'
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
env:
|
|
LLVM_TAG:
|
|
|
|
steps:
|
|
- name: Install prerequisites
|
|
run: |
|
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
|
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy$LLVM_TAG main"
|
|
sudo apt update
|
|
# Remove any base dist LLVM/Clang installations
|
|
sudo apt remove -y \
|
|
"libclang*" \
|
|
"clang*" \
|
|
"llvm*"
|
|
# Reinstall tagged versions
|
|
sudo apt install -y \
|
|
ninja-build \
|
|
llvm$LLVM_TAG-dev \
|
|
libclang$LLVM_TAG-dev \
|
|
clang$LLVM_TAG
|
|
|
|
- name: Select checkout ref (PR)
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
echo "IWYU_CHECKOUT_REF=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
|
|
|
|
- name: Select checkout ref (push/schedule)
|
|
if: github.event_name == 'push' || github.event_name == 'schedule'
|
|
run: |
|
|
echo "IWYU_CHECKOUT_REF=${{github.sha}}" >> $GITHUB_ENV
|
|
|
|
- name: Check out branch
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{env.IWYU_CHECKOUT_REF}}
|
|
|
|
- name: Build include-what-you-use
|
|
run: |
|
|
mkdir build
|
|
cd ./build
|
|
cmake -G Ninja \
|
|
-DCMAKE_C_COMPILER=clang$LLVM_TAG \
|
|
-DCMAKE_CXX_COMPILER=clang++$LLVM_TAG \
|
|
-DCMAKE_INSTALL_PREFIX=./ \
|
|
../
|
|
ninja
|
|
|
|
- name: Test include-what-you-use
|
|
run: |
|
|
cd ./build
|
|
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 6
|
|
|
|
- name: Test install
|
|
run: |
|
|
cd ./build
|
|
cmake --install .
|
|
|
|
- name: Check license headers
|
|
run: |
|
|
git ls-tree --full-tree --name-only -r HEAD | \
|
|
xargs ./iwyu-check-license-header.py
|