-
Notifications
You must be signed in to change notification settings - Fork 87
200 lines (174 loc) · 5.26 KB
/
ci.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
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
name: Build OpenWRT Package
on:
push:
paths-ignore:
- '**.md'
branches:
- master
workflow_dispatch:
pull_request:
paths-ignore:
- '**.md'
release:
types:
- created
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev
- name: Build and install libubox
working-directory: /tmp
run: |
git clone https://github.com/openwrt/libubox.git
cd libubox
mkdir build
cd build
cmake .. -DBUILD_LUA=OFF -DBUILD_EXAMPLES=OFF
make
sudo make install
- name: Build and install libuci
working-directory: /tmp
run: |
git clone https://github.com/openwrt/uci.git
cd uci
mkdir build
cd build
cmake .. -DBUILD_LUA=OFF
make
sudo make install
- name: Run unit tests
run: |
cmake -S . -B build -DUA2F_BUILD_TESTS=ON
cmake --build build
./build/ua2f_test
test-standalone:
name: Run unit tests without uci support
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev
- name: Run unit tests
run: |
cmake -S . -B build -DUA2F_BUILD_TESTS=ON -DUA2F_ENABLE_UCI=OFF
cmake --build build
./build/ua2f_test
test-integration:
name: Run integration tests
runs-on: ubuntu-latest
strategy:
matrix:
cache: [ "-DUA2F_NO_CACHE=ON", "-DUA2F_NO_CACHE=OFF" ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install requirements
run: |
pip install -r scripts/requirements.txt --break-system-packages
- name: Enable ipv6
uses: fscarmen/warp-on-actions@v1.3
with:
stack: dual
mode: client
- name: Configure ipv6
run: |
echo "net.ipv6.conf.all.disable_ipv6=0" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6=0" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6=0" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
- name: Debug IPv6
run: |
ip -6 addr
sudo sysctl net.ipv6.conf.all.disable_ipv6
sudo sysctl net.ipv6.conf.default.disable_ipv6
sudo sysctl net.ipv6.conf.lo.disable_ipv6
ping6 -c 4 ::1 || { echo "::1 is not reachable"; exit 1; }
- name: Run unit tests
run: |
cmake -S . -B build -DUA2F_BUILD_TESTS=OFF -DUA2F_ENABLE_UCI=OFF -DUA2F_ENABLE_ASAN=ON ${{ matrix.cache }}
cmake --build build
sudo ./build/ua2f --version
sudo -E $(which python3) scripts/test.py ./build/ua2f
- name: Upload log
uses: actions/upload-artifact@v4
with:
name: syslog-cache-${{ matrix.cache }}
path: /var/log/syslog
build:
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
needs:
- test
- test-standalone
- test-integration
strategy:
fail-fast: false
matrix:
arch:
- aarch64_cortex-a53
- aarch64_cortex-a72
- aarch64_generic
- arm_cortex-a7_neon-vfpv4
- arm_cortex-a9_vfpv3-d16
- arm_cortex-a15_neon-vfpv4
- i386_pentium4
- i386_pentium-mmx
- mips_24kc
- mipsel_24kc
- powerpc_464fp
- powerpc_8548
- x86_64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
uses: openwrt/gh-action-sdk@v7
env:
ARCH: ${{ matrix.arch }}-23.05.5
FEEDNAME: packages_ci
PACKAGES: openwrt
- name: Move created packages to project dir
run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
- name: Store packages
uses: actions/upload-artifact@v4
if: "!startsWith(github.ref, 'refs/tags/v')"
with:
name: ${{ matrix.arch }}-${{ github.sha }}-packages
path: "*.ipk"
- name: Upload packages
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/v')"
with:
repo_token: ${{ github.token }}
file: "*.ipk"
tag: ${{ github.ref }}
file_glob: true
- name: Store logs
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-${{ github.sha }}-logs
path: logs/
- name: Remove logs
run: rm -rf logs/ || true