Merge tag 'pull-testing-gdbstub-plugins-gitdm-061022-3' of https://github.com/stsquad...
[qemu.git] / .gitlab-ci.d / buildtest-template.yml
1 .native_build_job_template:
2   extends: .base_job_template
3   stage: build
4   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
5   before_script:
6     - JOBS=$(expr $(nproc) + 1)
7   script:
8     - if test -n "$LD_JOBS";
9       then
10         scripts/git-submodule.sh update meson ;
11       fi
12     - mkdir build
13     - cd build
14     - if test -n "$TARGETS";
15       then
16         ../configure --enable-werror --disable-docs ${LD_JOBS:+--meson=git} $CONFIGURE_ARGS --target-list="$TARGETS" ;
17       else
18         ../configure --enable-werror --disable-docs ${LD_JOBS:+--meson=git} $CONFIGURE_ARGS ;
19       fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
20     - if test -n "$LD_JOBS";
21       then
22         ../meson/meson.py configure . -Dbackend_max_links="$LD_JOBS" ;
23       fi || exit 1;
24     - make -j"$JOBS"
25     - if test -n "$MAKE_CHECK_ARGS";
26       then
27         make -j"$JOBS" $MAKE_CHECK_ARGS ;
28       fi
29
30 .common_test_job_template:
31   extends: .base_job_template
32   stage: test
33   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
34   script:
35     - scripts/git-submodule.sh update
36         $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
37     - cd build
38     - find . -type f -exec touch {} +
39     # Avoid recompiling by hiding ninja with NINJA=":"
40     - make NINJA=":" $MAKE_CHECK_ARGS
41
42 .native_test_job_template:
43   extends: .common_test_job_template
44   artifacts:
45     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
46     expire_in: 7 days
47     paths:
48       - build/meson-logs/testlog.txt
49     reports:
50       junit: build/meson-logs/testlog.junit.xml
51
52 .avocado_test_job_template:
53   extends: .common_test_job_template
54   cache:
55     key: "${CI_JOB_NAME}-cache"
56     paths:
57       - ${CI_PROJECT_DIR}/avocado-cache
58     policy: pull-push
59   artifacts:
60     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
61     when: on_failure
62     expire_in: 7 days
63     paths:
64       - build/tests/results/latest/results.xml
65       - build/tests/results/latest/test-results
66     reports:
67       junit: build/tests/results/latest/results.xml
68   before_script:
69     - mkdir -p ~/.config/avocado
70     - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
71     - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
72            >> ~/.config/avocado/avocado.conf
73     - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
74            >> ~/.config/avocado/avocado.conf
75     - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
76         du -chs ${CI_PROJECT_DIR}/avocado-cache ;
77       fi
78     - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
79   after_script:
80     - cd build
81     - du -chs ${CI_PROJECT_DIR}/avocado-cache
82   variables:
83     QEMU_JOB_AVOCADO: 1