1.native_build_job_template:
2  extends: .base_job_template
3  stage: build
4  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
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    when: on_success
29    expire_in: 2 days
30    paths:
31      - build
32      - .git-submodule-status
33    exclude:
34      - build/**/*.p
35      - build/**/*.a.p
36      - build/**/*.fa.p
37      - build/**/*.c.o
38      - build/**/*.c.o.d
39      - build/**/*.fa
40
41.common_test_job_template:
42  extends: .base_job_template
43  stage: test
44  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
45  script:
46    - scripts/git-submodule.sh update roms/SLOF
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    when: always
58    expire_in: 7 days
59    paths:
60      - build/meson-logs/testlog.txt
61    reports:
62      junit: build/meson-logs/testlog.junit.xml
63
64.avocado_test_job_template:
65  extends: .common_test_job_template
66  cache:
67    key: "${CI_JOB_NAME}-cache"
68    paths:
69      - ${CI_PROJECT_DIR}/avocado-cache
70    policy: pull-push
71  artifacts:
72    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
73    when: always
74    expire_in: 7 days
75    paths:
76      - build/tests/results/latest/results.xml
77      - build/tests/results/latest/test-results
78    reports:
79      junit: build/tests/results/latest/results.xml
80  before_script:
81    - mkdir -p ~/.config/avocado
82    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
83    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
84           >> ~/.config/avocado/avocado.conf
85    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
86           >> ~/.config/avocado/avocado.conf
87    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
88        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
89      fi
90    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
91  after_script:
92    - cd build
93    - du -chs ${CI_PROJECT_DIR}/avocado-cache
94  variables:
95    QEMU_JOB_AVOCADO: 1
96