qemu/.gitlab-ci.d/buildtest-template.yml
<<
>>
Prefs
   1.native_build_job_template:
   2  stage: build
   3  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   4  before_script:
   5    - JOBS=$(expr $(nproc) + 1)
   6  script:
   7    - if test -n "$LD_JOBS";
   8      then
   9        scripts/git-submodule.sh update meson ;
  10      fi
  11    - mkdir build
  12    - cd build
  13    - if test -n "$TARGETS";
  14      then
  15        ../configure --enable-werror --disable-docs ${LD_JOBS:+--meson=git} $CONFIGURE_ARGS --target-list="$TARGETS" ;
  16      else
  17        ../configure --enable-werror --disable-docs ${LD_JOBS:+--meson=git} $CONFIGURE_ARGS ;
  18      fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
  19    - if test -n "$LD_JOBS";
  20      then
  21        ../meson/meson.py configure . -Dbackend_max_links="$LD_JOBS" ;
  22      fi || exit 1;
  23    - make -j"$JOBS"
  24    - if test -n "$MAKE_CHECK_ARGS";
  25      then
  26        make -j"$JOBS" $MAKE_CHECK_ARGS ;
  27      fi
  28
  29.native_test_job_template:
  30  stage: test
  31  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
  32  script:
  33    - scripts/git-submodule.sh update
  34        $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
  35    - cd build
  36    - find . -type f -exec touch {} +
  37    # Avoid recompiling by hiding ninja with NINJA=":"
  38    - make NINJA=":" $MAKE_CHECK_ARGS
  39
  40.avocado_test_job_template:
  41  extends: .native_test_job_template
  42  cache:
  43    key: "${CI_JOB_NAME}-cache"
  44    paths:
  45      - ${CI_PROJECT_DIR}/avocado-cache
  46    policy: pull-push
  47  artifacts:
  48    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
  49    when: on_failure
  50    expire_in: 7 days
  51    paths:
  52      - build/tests/results/latest/results.xml
  53      - build/tests/results/latest/test-results
  54    reports:
  55      junit: build/tests/results/latest/results.xml
  56  before_script:
  57    - mkdir -p ~/.config/avocado
  58    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
  59    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
  60           >> ~/.config/avocado/avocado.conf
  61    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL", "INTERRUPT"]'
  62           >> ~/.config/avocado/avocado.conf
  63    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
  64        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
  65      fi
  66    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
  67  after_script:
  68    - cd build
  69    - du -chs ${CI_PROJECT_DIR}/avocado-cache
  70  rules:
  71    # Only run these jobs if running on the mainstream namespace,
  72    # or if the user set the QEMU_CI_AVOCADO_TESTING variable (either
  73    # in its namespace setting or via git-push option, see documentation
  74    # in /.gitlab-ci.yml of this repository).
  75    - if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
  76      when: on_success
  77    - if: '$QEMU_CI_AVOCADO_TESTING'
  78      when: on_success
  79    # Otherwise, set to manual (the jobs are created but not run).
  80    - when: manual
  81      allow_failure: true
  82