actions: group scripts that are only relevant to github actions

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2020-03-26 15:44:04 -07:00
parent 18c3cc853e
commit 3019a7adaa
5 changed files with 23 additions and 23 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
set -e
CORES=2
# Install dependencies from ubuntu
sudo apt-get install python3-docutils
sudo apt-get install check
sudo apt-get install bats
sudo ln -s /bin/systemctl /usr/bin/systemctl
# Use rst2man from python3
sudo ln -s /usr/share/docutils/scripts/python3/rst2man /usr/bin/rst2man.py
# build bsdiff
wget https://github.com/clearlinux/bsdiff/releases/download/v1.0.2/bsdiff-1.0.2.tar.xz
tar -xvf bsdiff-1.0.2.tar.xz
pushd bsdiff-1.0.2 && ./configure --prefix=/usr --disable-tests && make -j$CORES && sudo make install && popd
## build curl
wget https://curl.haxx.se/download/curl-7.64.0.tar.gz
tar -xvf curl-7.64.0.tar.gz
pushd curl-7.64.0 && ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu && make -j$CORES && sudo make install && popd
# build libarchive
wget https://github.com/libarchive/libarchive/archive/v3.3.1.tar.gz
tar -xvf v3.3.1.tar.gz
pushd libarchive-3.3.1 && autoreconf -fi && ./configure --prefix=/usr && make -j$CORES && sudo make install && popd
# Build Swupd
autoreconf --verbose --warnings=none --install --force
./configure CFLAGS="$CFLAGS -fsanitize=address -Werror" --prefix=/usr --with-fallback-capaths=./swupd_test_certificates --with-systemdsystemunitdir=/usr/lib/systemd/system --with-config-file-path=./testconfig
make -j$CORES
# Needed to initialize the host for auto-update. Without these steps auto-update
# within a --path would just not work
sudo mkdir -p /usr/lib/systemd/system/
sudo cp data/swupd-update.service /usr/lib/systemd/system/
sudo cp data/swupd-update.timer /usr/lib/systemd/system/
sudo systemctl enable swupd-update.timer
sudo systemctl restart swupd-update.timer
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
set -e
./scripts/github_actions/build_ci.bash
# Install dependencies from ubuntu
sudo apt-get install shellcheck
sudo apt-get install doxygen
sudo pip install coverxygen
# Install new clang-format from llvm repository
wget -O llvm.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm.gpg.key
sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main"
sudo apt-get update
sudo apt-get install -y clang-format-9
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# Filter a list of jobs
# Parameter 1: Job number
# Parameter 2: Number of jobs
#
# To test if any test is missing:
# for i in $(seq $NUM_JOBS); do
# ./scripts/filter_bats_list.bash $i $NUM_JOBS >> list;
# done
JOB_NUM=$1
NUM_JOBS=$2
DEFAULT_WEIGHT=6
TEST_LIST=$(find test/functional/ -name "*.bats" | sort)
TOTAL_WEIGHT=0
for t in $TEST_LIST; do
WEIGHT=$(sed -n -e 's/^#WEIGHT=//p' "$t")
if [ -z "$WEIGHT" ]; then
WEIGHT="$DEFAULT_WEIGHT"
fi
TOTAL_WEIGHT=$((TOTAL_WEIGHT + WEIGHT))
done
NUM_TESTS="$((TOTAL_WEIGHT/(NUM_JOBS)))"
START="$(((JOB_NUM - 1) * NUM_TESTS + 1))"
END="$((JOB_NUM * NUM_TESTS))"
COUNT=0
for t in $TEST_LIST; do
WEIGHT=$(sed -n -e 's/^#WEIGHT=//p' "$t")
if [ -z "$WEIGHT" ]; then
WEIGHT="$DEFAULT_WEIGHT"
fi
COUNT=$((COUNT + WEIGHT))
if [ "$JOB_NUM" -ne "$NUM_JOBS" ] && [ $COUNT -gt $END ]; then
break
fi
if [ $COUNT -ge $START ]; then
echo "$t"
fi
done
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
MAX_WEIGHT=40
if [ -z "$1" ]; then
TESTS=$(find test/functional/ -name "*.bats")
else
TESTS="$*"
fi
for t in $TESTS; do
echo "Running $t"
WEIGHT=$(($(/usr/bin/time -f %e "$t" 2>&1 |tail -n 1 |cut -d '.' -f 1)+1))
echo "$WEIGHT"
if [ $WEIGHT -gt "$MAX_WEIGHT" ]; then
WEIGHT="$MAX_WEIGHT"
fi
sed -i "/#WEIGHT/d" "$t"
echo "#WEIGHT=$WEIGHT" >> "$t"
done