Skip to content

Dependency image refactor #346

Dependency image refactor

Dependency image refactor #346

Workflow file for this run

name: Run Linter
on:
pull_request:
concurrency:
group: linter-${{ github.ref }}
cancel-in-progress: true
jobs:
waitForDependencyImage:
name: Wait for dependency image
runs-on: ubuntu-latest
steps:
- name: Wait
uses: lewagon/[email protected]
with:
ref: ${{ github.sha }}
running-workflow-name: "Dependency Image"
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 3
linter:
name: Build And Run linter
needs: waitForDependencyImage
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.number }}
container:
image: ghcr.io/genspectrum/lapis-silo-dependencies:commit-${{ github.sha }}"
steps:
- uses: actions/checkout@v4
- shell: bash
name: Configure and run clang-tidy on changed files
run: |
mv /src/build .
cmake -DBUILD_WITH_CLANG_TIDY=on -D CMAKE_BUILD_TYPE=Debug -B build/Debug
echo "Successfully configured cmake"
files=""
PAGE=1
while true; do
page_files=$(curl -s \
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}/files?per_page=100&page=$PAGE" \
| jq -r '.[] | select(.status != "removed") | .filename')
# If there are no more files, break the loop
if [[ -z "$page_files" ]]; then
break
fi
files+="$page_files"$'\n'
PAGE=$((PAGE + 1))
done
echo "Changed files of this PR:"
echo "$files"
IFS=$'\n'
for file in $files; do
echo "Check ending for file: $file"
if [[ $file == *.cpp ]]; then
echo "Now linting the file: $file"
echo "cmake --build build/Debug --target ${file%.cpp}.o"
cmake --build build/Debug --target ${file%.cpp}.o
fi
done