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