2024-08-05 nightly release (09e2690791add5ddfa10f186919f731f61516b3a) #615
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: Lint | |
on: | |
pull_request: | |
push: | |
branches: | |
- nightly | |
- main | |
- release/* | |
workflow_dispatch: | |
jobs: | |
python-source-and-configs: | |
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | |
with: | |
repository: pytorch/text | |
script: | | |
set -euo pipefail | |
echo '::group::Setup environment' | |
CONDA_PATH=$(which conda) | |
eval "$(${CONDA_PATH} shell.bash hook)" | |
conda create --name ci --quiet --yes python=3.8 pip | |
conda activate ci | |
echo '::endgroup::' | |
echo '::group::Install lint tools' | |
pip install --progress-bar=off pre-commit | |
echo '::endgroup::' | |
echo '::group::Lint Python source and configs' | |
set +e | |
echo $LD_LIBRARY_PATH | |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}" | |
pre-commit run --all-files | |
if [ $? -ne 0 ]; then | |
git --no-pager diff | |
exit 1 | |
fi | |
echo '::endgroup::' | |
c-source: | |
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | |
with: | |
repository: pytorch/text | |
script: | | |
set -euo pipefail | |
echo '::group::Setup environment' | |
CONDA_PATH=$(which conda) | |
eval "$(${CONDA_PATH} shell.bash hook)" | |
conda create --name ci --quiet --yes -c conda-forge python=3.8 ncurses=5 libgcc | |
conda activate ci | |
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}" | |
echo '::endgroup::' | |
echo '::group::Install lint tools' | |
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format | |
chmod +x ./clang-format | |
echo '::endgroup::' | |
echo '::group::Lint C source' | |
set +e | |
python run-clang-format.py \ | |
--recursive \ | |
--clang-format-executable=./clang-format \ | |
torchtext/csrc | |
if [ $? -ne 0 ]; then | |
git --no-pager diff | |
exit 1 | |
fi | |
echo '::endgroup::' |