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