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        roms/SLOF $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
47    - meson subprojects download $(cd build/subprojects && echo *)
48    - cd build
49    - find . -type f -exec touch {} +
50    # Avoid recompiling by hiding ninja with NINJA=":"
51    - make NINJA=":" $MAKE_CHECK_ARGS
52
53.native_test_job_template:
54  extends: .common_test_job_template
55  artifacts:
56    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
57    expire_in: 7 days
58    paths:
59      - build/meson-logs/testlog.txt
60    reports:
61      junit: build/meson-logs/testlog.junit.xml
62
63.avocado_test_job_template:
64  extends: .common_test_job_template
65  cache:
66    key: "${CI_JOB_NAME}-cache"
67    paths:
68      - ${CI_PROJECT_DIR}/avocado-cache
69    policy: pull-push
70  artifacts:
71    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
72    when: on_failure
73    expire_in: 7 days
74    paths:
75      - build/tests/results/latest/results.xml
76      - build/tests/results/latest/test-results
77    reports:
78      junit: build/tests/results/latest/results.xml
79  before_script:
80    - mkdir -p ~/.config/avocado
81    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
82    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
83           >> ~/.config/avocado/avocado.conf
84    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
85           >> ~/.config/avocado/avocado.conf
86    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
87        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
88      fi
89    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
90  after_script:
91    - cd build
92    - du -chs ${CI_PROJECT_DIR}/avocado-cache
93  variables:
94    QEMU_JOB_AVOCADO: 1
95