Skip to content

Add create loop button (#594) #14

Add create loop button (#594)

Add create loop button (#594) #14

Workflow file for this run

name: Lint
on:
push:
branches:
- master
- 'releases/**'
pull_request:
branches:
- '*'
jobs:
typecheck-build:
name: lint.python.typecheck-build
container:
image: vowpalwabbit/rlclientlib-manylinux2010-build:latest
runs-on: ubuntu-latest
strategy:
matrix:
config:
- { version: "3.9", base_path: /opt/python/cp39-cp39/, include_dir_name: python3.9/ }
steps:
# v1 must be used because newer versions require a node.js version that will not run on this old image.
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Build wheel
shell: bash
run: |
${{ matrix.config.base_path }}bin/pip wheel . -w wheel_output/ --verbose
auditwheel repair wheel_output/*whl -w audit_output/
- name: Upload built wheel
# v1 must be used because newer versions require a node.js version that will not run on this old image.
uses: actions/upload-artifact@v1
with:
name: wheel_${{ matrix.config.version }}
path: audit_output/
typecheck-check:
name: lint.python.typecheck-check
needs: typecheck-build
container:
image: python:${{ matrix.config.version }}
runs-on: ubuntu-latest
strategy:
matrix:
config:
- { version: "3.9" }
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download Wheel
uses: actions/download-artifact@v1
with:
name: wheel_${{ matrix.config.version }}
- name: Install dependencies
shell: bash
run: |
pip install pytype
- name: Install wheel
shell: bash
run: |
export wheel_files=(wheel_${{ matrix.config.version }}/*)
export wheel_file="${wheel_files[0]}"
echo Installing ${wheel_file}...
pip install ${wheel_file}
- name: Run pytype
shell: bash
run: |
python -m pytype ./bindings/python/ --verbosity=2
python -m pytype ./examples/python/ --verbosity=2
python-formatting:
name: lint.python.formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- run: pip install black black[jupyter]
- name: Run python formatting
shell: bash
run: |
python -m black --check . --exclude ext_libs/ || (echo -e "---\nTo fix, run:\n\tpython -m black . --exclude ext_libs"; exit 1)
cpp-formatting:
name: lint.c++.formatting
runs-on: ubuntu-latest
steps:
# Must use v1 or else git diff breaks
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install clang-format
shell: bash
run: |
sudo apt update
sudo apt install clang-format
clang-format --version
- name: Check code formatting for codebase
shell: bash
run: ./.scripts/linux/clang-format.sh check
env:
GH_WORKFLOW_LOGGING: true
- name: Check code formatting for diff
# Only run the diff check for pull requests
if: github.event_name == 'pull_request'
shell: bash
run: |
if [[ ! -f .clang-format ]]; then
echo "Cannot find .clang-format file!"
exit 1
fi
git diff origin/master...HEAD -U0 --no-color -- :^/ext_libs | clang-format-diff -r '^.*\.(cc|h)$' -p1 > clang_format_diff.txt
if [ -s clang_format_diff.txt ]; then
cat clang_format_diff.txt
echo "::error:: Formatting issues found"
echo "To fix:"
echo -e "\tUse the clang-format.sh script in docker mode:"
echo -e "\t\tRun: \"./.scripts/linux/clang-format.sh docker fix\""
echo -e "\tOr, install the right verson of clang-format locally"
echo -e "\t\tRun: \"git diff upstream/master...HEAD -U0 --no-color | clang-format-diff -r '^.*\.(cc|h)$' -p1 -i\""
echo -e "\tBe sure to check your version of clang-format. The version used here is..."
clang-format --version
exit 1
else
echo "No formatting issues found in the PR diff."
fi
run-clang-tidy:
name: lint.c++.clang-tidy
container:
image: vowpalwabbit/ubuntu2004-dev:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: |
apt update
apt install -y libspdlog-dev libfmt-dev libboost-math-dev
apt install -y jq
- name: Run clang tidy
shell: bash
run: ./.scripts/linux/run-clang-tidy.sh