|
13 | 13 | workflow_dispatch: |
14 | 14 |
|
15 | 15 | jobs: |
16 | | - pre-test: |
17 | | - runs-on: ubuntu-latest |
18 | | - outputs: |
19 | | - #selfhosted: 0 |
20 | | - selfhosted: ${{ (github.repository_owner == 'FreeRADIUS') && '1' || '0' }} |
21 | | - steps: |
22 | | - - run: echo "Pre-test job; checking if using self-hosted runners" |
23 | | - |
24 | | - # Job only runs on GitHub-hosted runners |
25 | | - test-5hs-autoaccept: |
26 | | - needs: pre-test |
27 | | - runs-on: ubuntu-24.04 |
28 | | - if: ${{ needs.pre-test.outputs.selfhosted != '1' }} |
29 | | - |
30 | | - env: |
31 | | - MULTI_SERVER_ENV_DOCKER_BUILD_OS: ubuntu24 |
32 | | - MULTI_SERVER_TEST_LOG: build/tests/multi-server/freeradius-multi-server/multi_server_test.log |
33 | | - MULTI_SERVER_TEST_LISTENER_LOG: build/tests/multi-server/freeradius-listener-logs/custom_test-env-5hs-autoaccept.txt.bak |
34 | | - |
35 | | - steps: |
36 | | - # Checkout, but defer pulling LFS objects until we've restored the cache |
37 | | - - uses: actions/checkout@v4 |
38 | | - with: |
39 | | - lfs: false |
40 | | - |
41 | | - - name: Package manager performance improvements |
42 | | - run: | |
43 | | - sudo sh -c 'echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/02speedup' |
44 | | - echo 'man-db man-db/auto-update boolean false' | sudo debconf-set-selections |
45 | | - sudo dpkg-reconfigure man-db |
46 | | - sudo sed -i 's/^update_initramfs=.*/update_initramfs=no/' /etc/initramfs-tools/update-initramfs.conf |
47 | | -
|
48 | | - - name: NetworkRADIUS signing key |
49 | | - shell: bash |
50 | | - run: | |
51 | | - sudo install -d -o root -g root -m 0755 /etc/apt/keyrings |
52 | | - curl -s 'https://packages.inkbridgenetworks.com/pgp/packages.networkradius.com.asc' | sudo tee /etc/apt/keyrings/packages.networkradius.com.asc > /dev/null |
53 | | -
|
54 | | - - name: Set up NetworkRADIUS extras repository |
55 | | - shell: bash |
56 | | - run: | |
57 | | - DIST=$(lsb_release -is | tr '[:upper:]' '[:lower:]') |
58 | | - RELEASE=$(lsb_release -cs) |
59 | | - sudo /bin/sh -c "echo \"deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.networkradius.com.asc] http://packages.networkradius.com/extras/${DIST}/${RELEASE} ${RELEASE} main\" \ |
60 | | - > /etc/apt/sources.list.d/networkradius-extras.list" |
61 | | - sudo apt-get update |
62 | | -
|
63 | | - # Remove pre-installed package which conflicts with dependency installation |
64 | | - - name: Remove package conflicts |
65 | | - run: | |
66 | | - sudo apt-get remove -y libhashkit2 |
67 | | -
|
68 | | - # Installing build dependencies requires a ubuntu-24.04 runner |
69 | | - - name: Install build dependencies |
70 | | - run: | |
71 | | - sudo apt-get install -y --no-install-recommends build-essential devscripts equivs quilt |
72 | | - debian/rules debian/control |
73 | | - sudo mk-build-deps -irt"apt-get -y --no-install-recommends" debian/control |
74 | | - sudo mk-build-deps -irt"apt-get -y --no-install-recommends" scripts/ci/extra-packages.debian.control |
75 | | -
|
76 | | - - name: Build Docker image for multi-server test environment |
77 | | - run: | |
78 | | - ./configure |
79 | | - make docker.${MULTI_SERVER_ENV_DOCKER_BUILD_OS}.build |
80 | | -
|
81 | | - # List all images |
82 | | - docker images --all |
83 | | -
|
84 | | - # Tag freeradius build image using using a non-OS specific name to be used with the multi-server docker compose environment. |
85 | | - docker tag freeradius4/${MULTI_SERVER_ENV_DOCKER_BUILD_OS}:latest freeradius-build:latest |
86 | | -
|
87 | | - - name: Run test-5hs-autoaccept test |
88 | | - run: | |
89 | | - if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^freeradius-build:latest$"; then |
90 | | - echo "Error: freeradius-build:latest Docker image not found and required for multi-server test environment." |
91 | | - exit 1 |
92 | | - fi |
93 | | - make -f src/tests/multi-server/all.mk test-5hs-autoaccept VERBOSE=4 |
94 | | -
|
95 | | - - name: Verify test results |
96 | | - shell: bash |
97 | | - run: | |
98 | | - set -euo pipefail |
99 | | -
|
100 | | - echo "============ ${MULTI_SERVER_TEST_LOG} ============" |
101 | | - cat "${MULTI_SERVER_TEST_LOG}" |
102 | | -
|
103 | | - if grep -q '\[Failed\]' "${MULTI_SERVER_TEST_LOG}"; then |
104 | | - echo "TEST FAILED: Found [Failed] in log" |
105 | | - grep '\[Failed\]' "${MULTI_SERVER_TEST_LOG}" |
106 | | -
|
107 | | - # Display the framework's listener log for debugging purposes |
108 | | - echo "============ ${MULTI_SERVER_TEST_LISTENER_LOG} ============" |
109 | | - cat "${MULTI_SERVER_TEST_LISTENER_LOG}" |
110 | | - exit 1 |
111 | | - fi |
112 | | -
|
113 | | - if grep -Eq '\(Failures:[[:space:]]*[1-9][0-9]*[[:space:]]*\)' "${MULTI_SERVER_TEST_LOG}"; then |
114 | | - echo "TEST FAILED: Found Failures > 0 in log" |
115 | | - grep -E '\(Failures:[[:space:]]*[1-9][0-9]*[[:space:]]*\)' "${MULTI_SERVER_TEST_LOG}" |
116 | | -
|
117 | | - # Display the framework's listener log for debugging purposes |
118 | | - echo "============ ${MULTI_SERVER_TEST_LISTENER_LOG} ============" |
119 | | - cat "${MULTI_SERVER_TEST_LISTENER_LOG}" |
120 | | - exit 1 |
121 | | - fi |
122 | | -
|
123 | | - log="${MULTI_SERVER_TEST_LOG}" |
124 | | - if awk ' |
125 | | - BEGIN { found=0; n1=0; n2=0; line="" } |
126 | | - index($0,"Matched:") { |
127 | | - orig=$0 |
128 | | - s=$0 |
129 | | - gsub(/[[:space:]]/, "", s) |
130 | | - sub(/^.*Matched:/, "", s) |
131 | | - sub(/\(.*/, "", s) |
132 | | - n = split(s, parts, "/") |
133 | | - if (n == 2) { |
134 | | - a = parts[1] + 0 |
135 | | - b = parts[2] + 0 |
136 | | - if (a > 0 && a == b) { found=1; n1=a; n2=b; line=orig } |
137 | | - } |
138 | | - } |
139 | | - END { |
140 | | - if (found) { printf "MATCH: %d / %d\nMatched line: %s\n", n1, n2, line; exit 0 } |
141 | | - exit 1 |
142 | | - } |
143 | | - ' "$log" |
144 | | - then |
145 | | - : # PASS |
146 | | - else |
147 | | - echo "TEST FAILED: No Matched line found with equal non-zero counts" |
148 | | - # Display the framework's listener log for debugging purposes |
149 | | - echo "============ ${MULTI_SERVER_TEST_LISTENER_LOG} ============" |
150 | | - cat "${MULTI_SERVER_TEST_LISTENER_LOG}" |
151 | | - exit 1 |
152 | | - fi |
153 | | -
|
154 | | - # Job only runs on self-hosted runners |
155 | 16 | test-5hs-autoaccept-selfhosted: |
156 | | - needs: pre-test |
157 | 17 | runs-on: self-hosted |
158 | | - if: ${{ needs.pre-test.outputs.selfhosted == '1' }} |
159 | 18 |
|
160 | 19 | services: |
161 | 20 | dind: |
@@ -209,38 +68,14 @@ jobs: |
209 | 68 | run: | |
210 | 69 | echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin https://docker.internal.networkradius.com/ |
211 | 70 |
|
212 | | - - name: Get pre-built Docker image for self-hosted runner test |
213 | | - shell: bash |
214 | | - env: |
215 | | - DOCKER_REGISTRY: docker.internal.networkradius.com |
216 | | - DOCKER_IMAGE: self-hosted-ubuntu24 |
| 71 | + - name: Build Docker image from source |
217 | 72 | run: | |
218 | | - docker pull "${DOCKER_REGISTRY}/${DOCKER_IMAGE}" |
219 | | -
|
220 | | - # Tag freeradius build image using using a non-OS specific name to be used with the multi-server docker compose environment. |
221 | | - docker tag "${DOCKER_REGISTRY}/${DOCKER_IMAGE}" freeradius-build:latest |
222 | | -
|
223 | | - # Display all docker images for debugging purposes |
| 73 | + make docker.ubuntu24.build |
| 74 | + docker tag freeradius4/ubuntu24:latest freeradius-build:latest |
224 | 75 | docker images --all |
225 | 76 |
|
226 | | - - name: Configure and build freeradius-server from src |
227 | | - shell: bash |
228 | | - run: | |
229 | | - # The multi-server test framework requires the availability of the $BUILD_DIR, hence why |
230 | | - # the following is needed before running multi-server tests. |
231 | | - ./configure |
232 | | - make -j"$(nproc)" all |
233 | | -
|
234 | 77 | - name: Run test-5hs-autoaccept test |
235 | | - shell: bash |
236 | 78 | run: | |
237 | | - if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^freeradius-build:latest$"; then |
238 | | - echo "Error: freeradius-build:latest Docker image not found and required for multi-server test environment." |
239 | | - exit 1 |
240 | | - fi |
241 | | -
|
242 | | - ls -l |
243 | | - which make |
244 | 79 | make -f src/tests/multi-server/all.mk test-5hs-autoaccept |
245 | 80 |
|
246 | 81 | - name: Verify test results |
|
0 commit comments