qemu/.gitlab-ci.d/opensbi.yml
<<
>>
Prefs
   1# All jobs needing docker-opensbi must use the same rules it uses.
   2.opensbi_job_rules:
   3 rules: # Only run this job when ...
   4 - changes:
   5   # this file is modified
   6   - .gitlab-ci.d/opensbi.yml
   7   # or the Dockerfile is modified
   8   - .gitlab-ci.d/opensbi/Dockerfile
   9   when: on_success
  10 - changes: # or roms/opensbi/ is modified (submodule updated)
  11   - roms/opensbi/*
  12   when: on_success
  13 - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' # or the branch/tag starts with 'opensbi'
  14   when: on_success
  15 - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i' # or last commit description contains 'OpenSBI'
  16   when: on_success
  17
  18docker-opensbi:
  19 extends: .opensbi_job_rules
  20 stage: containers
  21 image: docker:19.03.1
  22 services:
  23 - docker:19.03.1-dind
  24 variables:
  25  GIT_DEPTH: 3
  26  IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
  27  # We don't use TLS
  28  DOCKER_HOST: tcp://docker:2375
  29  DOCKER_TLS_CERTDIR: ""
  30 before_script:
  31 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  32 script:
  33 - docker pull $IMAGE_TAG || true
  34 - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  35                                        --tag $IMAGE_TAG .gitlab-ci.d/opensbi
  36 - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  37 - docker push $IMAGE_TAG
  38
  39build-opensbi:
  40 extends: .opensbi_job_rules
  41 stage: build
  42 needs: ['docker-opensbi']
  43 artifacts:
  44   paths: # 'artifacts.zip' will contains the following files:
  45   - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
  46   - pc-bios/opensbi-riscv32-generic-fw_dynamic.elf
  47   - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
  48   - pc-bios/opensbi-riscv64-generic-fw_dynamic.elf
  49   - opensbi32-generic-stdout.log
  50   - opensbi32-generic-stderr.log
  51   - opensbi64-generic-stdout.log
  52   - opensbi64-generic-stderr.log
  53 image: $CI_REGISTRY_IMAGE:opensbi-cross-build
  54 variables:
  55   GIT_DEPTH: 3
  56 script: # Clone the required submodules and build OpenSBI
  57 - git submodule update --init roms/opensbi
  58 - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1))
  59 - echo "=== Using ${JOBS} simultaneous jobs ==="
  60 - make -j${JOBS} -C roms/opensbi clean
  61 - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2
  62 - make -j${JOBS} -C roms/opensbi clean
  63 - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2
  64