forked from Open-Cascade-SAS/OCCT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
// temp changes just for check clang-tidy
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Insecure workflow with limited permissions that should provide analysis results through an artifact | ||
name: Static analysis | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
clang-tidy: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
- name: Fetch base branch | ||
run: | | ||
git remote add upstream "https://github.com/${{ github.event.pull_request.base.repo.full_name }}" | ||
git fetch --no-tags --no-recurse-submodules upstream "${{ github.event.pull_request.base.ref }}" | ||
- name: Install clang-tidy | ||
|
||
run: sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake clang clang-tidy make libbtbb-dev libx11-dev libglu1-mesa-dev | ||
|
||
- name: Prepare compile_commands.json | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake -G "Unix Makefiles" \ | ||
-D CMAKE_C_COMPILER=clang \ | ||
-D CMAKE_CXX_COMPILER=clang++ \ | ||
-D USE_FREETYPE=OFF \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. | ||
- name: Create results directory | ||
run: | | ||
mkdir clang-tidy-result | ||
- name: Analyze | ||
run: | | ||
git diff -U0 "$(git merge-base HEAD "upstream/${{ github.event.pull_request.base.ref }}")" | clang-tidy-diff -p1 -path build -export-fixes clang-tidy-result/fixes.yml | ||
- name: Save PR metadata | ||
run: | | ||
echo "${{ github.event.number }}" > clang-tidy-result/pr-id.txt | ||
echo "${{ github.event.pull_request.head.repo.full_name }}" > clang-tidy-result/pr-head-repo.txt | ||
echo "${{ github.event.pull_request.head.sha }}" > clang-tidy-result/pr-head-sha.txt | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: clang-tidy-result | ||
path: clang-tidy-result/ |
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
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