summaryrefslogtreecommitdiff
path: root/.github/workflows/linux_build.yml
blob: 48c9eb6125de69cd49ff18d9df58e84cdadcceff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Linux Compile

on:
  push:
    branches: [ "*" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        config: [Release, Debug]
        standalone: [OFF, ON]
        toolchain: [linux-gnu, linux-clang]
        isPR:
          - ${{ github.event_name == 'pull_request' }}
        exclude:
          - isPR: true
            standalone: OFF
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          sudo apt-get update
          # Base build tools plus the libultraship/Fast3D deps the interactive
          # viewer (BUILD_UI) needs: SDL2, OpenGL, libzip, nlohmann-json and spdlog.
          # (tinyxml2 is vendored via FetchContent.)
          sudo apt-get install -y cmake ninja-build libbz2-dev \
            libsdl2-dev libgl1-mesa-dev libopengl-dev libzip-dev zipcmp zipmerge ziptool libspdlog-dev nlohmann-json3-dev
      - name: Build
        run: |
          # Enable the viewer in CI (BUILD_UI is off by default); both Linux
          # toolchains build the GL backend.
          cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DUSE_STANDALONE=${{ matrix.standalone }} -DBUILD_UI=ON -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/${{ matrix.toolchain }}.cmake
          cmake --build build-cmake -j
      - name: Create Package
        if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'linux-gnu' }}
        run: |
          mkdir torch-release
          mv build-cmake/torch torch-release/
          cp "$(ldconfig -p | grep libbz2.so.1.0 | tr ' ' '\n' | grep /| head -n1)" torch-release/
      - name: Publish packaged artifacts
        if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'linux-gnu' }}
        uses: actions/upload-artifact@v4
        with:
          name: torch-linux-x64
          path: torch-release