Skip to content

[core] only install vc modulemap if ROOT built with VC support #20394

[core] only install vc modulemap if ROOT built with VC support

[core] only install vc modulemap if ROOT built with VC support #20394

Workflow file for this run

name: code analysis
on: pull_request
# push:
# branches: [ $default-branch ]
# pull_request:
# branches: [ $default-branch ]
permissions:
contents: read
jobs:
clang-format:
# For any event that is not a PR, the CI will always run. In PRs, the CI
# can be skipped if the tag [skip-ci] is written in the title.
if: |
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.title, '[skip-ci]'))
runs-on: ubuntu-latest
env:
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
steps:
- uses: actions/checkout@v4
- name: Fetch base sha
run: git fetch --depth=1 origin +${{github.event.pull_request.base.sha}}:origin/base_sha
- name: install clang-format
run: sudo apt-get install -y clang-format
- name: run clang-format script
run: .ci/format_script.sh
ruff:
if: |
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.title, '[skip-ci]'))
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get the list of changed files
id: diff
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
git diff --name-only origin/$GITHUB_BASE_REF > changed_files.txt
- name: Install ruff
uses: astral-sh/ruff-action@v3
with:
args: "--version"
- name: Lint code
run: |
files=$(cat changed_files.txt | grep '\.py$' || echo "")
if [ -n "$files" ]; then
echo "$files" | xargs ruff check --diff || true
echo "$files" | xargs ruff check
else
echo "No python files to lint"
fi
- name: Format code
if: always()
run: |
files=$(cat changed_files.txt | grep '\.py$' || echo "")
if [ -n "$files" ]; then
diff_command=""
apply_command=""
for file in $files; do
while IFS=- read -r start length; do
[ -z "$start" ] && continue
length=${length:-1}
end=$((start + length))
diff_command+="ruff format --diff --range $start-$end $file && "
apply_command+="ruff format --range $start-$end $file && "
done < <(git diff --unified=0 origin/$GITHUB_BASE_REF "$file" | grep '^@@' | sed -E 's/^@@ -[0-9]+(,[0-9]+)? \+([0-9]+)(,([0-9]+))? @@.*/\2-\4/')
done
if [ -n "$diff_command" ]; then
diff_command=${diff_command% && }
if ! eval "$diff_command"; then
apply_command=${apply_command% && }
echo -e "::error::Formatting failed. To apply the changes locally, run the following command:\n$apply_command"
exit 123
fi
else
echo "No ranges detected to format."
fi
else
echo "No python files to format"
fi