gitlab ci: restructure 'tests' stage
This commit is contained in:
parent
b14862f143
commit
023fbf53dc
|
@ -29,13 +29,54 @@ static-code-analysis:
|
|||
script:
|
||||
- "./test/static_code_analysis.sh"
|
||||
|
||||
pmbootstrap-tests:
|
||||
test-aports:
|
||||
stage: tests
|
||||
script:
|
||||
# Note: This script uses CI_PROJECT_DIR
|
||||
- su pmos -c "CI_PROJECT_DIR=$CI_PROJECT_DIR .gitlab/shared-runner-tests.sh"
|
||||
- su pmos -c "CI_PROJECT_DIR=$CI_PROJECT_DIR .gitlab/shared-runner_test-aports.sh"
|
||||
after_script:
|
||||
# Move logs so it can be saved as artifacts
|
||||
# Move logs so it can be saved as artifacts
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log.txt $CI_PROJECT_DIR/log.txt"
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log_testsuite.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log_testsuite.txt $CI_PROJECT_DIR/log_testsuite.txt"
|
||||
- "[[ -f /home/pmos/.config/pmbootstrap.cfg ]] && cp /home/pmos/.config/pmbootstrap.cfg $CI_PROJECT_DIR/pmbootstrap.cfg"
|
||||
- "sudo dmesg > $CI_PROJECT_DIR/dmesg.txt"
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- "log.txt"
|
||||
- "log_testsuite.txt"
|
||||
- "dmesg.txt"
|
||||
- "pmbootstrap.cfg"
|
||||
expire_in: 1 week
|
||||
|
||||
test-upstream-compat:
|
||||
stage: tests
|
||||
script:
|
||||
# Note: This script uses CI_PROJECT_DIR
|
||||
- su pmos -c "CI_PROJECT_DIR=$CI_PROJECT_DIR .gitlab/shared-runner_test-upstream-compat.sh"
|
||||
after_script:
|
||||
# Move logs so it can be saved as artifacts
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log.txt $CI_PROJECT_DIR/log.txt"
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log_testsuite.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log_testsuite.txt $CI_PROJECT_DIR/log_testsuite.txt"
|
||||
- "[[ -f /home/pmos/.config/pmbootstrap.cfg ]] && cp /home/pmos/.config/pmbootstrap.cfg $CI_PROJECT_DIR/pmbootstrap.cfg"
|
||||
- "sudo dmesg > $CI_PROJECT_DIR/dmesg.txt"
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- "log.txt"
|
||||
- "log_testsuite.txt"
|
||||
- "dmesg.txt"
|
||||
- "pmbootstrap.cfg"
|
||||
expire_in: 1 week
|
||||
|
||||
|
||||
test-pmbootstrap:
|
||||
stage: tests
|
||||
script:
|
||||
# Note: This script uses CI_PROJECT_DIR
|
||||
- su pmos -c "CI_PROJECT_DIR=$CI_PROJECT_DIR .gitlab/shared-runner_test-pmbootstrap.sh"
|
||||
after_script:
|
||||
# Move logs so it can be saved as artifacts
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log.txt $CI_PROJECT_DIR/log.txt"
|
||||
- "[[ -f /home/pmos/.local/var/pmbootstrap/log_testsuite.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log_testsuite.txt $CI_PROJECT_DIR/log_testsuite.txt"
|
||||
- "[[ -f /home/pmos/.config/pmbootstrap.cfg ]] && cp /home/pmos/.config/pmbootstrap.cfg $CI_PROJECT_DIR/pmbootstrap.cfg"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script is meant to be executed by a non-root user, since pmbootstrap
|
||||
# commands will fail otherwise. This is primarily used by the gitlab CI shared
|
||||
# runners.
|
||||
# This script also assumes, if run outside a gitlab CI runner, that cwd is
|
||||
# the root of the pmbootstrap project. For gitlab CI runners, $CI_PROJECT_DIR
|
||||
# is used.
|
||||
# Author: Clayton Craft <clayton@craftyguy.net>
|
||||
|
||||
# Return failure on any failure of commands below
|
||||
set -e
|
||||
|
||||
# Fail quickly if run as root, since other commands here will fail
|
||||
[[ "$(id -u)" != "0" ]]
|
||||
|
||||
# These are specific to the gitlab CI
|
||||
[[ $CI_PROJECT_DIR ]] && cd "$CI_PROJECT_DIR"
|
||||
# shellcheck disable=SC1091
|
||||
[[ -d venv ]] && source ./venv/bin/activate
|
||||
|
||||
# Init test (pipefail disabled so 'yes' doesn't fail test)
|
||||
set +o pipefail
|
||||
yes ''| ./pmbootstrap.py init
|
||||
set -o pipefail
|
||||
|
||||
# kconfig_check
|
||||
./pmbootstrap.py kconfig check
|
||||
|
||||
# test_aports
|
||||
python -m pytest -vv --cov=pmb --tb=native ./test/test_aports.py
|
||||
|
||||
# check_checksums
|
||||
./test/check_checksums.py --build
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
# Return failure on any failure of commands below
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Fail quickly if run as root, since other commands here will fail
|
||||
[[ "$(id -u)" != "0" ]]
|
||||
|
@ -25,12 +24,6 @@ set +o pipefail
|
|||
yes ''| ./pmbootstrap.py init
|
||||
set -o pipefail
|
||||
|
||||
# kconfig_check
|
||||
./pmbootstrap.py kconfig check
|
||||
|
||||
# check_checksums
|
||||
./test/check_checksums.py --build
|
||||
|
||||
# this seems to be needed for some tests to pass
|
||||
set +o pipefail
|
||||
yes | ./pmbootstrap.py zap -m -p
|
||||
|
@ -38,4 +31,3 @@ set -o pipefail
|
|||
|
||||
# testcases_fast (qemu is omitted by not passing --all)
|
||||
./test/testcases_fast.sh
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script is meant to be executed by a non-root user, since pmbootstrap
|
||||
# commands will fail otherwise. This is primarily used by the gitlab CI shared
|
||||
# runners.
|
||||
# This script also assumes, if run outside a gitlab CI runner, that cwd is
|
||||
# the root of the pmbootstrap project. For gitlab CI runners, $CI_PROJECT_DIR
|
||||
# is used.
|
||||
# Author: Clayton Craft <clayton@craftyguy.net>
|
||||
|
||||
# Return failure on any failure of commands below
|
||||
set -e
|
||||
|
||||
# Fail quickly if run as root, since other commands here will fail
|
||||
[[ "$(id -u)" != "0" ]]
|
||||
|
||||
# These are specific to the gitlab CI
|
||||
[[ $CI_PROJECT_DIR ]] && cd "$CI_PROJECT_DIR"
|
||||
# shellcheck disable=SC1091
|
||||
[[ -d venv ]] && source ./venv/bin/activate
|
||||
|
||||
# These tests are meant to only run on the master branch
|
||||
[[ $CI_COMMIT_REF_NAME != *"master"* ]] && echo "Not on master branch, so skipping tests here." && exit 0
|
||||
|
||||
# Init test (pipefail disabled so 'yes' doesn't fail test)
|
||||
set +o pipefail
|
||||
yes ''| ./pmbootstrap.py init
|
||||
set -o pipefail
|
||||
|
||||
# test_aportgen
|
||||
python -m pytest -vv --cov=pmb --tb=native ./test/test_aportgen.py
|
||||
|
||||
# test_soname_bump
|
||||
python -m pytest -vv --cov=pmb --tb=native ./test/test_soname_bump.py
|
||||
|
||||
# test_upstream_compatibility
|
||||
python -m pytest -vv --cov=pmb --tb=native ./test/test_upstream_compatibility.py
|
|
@ -47,7 +47,9 @@ sh_files="
|
|||
./helpers/envsetup.sh
|
||||
./helpers/envkernel.sh
|
||||
./.gitlab/setup-pmos-environment.sh
|
||||
./.gitlab/shared-runner-tests.sh
|
||||
./.gitlab/shared-runner_test-aports.sh
|
||||
./.gitlab/shared-runner_test-pmbootstrap.sh
|
||||
./.gitlab/shared-runner_test-upstream-compat.sh
|
||||
$(find . -path './aports/main/postmarketos-ui-hildon/*.sh')
|
||||
$(find . -name '*.trigger')
|
||||
$(find . -path './aports/main/devicepkg-dev/*.sh')
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/sh -e
|
||||
# usage: testcases_fast.sh [--all]
|
||||
|
||||
# Disable slow testcases
|
||||
disabled="qemu_running_processes"
|
||||
# Disable QEMU and aports/upstream compatibility tests
|
||||
# (These run with different CI runners in parallel, see #1610)
|
||||
disabled="aports aportgen upstream_compatibility soname_bump qemu_running_processes"
|
||||
|
||||
# Optionally enable all test cases
|
||||
if [ "$1" = "--all" ]; then
|
||||
|
|
Loading…
Reference in New Issue