-
Notifications
You must be signed in to change notification settings - Fork 108
/
build.sh
executable file
·48 lines (39 loc) · 1.8 KB
/
build.sh
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
#!/bin/bash -e
# This script drives the various tasks involved in testing and building the
# various artifacts for the Pbench product. It is intended to be run from the
# root directory of a Git branch checkout.
# Install the linter requirements and add them to the PATH.
export PATH=${HOME}/.local/bin:${PATH}
python3 -m pip install --user -r lint-requirements.txt
# If this script is run in a container and the user in the container doesn't
# match the owner of the Git checkout, then Git issues an error; these config
# settings avoid the problem.
GITTOP=$(git rev-parse --show-toplevel 2>&1 | head -n 1)
if [[ ${GITTOP} = "fatal: unsafe repository ('/home/root/pbench'"* ]] ; then
git config --global --add safe.directory /home/root/pbench
GITTOP=$(git rev-parse --show-toplevel)
fi
# Install the Dashboard dependencies, including the linter's dependencies and
# the unit test dependencies. First, remove any existing Node modules and
# package-lock.json to ensure that we install the latest.
make -C dashboard clean node_modules
# Test for code style and lint (echo the commands before executing them)
set -x
black --check .
flake8 .
isort --check .
make -C dashboard run_lint
# We need to invoke the alembic check with host networking so that it can reach
# the PostgreSQL pod it creates.
EXTRA_PODMAN_SWITCHES="--network host" jenkins/run tox -e alembic-migration -- check
set +x
# Run unit tests
tox # Agent and Server unit tests and legacy tests
make -C dashboard run_unittests # Dashboard unit tests
# Build RPMS for the Server and Agent and build the Dashboard deployment
make -C server/rpm distclean # Cleans all RPMs, both Server and Agent.
make -C server/rpm ci
make -C agent/rpm ci
make -C dashboard build
# Display our victory
ls -l "${HOME}"/rpmbuild*/RPMS/noarch/*