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