-
Notifications
You must be signed in to change notification settings - Fork 15
155 lines (133 loc) · 4.84 KB
/
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: PR build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
BUILD_TYPE: Debug
jobs:
build_x86_Linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-conan-action
- name: Conan install
if: matrix.os == 'ubuntu-latest'
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
export conan_profile=linux
elif [ "$RUNNER_OS" == "Windows" ]; then
export conan_profile=windows
else
echo "$RUNNER_OS not supported"
exit 1
fi
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
conan install ../conan/conanfile_${conan_profile}.txt -of=./ -pr:b ../conan/profile_${conan_profile}_x86_64.txt -pr:h ../conan/profile_${conan_profile}_x86_64.txt --build=missing -s build_type=${{env.BUILD_TYPE}}
- name: Install Gcovr
if: matrix.os == 'ubuntu-latest'
run:
- name: Configure CMake
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
export coverage=ON
elif [ "$RUNNER_OS" == "Windows" ]; then
export coverage=OFF
else
echo "$RUNNER_OS not supported"
exit 1
fi
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCODE_COVERAGE=${coverage} -DBUILD_UNIT_TESTS=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
make coverage_xml
elif [ "$RUNNER_OS" == "Windows" ]; then
make test
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: coverage
path: build/coverage_xml.xml
build_NuttX:
runs-on: ubuntu-latest
env:
nuttx_version: 3dc6b4c9bd9624ed259e676f8e9761dbf660c1bb
nuttx_apps_version: nuttx-12.5.0-RC0
arm_none_eabi_version: 13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
steps:
- name: checkout KickCAT
uses: actions/checkout@v4
with:
path: 'KickCAT'
- name: Cache NuttX
id: cache-nuttx
uses: actions/cache@v4
with:
path: ${{GITHUB.WORKSPACE}}/nuttxspace/nuttx
key: nuttx_${{env.nuttx_version}}
- if: ${{ steps.cache-nuttx.outputs.cache-hit != 'true' }}
name: checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/nuttx
path: 'nuttxspace/nuttx'
ref: '${{env.nuttx_version}}'
- name: Cache NuttX Apps
id: cache-nuttx-apps
uses: actions/cache@v4
with:
path: ${{GITHUB.WORKSPACE}}/nuttxspace/apps
key: nuttx-apps_${{env.nuttx_apps_version}}
- if: ${{ steps.cache-nuttx-apps.outputs.cache-hit != 'true' }}
name: checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/nuttx-apps
path: 'nuttxspace/apps'
ref: '${{env.nuttx_apps_version}}'
- name: apt update
run: sudo apt update
- name: Install Kconfig
run: sudo apt install kconfig-frontends
- name: Cache Arm None Eabi
id: cache-arm-none-eabi
uses: actions/cache@v4
with:
path: ${{GITHUB.WORKSPACE}}/gcc-arm-none-eabi
key: ${{env.arm_none_eabi_version}}
- if: ${{ steps.cache-arm-none-eabi.outputs.cache-hit != 'true' }}
name: Download gcc-arm-none-eabi
run: |
# Download the latest ARM GCC toolchain prebuilt by ARM
mkdir gcc-arm-none-eabi && \
curl -s -L "https://developer.arm.com/-/media/Files/downloads/gnu/${{env.arm_none_eabi_version}}.tar.xz" \
| tar -C gcc-arm-none-eabi --strip-components 1 -xJ
- name: Build
run: |
set -x
export PATH="${{GITHUB.WORKSPACE}}/gcc-arm-none-eabi/bin:$PATH"
mkdir build_slave
nuttx_src=${{GITHUB.WORKSPACE}}/nuttxspace/nuttx
build=${{GITHUB.WORKSPACE}}/build_slave
src=${{GITHUB.WORKSPACE}}/KickCAT
cp ${src}/examples/slave/nuttx/xmc4800/boards/relax/defconfig ${nuttx_src}/boards/arm/xmc4/xmc4800-relax/configs/nsh/defconfig
${nuttx_src}/tools/configure.sh -l xmc4800-relax:nsh
make -C ${nuttx_src} export
mkdir ${build}/nuttx-export
tar xf ${nuttx_src}/nuttx-export-*.tar.gz --strip-components=1 -C ${build}/nuttx-export
cmake -B ${build} -S ${src} -DCMAKE_TOOLCHAIN_FILE=${build}/nuttx-export/scripts/toolchain.cmake
make -C ${build}