CI: Add IWYU (include what you use) action. #3248
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: lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- '/.*' | |
- '/_*' | |
- '!.clang-format' | |
- 'Brewfile' | |
- 'docs/**' | |
- '**.adoc' | |
- '**.md' | |
- '**.nix' | |
- 'flake.lock' | |
jobs: | |
clang-format: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- uses: DoozyX/[email protected] | |
with: | |
clangFormatVersion: 11.0.0 | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- uses: ludeeus/action-shellcheck@master | |
with: | |
scandir: './ci' | |
env: | |
SHELLCHECK_OPTS: -x | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Actions Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- uses: crate-ci/typos@master | |
version-cmake-up-to-date: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: rnp | |
- name: Download latest version.cmake | |
uses: actions/checkout@v4 | |
with: | |
repository: rnpgp/cmake-versioning | |
fetch-depth: 1 | |
path: cmake-versioning | |
- name: Compare | |
run: | | |
set -x | |
diff "rnp/cmake/version.cmake" "cmake-versioning/version.cmake" | |
version-text: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
timeout-minutes: 3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: rnp | |
sparse-checkout: version.txt | |
- name: Check version.txt contents | |
run: | | |
set -eux | |
pwd | |
[[ "$(cat ./rnp/version.txt)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; | |
iwyu: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Actions Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update | |
sudo apt-get -y install cmake libjson-c-dev libbotan-2-dev asciidoctor googletest | |
- name: Configure | |
run: | | |
echo CORES="$(nproc --all)" >> $GITHUB_ENV | |
cmake -B build -DBUILD_SHARED_LIBS=ON \ | |
-DCRYPTO_BACKEND=botan \ | |
-DDOWNLOAD_GTEST=OFF \ | |
-DGTEST_SOURCES=/usr/src/googletest \ | |
-DCMAKE_BUILD_TYPE=Release . | |
- name: Build and cwd | |
run: | | |
cmake --build build --parallel 2 | |
cd build | |
- name: Run Include What You Use | |
uses: EmilGedda/[email protected] | |