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