Skip to content

Commit

Permalink
fix(tools): Fix linter to not depend on docker (#1301)
Browse files Browse the repository at this point in the history
* fix(tools): Fix linter to not depend on docker

Signed-off-by: Naren Dasan <1790613+narendasan@users.noreply.github.com>

* Update linter.yml

* Update linter.yml

Signed-off-by: Naren Dasan <1790613+narendasan@users.noreply.github.com>
  • Loading branch information
narendasan authored Aug 23, 2022
1 parent 0005137 commit c83e09e
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Docker login
uses: docker/login-action@v1
- name: Set up Python 3.9.4
uses: actions/setup-python@v2
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run image
python-version: 3.9.4
- name: Setup env
run: |
docker pull docker.pkg.github.com/pytorch/tensorrt/docgen:latest
docker run -it -d --name cpplinter -e GITHUB_TOKEN=$GITHUB_TOKEN -v $GITHUB_WORKSPACE:/workspace -v $GITHUB_EVENT_PATH:/GITHUB_EVENT.json -w /workspace docker.pkg.github.com/pytorch/tensorrt/docgen:latest
docker exec cpplinter bash -c "cp /workspace/docker/WORKSPACE.docker /workspace/WORKSPACE"
sudo ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: |
docker exec cpplinter bash -c "pip3 install -r /workspace/.github/scripts/requirements.txt"
docker exec cpplinter bash -c "pip3 install -r /workspace/requirements-dev.txt"
pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
pip3 install -r $GITHUB_WORKSPACE/requirements-dev.txt
- name: Lint C++
run: docker exec cpplinter bash -c "cd /workspace && python3 /workspace/.github/scripts/run_cpp_linter.py"
run: |
cd $GITHUB_WORKSPACE
python3 $GITHUB_WORKSPACE/.github/scripts/run_cpp_linter.py
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

py-linting:
name: Python Linting
Expand All @@ -65,22 +65,28 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.9.4
uses: actions/setup-python@v2
with:
python-version: 3.9.4
- name: Docker login
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run image
- name: Setup env
run: |
docker pull docker.pkg.github.com/pytorch/tensorrt/docgen:latest
docker run -it -d --name pylinter -e GITHUB_TOKEN=$GITHUB_TOKEN -v $GITHUB_WORKSPACE:/workspace -v $GITHUB_EVENT_PATH:/GITHUB_EVENT.json -w /workspace docker.pkg.github.com/pytorch/tensorrt/docgen:latest
docker exec pylinter bash -c "cp /workspace/docker/WORKSPACE.docker /workspace/WORKSPACE"
sudo ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: |
docker exec pylinter bash -c "pip3 install -r /workspace/.github/scripts/requirements.txt"
docker exec pylinter bash -c "pip3 install -r /workspace/requirements-dev.txt"
pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
pip3 install -r $GITHUB_WORKSPACE/requirements-dev.txt
- name: Lint Python
run: docker exec pylinter bash -c "cd /workspace && python3 /workspace/.github/scripts/run_py_linter.py"
run: |
cd $GITHUB_WORKSPACE
python3 $GITHUB_WORKSPACE/.github/scripts/run_py_linter.py
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit c83e09e

Please sign in to comment.