-
Notifications
You must be signed in to change notification settings - Fork 187
188 lines (169 loc) · 6 KB
/
Copy pathrun-onecc-build.yml
File metadata and controls
188 lines (169 loc) · 6 KB
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
name: Run ONECC Ubuntu Build
on:
push:
branches:
- master
- release/*
paths:
- '.github/workflows/run-onecc-build.yml'
- 'nnas'
- 'nncc'
- 'compiler/**'
- 'infra/cmake/**'
- 'infra/nncc/**'
- 'nnpackage/schema/**'
- 'res/**'
- '!**/*.md'
pull_request:
branches:
- master
- release/*
paths:
- '.github/workflows/run-onecc-build.yml'
- 'nnas'
- 'nncc'
- 'compiler/**'
- 'infra/cmake/**'
- 'infra/nncc/**'
- 'nnpackage/schema/**'
- 'res/**'
- '!**/*.md'
defaults:
run:
shell: bash
# Cancel previous running jobs when pull request is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
onecc-test:
if: github.repository_owner == 'Samsung' && !contains(github.event.pull_request.labels.*.name, 'PR/NO TEST')
strategy:
matrix:
type: ['Debug', 'Release']
# TODO enable focal when possible
# refer https://github.com/Samsung/ONE/issues/16196
ubuntu_code: ['jammy', 'noble']
runs-on: ubuntu-latest
container:
image: nnfw/one-devtools:${{ matrix.ubuntu_code }}
options: --user root
env:
NNCC_WORKSPACE : build
NNCC_INSTALL_PREFIX : install
name: onecc ubuntu ${{ matrix.ubuntu_code }} ${{ matrix.type }} test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install onnx2circle
run: |
apt update
apt-get -qqy install software-properties-common
add-apt-repository ppa:circletools/nightly
apt-get -qqy install onnx2circle
- name: Install python3.10 for focal
if: matrix.ubuntu_code == 'focal'
run: |
add-apt-repository ppa:deadsnakes/ppa
apt-get -qqy install python3.10 python3.10-dev python3.10-venv
python3.10 -m ensurepip --upgrade
- name: Restore externals cache
uses: actions/cache/restore@v4
id: externals-cache
with:
path: externals
key: external-onecc-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}
restore-keys: |
external-onecc-
external-
- name: Restore overlay cache
uses: actions/cache/restore@v4
id: overlay-cache
with:
path: ${{ env.NNCC_WORKSPACE }}/overlay
key: overlay-onecc-${{ matrix.ubuntu_code }}-${{ hashFiles('compiler/common-artifacts/CMakeLists.txt') }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}
- name: Get month for ccache cache key
id: get-month
run: echo "key_month=$(date +%y%m)" >> "$GITHUB_OUTPUT"
- name: Restore ccache cache
uses: actions/cache/restore@v4
id: ccache-cache
with:
path: ~/.cache/ccache
key: ccache-onecc-${{ matrix.ubuntu_code }}-${{ matrix.type }}-${{ steps.get-month.outputs.key_month }}
restore-keys: |
ccache-onecc-${{ matrix.ubuntu_code }}-${{ matrix.type }}
- name: Build
run: |
./nncc configure -DENABLE_STRICT_BUILD=ON -DCMAKE_BUILD_TYPE=${{ matrix.type }} \
-DEXTERNALS_BUILD_THREADS="$(nproc)" -DCMAKE_INSTALL_PREFIX="${NNCC_INSTALL_PREFIX}"
./nncc build "-j$(nproc)"
cmake --build "${NNCC_WORKSPACE}" -- install
# Save cache on push to reduce the size of cache storage
# ccache cache: only for master branch
# overlay cache: only for master branch and Release build
# externals cache: only for master branch and Release build and jammy
- name: Save ccache cache
if: github.event_name == 'push' && github.ref_name == 'master'
uses: actions/cache/save@v4
with:
path: ~/.cache/ccache
key: ${{ steps.ccache-cache.outputs.cache-primary-key }}
- name: Save overlay cache
if: github.event_name == 'push' && github.ref_name == 'master' && matrix.type == 'Release'
uses: actions/cache/save@v4
with:
path: ${{ env.NNCC_WORKSPACE }}/overlay
key: ${{ steps.overlay-cache.outputs.cache-primary-key }}
- name: Save externals cache
if: github.event_name == 'push' && github.ref_name == 'master' && matrix.type == 'Release' && matrix.ubuntu_code == 'jammy'
uses: actions/cache/save@v4
with:
path: externals
key: ${{ steps.externals-cache.outputs.cache-primary-key }}
- name: Test(Debug)
if: matrix.type == 'Debug'
env:
LUCI_LOG : 100
run: ./nncc test
- name: Test(Release)
if: matrix.type == 'Release'
env:
NNCC_INSTALL_PATH : ${{ env.NNCC_WORKSPACE }}/${{ env.NNCC_INSTALL_PREFIX }}
run: |
./nncc test
"${NNCC_INSTALL_PATH}/bin/one-prepare-venv"
"${NNCC_INSTALL_PATH}/test/prepare_test_materials.sh"
export PATH=${PWD}/${NNCC_INSTALL_PATH}/bin:$PATH
pushd "${NNCC_INSTALL_PATH}/test"
## one-import-tf -> one-optimize -> one-quantize -> one-codegen
bash onecc_006.test
## one-import-tflite
bash onecc_014.test
## one-import-bcq
bash onecc_015.test
## one-import-onnx
bash onecc_016.test
## one-pack
bash onecc_019.test
## one-profile
bash onecc_021.test
## one-quantize
bash onecc_023.test
bash onecc_026.test
## one-infer
bash onecc_027.test
## onecc workflows
bash onecc_032.test
bash onecc_041.test
# Upload log if failed
- name: Upload log
uses: actions/upload-artifact@v4
if: failure()
env:
NNCC_INSTALL_PATH : ${{ env.NNCC_WORKSPACE }}/${{ env.NNCC_INSTALL_PREFIX }}
with:
name: fail-${{ matrix.ubuntu_code }}-${{ matrix.type }}
path: |
${{ env.NNCC_WORKSPACE }}/compiler/**/*.log
${{ env.NNCC_INSTALL_PATH }}/test/**/*.log