[DO NOT MERGE] ci: PR Linters: add lightweight scans #622
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
# ******************************************************************************* | |
# Copyright 2024 Arm Limited and affiliates. | |
# Copyright 2024 Intel Corporation | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ******************************************************************************* | |
name: "PR Linters" | |
on: | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
# Declare default permissions as read only. | |
permissions: read-all | |
# Kill stale checks | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
pr-formatting: | |
name: Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Check commit messages | |
run: python3 ./.github/automation/commit-msg-check.py "${{ github.event.pull_request.head.sha }}" "${{ github.event.pull_request.base.sha }}" | |
- name: Install clang-format | |
run: sudo apt update && sudo apt install -y "clang-format-11" | |
- name: Check code formatting | |
run: .github/automation/clang-format.sh | |
- name: Install gcc | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | |
sudo apt update -y | |
sudo apt install -y g++-13 | |
- name: Install clang | |
uses: KyleMayes/install-llvm-action@e0a8dc9cb8a22e8a7696e8a91a4e9581bec13181 | |
with: | |
version: "17" | |
- name: Get latest CMake | |
uses: lukka/get-cmake@acb35cf920333f4dc3fc4f424f1b30d5e7d561b4 # 3.31.4 | |
with: | |
cmakeVersion: 3.31.0 | |
- name: Install castxml package | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --no-cache-dir --disable-pip-version-check castxml | |
- name: Build oneDNN | |
run: ${{ github.workspace }}/oneDNN/.github/automation/build.sh --build-dir ${{ github.workspace }}/oneDNN/build | |
working-directory: ${{ github.workspace }}/oneDNN | |
env: | |
ONEDNN_ACTION: build | |
- name: format-tags check | |
run: | | |
source venv/bin/activate | |
castxml --castxml-cc-gnu-c clang --castxml-output=1 -I${{ github.workspace }}/oneDNN/include -I${{ github.workspace }}/oneDNN/build/include ${{ github.workspace }}/oneDNN/include/oneapi/dnnl_types.h -o ${{ github.workspace }}/oneDNN/logs/types.xml | |
python ${{ github.workspace }}/oneDNN/scripts/generate_dnnl_debug.py ${{ github.workspace }}/oneDNN/logs/types.xml | |
python ${{ github.workspace }}/oneDNN/scripts/generate_format_tags.py | |
diff --git ${{ github.workspace }}/oneDNN/include/oneapi/dnnl/dnnl_debug.h ${{ github.workspace }}/oneDNN/build/include/oneapi/dnnl/dnnl_debug.h |