d7d4ecd0eb542ae43306aec1b32eaeb84ee0ee7b
[feed/telephony.git] / .github / workflows / entrypoint.sh
1 #!/bin/sh
2
3 mkdir -p /var/lock/
4
5 opkg update
6
7 [ -n "$CI_HELPER" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh"
8
9 for PKG in /ci/*.ipk; do
10 tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
11 # package name including variant
12 PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
13 # package version without release
14 PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
15 # package source contianing test.sh script
16 PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
17
18 echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
19
20 opkg install "$PKG"
21
22 export PKG_NAME PKG_VERSION CI_HELPER
23
24 TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
25
26 if [ -f "$TEST_SCRIPT" ]; then
27 echo "Use package specific test.sh"
28 if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
29 echo "Test succesful"
30 else
31 echo "Test failed"
32 exit 1
33 fi
34 else
35 echo "No test.sh script available"
36 fi
37
38 opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove
39 done