Skip to content

Switch to cpp-linter/clang-tools-static-binaries #233

Switch to cpp-linter/clang-tools-static-binaries

Switch to cpp-linter/clang-tools-static-binaries #233

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
on:
pull_request:
branches: [ "main" ]
paths:
- "**.py"
- "**requirements*.txt"
- pyproject.toml
- setup.py
- .pre-commit-config.yaml
- ".github/workflows/python-test.yml"
- "!docs/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install . -r requirements-dev.txt
- name: Run pre-commit
run: pre-commit run --all-files
- name: Collect coverage
run: |
coverage run -m pytest -vv
coverage report -m
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
verbose: true # optional (default = false)
- name: Build wheel
run: python -m pip wheel -w dist .
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: clang-tools-pip_wheel
path: dist/*.whl
install:
needs: [build]
strategy:
matrix:
version: [ 7, 8, 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
name: clang-tools-pip_wheel
path: dist/
- name: Install pkg from wheel
# using a wildcard as filename on Windows requires a bash shell
shell: bash
run: pip install dist/*.whl
- name: Install clang-tools
run: clang-tools --install ${{ matrix.version }}
- name: Show path of binaries
shell: bash
run: |
if [ "${{ matrix.version }}" = "15" -o "${{ matrix.version }}" = "16" ] && [ "${{ matrix.os }}" = "windows-latest" ]; then
which clang-format
which clang-tidy
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
which "clang-format-${{ matrix.version }}"
which "clang-tidy-${{ matrix.version }}"
fi
- name: Check clang-tools on Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
case "${{ matrix.version }}" in
15|16)
clang-format.exe --version
clang-tidy.exe --version
;;
*)
clang-format-${{ matrix.version }}.exe --version
clang-tidy-${{ matrix.version }}.exe --version
;;
esac
- name: Check clang-tools on Unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
if [ "${{ matrix.version }}" = "12.0.1" -a "${{ matrix.os }}" = "ubuntu-latest" ]; then
clang-format-12.0.1 --version
clang-tidy-12.0.1 --version
else
clang-format-${{ matrix.version }} --version
case "${{ matrix.version }}" in
14|15|16)
echo "Skipping version ${{ matrix.version }} due to Segmentation fault on Ubuntu."
;;
*)
clang-tidy-${{ matrix.version }} --version
;;
esac
fi
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: python -m pip install . -r docs/requirements.txt
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Save built docs as artifact
uses: actions/upload-artifact@v4
with:
name: "clang-tools-pip_docs"
path: docs/_build/html
- name: Upload to github pages
# only publish doc changes from main branch
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html