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