File size: 7,679 Bytes
8b7c501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Build using CMake
on:
  push:
    paths:
      - '**.S'
      - '**.c'
      - '**.cc'
      - '**.h'
      - 'CMakeLists.txt'
      - 'cmake/**'
      - 'scripts/build-*.sh'
      - '.github/**/*.yml'
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  cancel-in-progress: true
jobs:
  cmake-linux-local:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt update
      - name: Install ninja
        run: sudo apt install ninja-build
      - name: Configure and build
        run: scripts/build-local.sh
        working-directory: ${{ github.workspace }}
  cmake-linux-aarch64:
    runs-on: ubuntu-22.04
    timeout-minutes: 120
    steps:
      - uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt update
      - name: Install ninja
        run: sudo apt install ninja-build
      - name: Install aarch64 cross-toolchain
        run: sudo apt install crossbuild-essential-arm64
      - name: Install qemu-aarch64
        run: sudo apt install qemu-user
      - name: Configure and build
        run: scripts/build-linux-aarch64.sh -DCMAKE_BUILD_TYPE=Release
        working-directory: ${{ github.workspace }}
      - name: Run tests
        run: ctest --output-on-failure --parallel $(nproc)
        working-directory: ${{ github.workspace }}/build/linux/aarch64
  cmake-linux-armhf:
    runs-on: ubuntu-22.04
    timeout-minutes: 90
    steps:
      - uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt update
      - name: Install ninja
        run: sudo apt install ninja-build
      - name: Install armhf cross-toolchain
        run: sudo apt install crossbuild-essential-armhf
      - name: Install qemu-arm
        run: sudo apt install qemu-user
      - name: Configure and build
        run: scripts/build-linux-armhf.sh -DCMAKE_BUILD_TYPE=Release
        working-directory: ${{ github.workspace }}
      - name: Run tests
        run: ctest --output-on-failure --parallel $(nproc)
        working-directory: ${{ github.workspace }}/build/linux/armhf
  cmake-linux-riscv64:
    runs-on: ubuntu-22.04
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt update
      - name: Install ninja
        run: sudo apt install ninja-build
      - name: Install riscv64 cross-toolchain
        run: sudo apt install crossbuild-essential-riscv64
      - name: Install qemu-riscv64
        run: sudo apt install qemu-user
      - name: Configure and build
        run: scripts/build-linux-riscv64.sh -DCMAKE_BUILD_TYPE=Release -DXNNPACK_ENABLE_RISCV_VECTOR=OFF
        working-directory: ${{ github.workspace }}
      - name: Run tests
        run: ctest --output-on-failure --parallel $(nproc)
        working-directory: ${{ github.workspace }}/build/linux/riscv64
  cmake-windows-arm64:
    runs-on: windows-latest
    timeout-minutes: 120
    steps:
      - uses: actions/checkout@v3
      - name: Configure and build
        run: scripts/build-windows-arm64.cmd
        shell: cmd
        working-directory: ${{ github.workspace }}
  cmake-windows-x64:
    runs-on: windows-latest
    timeout-minutes: 120
    steps:
      - uses: actions/checkout@v3
      - name: Configure and build
        run: scripts/build-windows-x64.cmd
        shell: cmd
        working-directory: ${{ github.workspace }}
        env:
          CFLAGS: "/UNDEBUG"
          CXXFLAGS: "/UNDEBUG"
      - name: Run tests
        run: ctest -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS%
        working-directory: ${{ github.workspace }}/build/windows/x64
  cmake-windows-x86:
    runs-on: windows-latest
    timeout-minutes: 120
    steps:
      - uses: actions/checkout@v3
      - name: Configure and build
        run: scripts/build-windows-x86.cmd
        shell: cmd
        working-directory: ${{ github.workspace }}
        env:
          CFLAGS: "/UNDEBUG"
          CXXFLAGS: "/UNDEBUG"
      - name: Run tests
        run: ctest -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS%
        working-directory: ${{ github.workspace }}/build/windows/x86
  cmake-macos-arm64:
    runs-on: macos-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v3
      - name: Create output directory
        run: mkdir -p build/macos/arm64
        working-directory: ${{ github.workspace }}
      - name: Generate CMake project
        run: cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DHAVE_STD_REGEX=TRUE ../../..
        working-directory: ${{ github.workspace }}/build/macos/arm64
      - name: Build with Xcode
        run: cmake --build build/macos/arm64 --parallel $(sysctl -n hw.ncpu) -- -quiet
        working-directory: ${{ github.workspace }}
  cmake-macos-x86_64:
    runs-on: macos-latest
    timeout-minutes: 90
    steps:
      - uses: actions/checkout@v3
      - name: Create output directory
        run: mkdir -p build/macos/x86_64
        working-directory: ${{ github.workspace }}
      - name: Generate CMake project
        run: cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DHAVE_STD_REGEX=TRUE ../../..
        working-directory: ${{ github.workspace }}/build/macos/x86_64
      - name: Build with Xcode
        run: cmake --build build/macos/x86_64 --parallel $(sysctl -n hw.ncpu) -- -quiet
        working-directory: ${{ github.workspace }}
      - name: Run tests
        run: ctest --build-config Debug --output-on-failure --parallel $(sysctl -n hw.ncpu)
        working-directory: ${{ github.workspace }}/build/macos/x86_64
  cmake-android:
    strategy:
      matrix:
        script: [build-android-arm64.sh, build-android-armv7.sh, build-android-x86.sh]
    runs-on: ubuntu-latest
    timeout-minutes: 40
    steps:
      - uses: actions/checkout@v3
      - name: Update apt
        run: sudo apt update
      - name: Install ninja
        run: sudo apt install ninja-build
      - name: Setup Android NDK
        id: setup-ndk
        uses: nttld/setup-ndk@v1
        with:
          ndk-version: r23b
          add-to-path: false
      - name: Configure and build
        run: scripts/${{ matrix.script }}
        working-directory: ${{ github.workspace }}
        env:
          ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
  cmake-ios-arm64:
    runs-on: macos-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v3
      - name: Create output directory
        run: mkdir -p build/ios/arm64
        working-directory: ${{ github.workspace }}
      - name: Generate CMake project
        run: cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DXNNPACK_BUILD_BENCHMARKS=OFF -DXNNPACK_BUILD_TESTS=OFF ../../..
        working-directory: ${{ github.workspace }}/build/ios/arm64
      - name: Build with Xcode
        run: cmake --build build/ios/arm64 --parallel $(sysctl -n hw.ncpu) -- -quiet
        working-directory: ${{ github.workspace }}
  cmake-ios-x86_64:
    runs-on: macos-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v3
      - name: Create output directory
        run: mkdir -p build/ios/x86_64
        working-directory: ${{ github.workspace }}
      - name: Generate CMake project
        run: cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=x86_64 -DXNNPACK_BUILD_BENCHMARKS=OFF -DXNNPACK_BUILD_TESTS=OFF ../../..
        working-directory: ${{ github.workspace }}/build/ios/x86_64
      - name: Build with Xcode
        run: cmake --build build/ios/x86_64 --parallel $(sysctl -n hw.ncpu) -- -sdk iphonesimulator -quiet
        working-directory: ${{ github.workspace }}