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