File: build-python.yml

package info (click to toggle)
gtsam 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 46,108 kB
  • sloc: cpp: 127,191; python: 14,312; xml: 8,442; makefile: 252; sh: 119; ansic: 101
file content (128 lines) | stat: -rw-r--r-- 4,465 bytes parent folder | download | duplicates (3)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Python CI

on: [pull_request]

jobs:
  build:
    name: ${{ matrix.name }} ${{ matrix.build_type }} Python ${{ matrix.python_version }}
    runs-on: ${{ matrix.os }}

    env:
      CTEST_OUTPUT_ON_FAILURE: ON
      CTEST_PARALLEL_LEVEL: 2
      CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
      PYTHON_VERSION: ${{ matrix.python_version }}

    strategy:
      fail-fast: false
      matrix:
        # Github Actions requires a single row to be added to the build matrix.
        # See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
        name: [
          ubuntu-20.04-gcc-7,
          ubuntu-20.04-gcc-9,
          ubuntu-20.04-clang-9,
          macOS-11-xcode-13.4.1,
          ubuntu-20.04-gcc-7-tbb,
        ]

        build_type: [Debug, Release]
        python_version: [3]
        include:
          - name: ubuntu-20.04-gcc-7
            os: ubuntu-20.04
            compiler: gcc
            version: "7"

          - name: ubuntu-20.04-gcc-9
            os: ubuntu-20.04
            compiler: gcc
            version: "9"

          - name: ubuntu-20.04-clang-9
            os: ubuntu-20.04
            compiler: clang
            version: "9"

          # NOTE temporarily added this as it is a required check.
          - name: ubuntu-20.04-clang-9
            os: ubuntu-20.04
            compiler: clang
            version: "9"
            build_type: Debug
            python_version: "3"

          - name: macOS-11-xcode-13.4.1
            os: macOS-11
            compiler: xcode
            version: "13.4.1"

          - name: ubuntu-20.04-gcc-7-tbb
            os: ubuntu-20.04
            compiler: gcc
            version: "7"
            flag: tbb

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install (Linux)
        if: runner.os == 'Linux'
        run: |
          if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then
            # (ipv4|ha).pool.sks-keyservers.net is the SKS GPG global keyserver pool
            # ipv4 avoids potential timeouts because of crappy IPv6 infrastructure
            # 15CF4D18AF4F7421 is the GPG key for the LLVM apt repository
            # This key is not in the keystore by default for Ubuntu so we need to add it.
            LLVM_KEY=15CF4D18AF4F7421
            gpg --keyserver keyserver.ubuntu.com --recv-key $LLVM_KEY || gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key $LLVM_KEY
            gpg -a --export $LLVM_KEY | sudo apt-key add -
            sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main"
          fi

          sudo apt-get -y update
          sudo apt-get -y install cmake build-essential pkg-config libpython3-dev python3-numpy libboost-all-dev
          
          if [ "${{ matrix.compiler }}" = "gcc" ]; then
            sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
            echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
            echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
          else
            sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
            echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
            echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
          fi
      - name: Install (macOS)
        if: runner.os == 'macOS'
        run: |
          brew tap ProfFan/robotics
          brew install cmake ninja
          brew install boost
          if [ "${{ matrix.compiler }}" = "gcc" ]; then
            brew install gcc@${{ matrix.version }}
            echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
            echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
          else
            sudo xcode-select -switch /Applications/Xcode.app
            echo "CC=clang" >> $GITHUB_ENV
            echo "CXX=clang++" >> $GITHUB_ENV
          fi
      - name: Set GTSAM_WITH_TBB Flag
        if: matrix.flag == 'tbb'
        run: |
          echo "GTSAM_WITH_TBB=ON" >> $GITHUB_ENV
          echo "GTSAM Uses TBB"
      - name: Set Swap Space
        if: runner.os == 'Linux'
        uses: pierotofy/set-swap-space@master
        with:
          swap-size-gb: 6
      - name: Install Dependencies
        run: |
          bash .github/scripts/python.sh -d
      - name: Build
        run: |
          bash .github/scripts/python.sh -b
      - name: Test
        run: |
          bash .github/scripts/python.sh -t