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# We jump some hoops in common_test_job_template to avoid
29# rebuilding all the object files we skip in the artifacts
30.native_build_artifact_template:
31  artifacts:
32    expire_in: 2 days
33    paths:
34      - build
35      - .git-submodule-status
36    exclude:
37      - build/**/*.p
38      - build/**/*.a.p
39      - build/**/*.fa.p
40      - build/**/*.c.o
41      - build/**/*.c.o.d
42      - build/**/*.fa
43
44.common_test_job_template:
45  extends: .base_job_template
46  stage: test
47  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
48  script:
49    - scripts/git-submodule.sh update
50        $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
51    - cd build
52    - find . -type f -exec touch {} +
53    # Avoid recompiling by hiding ninja with NINJA=":"
54    - make NINJA=":" $MAKE_CHECK_ARGS
55
56.native_test_job_template:
57  extends: .common_test_job_template
58  artifacts:
59    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
60    expire_in: 7 days
61    paths:
62      - build/meson-logs/testlog.txt
63    reports:
64      junit: build/meson-logs/testlog.junit.xml
65
66.avocado_test_job_template:
67  extends: .common_test_job_template
68  cache:
69    key: "${CI_JOB_NAME}-cache"
70    paths:
71      - ${CI_PROJECT_DIR}/avocado-cache
72    policy: pull-push
73  artifacts:
74    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
75    when: on_failure
76    expire_in: 7 days
77    paths:
78      - build/tests/results/latest/results.xml
79      - build/tests/results/latest/test-results
80    reports:
81      junit: build/tests/results/latest/results.xml
82  before_script:
83    - mkdir -p ~/.config/avocado
84    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
85    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
86           >> ~/.config/avocado/avocado.conf
87    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
88           >> ~/.config/avocado/avocado.conf
89    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
90        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
91      fi
92    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
93  after_script:
94    - cd build
95    - du -chs ${CI_PROJECT_DIR}/avocado-cache
96  variables:
97    QEMU_JOB_AVOCADO: 1
98