Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 16 additions & 58 deletions .github/workflows/check_formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,71 +18,29 @@ name: Check Formatting

on:
workflow_call:
inputs:
license_config:
description: "The license configuration file for SkyWalking Eyes"
type: string
required: false
default: ".licenserc.yaml"
cpp_source_dirs:
description: "Space seperated list of dirs to apply clang-format to"
type: string
required: false
default: "include src tests"
format_python:
description: "Whether or not to format python files"
type: boolean
required: false
default: true

jobs:
# Check licensing.
check_licensing:
if: inputs.license_config != ''
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Check for License Config
if: hashFiles(inputs.license_config) == ''
uses: actions/github-script@v3
with:
script: |
core.setFailed("License Config file doesn't exist: ${{inputs.license_config}}")
- name: Check License
uses: apache/[email protected]
with:
config: ${{ inputs.license_config }}
mode: check

# Check C++ formatting.
check_cpp_format:
if: inputs.cpp_source_dirs != ''
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Check C++ Formatting
uses: DoozyX/[email protected]
with:
source: ${{ inputs.cpp_source_dirs }}
extensions: "hpp,cpp,ipp,h,c"
clangFormatVersion: 20
inplace: False

# Check Python formatting.
check_python_format:
if: inputs.format_python == true
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- uses: actions/setup-python@v2
- name: Download .pre-commit-config.yaml
run: wget https://raw.githubusercontent.com/NWChemEx/pre-commit-config/master/.pre-commit-config.yaml
shell: bash
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install black
run: pip install black
- name: Create Python virtual environment
run: python -m venv venv
shell: bash
- name: Install pre-commit
run: |
source venv/bin/activate
pip install pre-commit
shell: bash
- name: Check Python Formatting
run: black --check --line-length=79 .
- name: Run pre-commit
run: |
source venv/bin/activate
pre-commit run --all-files
shell: bash
3 changes: 0 additions & 3 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ on:
jobs:
check_formatting:
uses: ./.github/workflows/check_formatting.yaml
with:
license_config: ".licenserc.yaml"
cpp_source_dirs: "" # Skip clang-format check

test_nwx_docs:
uses: ./.github/workflows/test_nwx_docs.yaml
Expand Down