ci: run package test in docker #692
Workflow file for this run
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: Format | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
cpp-format-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install clang-format | |
run: | | |
sudo apt-get install -y clang-format colordiff | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run clang-format | |
run: | | |
diff=`git-clang-format --extensions="c,h,cc,cp,cpp,c++,cxx,hh,hpp,hxx,inc,cu,cuh" --commit ${{ github.event.pull_request.base.sha }} --diff` | |
[ "$diff" = "no modified files to format" ] && exit 0 | |
[ "$diff" = "clang-format did not modify any files" ] && exit 0 | |
printf "\nYou have introduced coding style breakages. You can:\n" | |
echo "1> Fix the errors with git-clang-format:" | |
echo " git-clang-format --commit ${{ github.event.pull_request.base.sha }}" | |
echo "2> Disable checks on section of the code with:" | |
echo " // clang-format off" | |
echo " code" | |
echo " // clang-format on" | |
printf "\n\033[1mSuggested changes:\n\n" | |
echo "$diff" | colordiff | |
exit 1 | |
python-format-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install ruff and isort | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff==0.4.2 isort==5.13.2 | |
- name: Run ruff check | |
run: | | |
ruff check scalellm/ tests/ examples/ | |
- name: Run isort check | |
run: | | |
isort --check-only scalellm/ tests/ examples/ |