Skip to content

Commit

Permalink
Split source checks into a seperate workflow
Browse files Browse the repository at this point in the history
The "Build - Ubuntu" job has a stage that checks the source generated
from the spec matches the version stored in the repo. This is the
part of the job that takes the longest, and is ran multiple times.

Since it doesn't require a build, it has been brought out into its own
workflow which is only ran once. This should hopefully speed up builds.
  • Loading branch information
RossBrunton committed Oct 1, 2024
1 parent 675dd29 commit 002fd32
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 19 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y doxygen ${{matrix.compiler.c}}
sudo apt-get install -y ${{matrix.compiler.c}}
- name: Install libhwloc
run: .github/scripts/install_hwloc.sh
Expand All @@ -62,9 +62,6 @@ jobs:
run: |
sudo apt-get install -y ${{matrix.compiler.cxx}}
- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Install libbacktrace
if: matrix.libbacktrace == '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
run: |
Expand Down Expand Up @@ -93,7 +90,7 @@ jobs:
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUR_FORMAT_CPP_STYLE=OFF
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
Expand All @@ -109,18 +106,11 @@ jobs:
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUR_FORMAT_CPP_STYLE=OFF
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
${{matrix.latency_tracking}}
- name: Generate source from spec, check for uncommitted diff
if: matrix.os == 'ubuntu-22.04'
run: cmake --build ${{github.workspace}}/build --target check-generated

- name: Verify that each source file contains a license
run: cmake --build ${{github.workspace}}/build --target verify-licenses

- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)

Expand Down Expand Up @@ -285,11 +275,6 @@ jobs:
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.adapter.var}}
# TODO: re-enable when check-generated is fixed for windows runners see #888
# - name: Generate source from spec, check for uncommitted diff
# if: matrix.os == 'windows-2022'
# run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}}

- name: Build all
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS

Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/source-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Source Checks

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
# To kill the job
actions: write

jobs:
source-checks:
name: Source Checks
# TODO: Make this run on Windows (#888)
runs-on: 'ubuntu-22.04'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y doxygen
- name: Setup PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install pip packages
run: pip install -r third_party/requirements.txt

# Required for CMake
- name: Install libhwloc
run: .github/scripts/install_hwloc.sh

- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DUR_ENABLE_TRACING=OFF
-DCMAKE_BUILD_TYPE=Debug
-DUR_BUILD_TESTS=OFF
-DUR_FORMAT_CPP_STYLE=ON
- name: Verify that each source file contains a license
run: cmake --build ${{github.workspace}}/build --target verify-licenses

- name: Verify source is clang-formatted
run: cmake --build ${{github.workspace}}/build --target check-clang-format

- name: Generate source from spec, check for uncommitted diff
run: cmake --build ${{github.workspace}}/build --target check-generated

- name: Kill job on failure
run: gh run cancel ${{ github.run_id }}
if: ${{ failure() }}
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ if(UR_FORMAT_CPP_STYLE)
COMMAND git diff --exit-code
DEPENDS generate
)

add_custom_target(check-clang-format
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND git diff --exit-code
DEPENDS cppformat
)
else()
message(STATUS " UR_FORMAT_CPP_STYLE not set. Targets: 'generate' and 'check-generated' are not available")
endif()
3 changes: 2 additions & 1 deletion source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo(
) {
ur_result_t result = UR_RESULT_SUCCESS;

[[maybe_unused]] auto context = getContext();
[[maybe_unused]] auto context =
getContext();

// extract platform's function pointer table
auto dditable = reinterpret_cast<ur_device_object_t *>(hDevice)->dditable;
Expand Down

0 comments on commit 002fd32

Please sign in to comment.