|
| 1 | +name: Python |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - "python/**" |
| 8 | + - "src/pybind/**" |
| 9 | + - ".github/workflows/py.yaml" |
| 10 | + - "extensions/**" |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + |
| 15 | +jobs: |
| 16 | + pythonpackage: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + env: |
| 19 | + CC: clang |
| 20 | + CXX: clang++ |
| 21 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Install CPP dependencies |
| 25 | + run: sudo apt install $(cat debian_deps.txt) |
| 26 | + - name: Install virtual frame buffer tool |
| 27 | + run: sudo apt install xvfb |
| 28 | + - name: Set up Python 3.11 |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: "3.11" |
| 32 | + cache: "pip" |
| 33 | + - name: Install building dependencies |
| 34 | + run: python -m pip install -r requirements.txt |
| 35 | + - name: Install wheel |
| 36 | + run: python -m pip install wheel |
| 37 | + - name: Install the package |
| 38 | + run: python -m pip install -v --no-build-isolation '.[dev]' |
| 39 | + - name: Check formatting |
| 40 | + run: make pycheckformat |
| 41 | + - name: Code linting |
| 42 | + run: make pylint |
| 43 | + - name: Check that stub files are up-to-date |
| 44 | + run: make stubgen && git diff --exit-code |
| 45 | + - name: Ensure all unittests(pytest) are passing |
| 46 | + run: xvfb-run make pytest |
| 47 | + |
| 48 | + check-paths: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + outputs: |
| 51 | + extensions_changed: ${{ steps.changed-files.outputs.any_changed }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + - name: Get changed files for extensions |
| 57 | + id: changed-files |
| 58 | + uses: tj-actions/changed-files@v41 |
| 59 | + with: |
| 60 | + files: | |
| 61 | + extensions/** |
| 62 | +
|
| 63 | + build_extensions: |
| 64 | + needs: [pythonpackage, check-paths] |
| 65 | + if: needs.check-paths.outputs.extensions_changed == 'true' |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + extension: |
| 69 | + # Python extensions |
| 70 | + - rcs_xarm7 |
| 71 | + - rcs_realsense |
| 72 | + # - rcs_robotiq |
| 73 | + - rcs_tacto |
| 74 | + - rcs_usb_cam |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - name: Cache apt packages |
| 79 | + uses: actions/cache@v4 |
| 80 | + with: |
| 81 | + path: /var/cache/apt/archives |
| 82 | + key: ${{ runner.os }}-apt-${{ hashFiles('debian_deps.txt') }} |
| 83 | + restore-keys: | |
| 84 | + ${{ runner.os }}-apt- |
| 85 | + - name: Install dependencies |
| 86 | + run: sudo apt install $(cat debian_deps.txt) |
| 87 | + - name: Set up Python 3.11 |
| 88 | + id: setup-python |
| 89 | + uses: actions/setup-python@v5 |
| 90 | + with: |
| 91 | + python-version: "3.11" |
| 92 | + cache: "pip" |
| 93 | + |
| 94 | + - name: Install build dependencies |
| 95 | + run: pip install -r requirements.txt |
| 96 | + |
| 97 | + - name: Install rcs |
| 98 | + run: pip install -v --no-build-isolation '.[dev]' |
| 99 | + |
| 100 | + - name: Install extension |
| 101 | + run: pip install -v --no-build-isolation extensions/${{ matrix.extension }} |
| 102 | + |
| 103 | + build_cpp_extensions: |
| 104 | + needs: [pythonpackage, check-paths] |
| 105 | + if: needs.check-paths.outputs.extensions_changed == 'true' |
| 106 | + strategy: |
| 107 | + matrix: |
| 108 | + extension: |
| 109 | + - rcs_fr3 |
| 110 | + - rcs_panda |
| 111 | + - rcs_robotics_library |
| 112 | + - rcs_so101 |
| 113 | + runs-on: ubuntu-latest |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v4 |
| 116 | + - name: Cache apt packages |
| 117 | + uses: actions/cache@v4 |
| 118 | + with: |
| 119 | + path: /var/cache/apt/archives |
| 120 | + key: ${{ runner.os }}-apt-${{ hashFiles('debian_deps.txt') }} |
| 121 | + restore-keys: | |
| 122 | + ${{ runner.os }}-apt- |
| 123 | + - name: Install virtual frame buffer tool |
| 124 | + run: sudo apt install xvfb |
| 125 | + - name: Install potential debian deps |
| 126 | + run: | |
| 127 | + if [ -f extensions/${{ matrix.extension }}/debian_deps.txt ]; then |
| 128 | + sudo apt install $(cat extensions/${{ matrix.extension }}/debian_deps.txt) |
| 129 | + fi |
| 130 | + - name: Install dependencies |
| 131 | + run: sudo apt install $(cat debian_deps.txt) |
| 132 | + - name: Set up Python 3.11 |
| 133 | + id: setup-python |
| 134 | + uses: actions/setup-python@v5 |
| 135 | + with: |
| 136 | + python-version: "3.11" |
| 137 | + cache: "pip" |
| 138 | + - name: Install Python dependencies |
| 139 | + run: pip install -r requirements.txt |
| 140 | + - name: Install RCS |
| 141 | + run: pip install -v --no-build-isolation '.[dev]' |
| 142 | + - name: Install extension |
| 143 | + run: pip install -v --no-build-isolation extensions/${{ matrix.extension }} |
| 144 | + - name: Check that stub files are up-to-date |
| 145 | + run: make -C extensions/${{ matrix.extension }} stubgen && git diff --exit-code |
| 146 | + - name: Check clang format |
| 147 | + run: make -C extensions/${{ matrix.extension }} cppcheckformat |
| 148 | + # - name: Clang Tidy |
| 149 | + # run: make -C extensions/${{ matrix.extension }} cpplint |
| 150 | + # - name: Clang build |
| 151 | + # run: make -C extensions/${{ matrix.extension }} clangcompile PYTHON_EXECUTABLE=${{ steps.setup-python.outputs.python-path }} |
0 commit comments