Update tutorials #9
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
name: Code style check | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-ci.txt | |
pip install -r tests/requirements.txt | |
- name: Set PYTHONPATH environment variable | |
run: echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV | |
- name: Run Black | |
run: black --check . | |
- name: Run isort | |
run: isort --check-only --diff . | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g | |
# with: | |
# since_last_remote_commit: true | |
- name: Run Pylint on changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
files=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | grep '\.py$' || true) | |
if [ -n "$files" ]; then | |
pylint $files | |
else | |
echo "No Python files changed" | |
fi | |
clang-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y clang-format | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
- name: Check clang-format | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
files=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | grep -E '\.(cpp|h|hpp)$' || true) | |
if [ -n "$files" ]; then | |
clang-format --dry-run --Werror $files | |
else | |
echo "No cpp files changed" | |
fi |