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