-
Notifications
You must be signed in to change notification settings - Fork 182
137 lines (113 loc) · 5.11 KB
/
runtime-build.yml
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
name: runtime-build
on: [ push, pull_request ]
concurrency:
group: runtime-build-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/') }}
jobs:
build-native-runtime:
name: build-runtime-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
config:
- { name: aarch64-macos, os: macos-14, buildType: Release }
- { name: x86_64-linux, os: ubuntu-24.04, buildType: Release }
- { name: x86_64-windows, os: windows-latest, arch: x64, buildType: Release }
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set up build environment (Windows, Visual Studio)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.config.arch}}
if: runner.os == 'Windows'
- name: Set up build enviroment(Linux)
run: |
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
if: runner.os == 'Linux'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Conan
run: |
pip install conan==2.6.0
conan remote add sunnycase https://conan.sunnycase.moe --index 0
- name: Configure
shell: bash
run: |
conan install . --build=missing -s build_type=${{matrix.config.buildType}} -pr:a=toolchains/${{matrix.config.name}}.profile.jinja -o "&:runtime=True" -o "&:python=True" -o "&:tests=True"
cmake --preset conan-runtime-release
- name: Build & Install
run: |
cmake --build build/${{matrix.config.buildType}} --config ${{matrix.config.buildType}}
cmake --install build/${{matrix.config.buildType}} --prefix install
- name: Test
run: |
cd build/${{matrix.config.buildType}}
ctest --test-dir tests/kernels --output-on-failure -j4
if: runner.os != 'Macos' && runner.os != 'Windows'
#- name: Benchmark
# run: |
# ${{github.workspace}}/install/bin/benchnncase > benchnncase.log
# cat benchnncase.log
- name: Upload nncaseruntime Build Artifact
uses: actions/upload-artifact@v4
with:
name: nncaseruntime-${{matrix.config.name}}
path: ${{github.workspace}}/install
if-no-files-found: error
#- name: Upload nncaseruntime Benchmark
# uses: actions/upload-artifact@v3
# with:
# name: nncaseruntime-benchmark-${{matrix.config.name}}
# path: ${{github.workspace}}/benchnncase.log
# if-no-files-found: error
build-cross-linux-runtime:
name: build-runtime-${{matrix.config.name}}
runs-on: ubuntu-latest
strategy:
matrix:
config:
- { name: riscv64-unknown-linux, toolchain: riscv64-unknown-linux, toolchain_env: RISCV_ROOT_PATH, toolchain_file: riscv64-unknown-linux-gnu-12.0.1, qemu: qemu-riscv64, loader_args: '-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L', cmakeArgs: '', buildType: Release }
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install toolchain and QEMU
shell: bash
run: |
wget https://dav.sunnycase.moe/d/ci/nncase/${{matrix.config.toolchain_file}}.tar.xz -O toolchain.tar.xz
sudo tar xf toolchain.tar.xz -C $GITHUB_WORKSPACE
echo "${{matrix.config.toolchain_env}}=$GITHUB_WORKSPACE/${{matrix.config.toolchain_file}}" >> $GITHUB_ENV
wget https://dav.sunnycase.moe/d/ci/nncase/${{matrix.config.qemu}}.tgz -O qemu.tgz
sudo tar xf qemu.tgz -C /usr/local/bin
echo "TESTS_EXECUTABLE_LOADER=${{matrix.config.qemu}}" >> $GITHUB_ENV
echo "TESTS_EXECUTABLE_LOADER_ARGUMENTS=${{matrix.config.loader_args}};$GITHUB_WORKSPACE/${{matrix.config.toolchain_file}}/sysroot" >> $GITHUB_ENV
- name: Install Conan
run: |
pip install conan==2.6.0
conan remote add sunnycase https://conan.sunnycase.moe --index 0
- name: Configure
run: |
conan install . --build=missing -s build_type=${{matrix.config.buildType}} -pr:h=toolchains/${{matrix.config.name}}.profile.jinja -pr:b=toolchains/x86_64-linux.profile.jinja -o "&:runtime=True" -o "&:python=True" -o "&:tests=True"
cmake --preset conan-runtime-release
- name: Build & Install
run: |
cmake --build build/${{matrix.config.buildType}} --config ${{matrix.config.buildType}}
cmake --install build/${{matrix.config.buildType}} --prefix install
- name: Test
shell: bash
run: |
cd build/${{matrix.config.buildType}}
ctest --test-dir tests/kernels --output-on-failure -j4
- name: Upload nncaseruntime Build Artifact
uses: actions/upload-artifact@v4
with:
name: nncaseruntime-${{matrix.config.name}}
path: ${{github.workspace}}/install
if-no-files-found: error