10a9487d8SPhilippe Mathieu-Daudé# All jobs needing docker-opensbi must use the same rules it uses. 20a9487d8SPhilippe Mathieu-Daudé.opensbi_job_rules: 337a2b952SDaniel P. Berrangé rules: 46e131bf6SDaniel P. Berrangé # Forks don't get pipelines unless QEMU_CI=1 or QEMU_CI=2 is set 56e131bf6SDaniel P. Berrangé - if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != "qemu-project"' 66e131bf6SDaniel P. Berrangé when: never 76e131bf6SDaniel P. Berrangé 86e131bf6SDaniel P. Berrangé # In forks, if QEMU_CI=1 is set, then create manual job 96e131bf6SDaniel P. Berrangé # if any files affecting the build output are touched 106e131bf6SDaniel P. Berrangé - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project"' 116e131bf6SDaniel P. Berrangé changes: 126e131bf6SDaniel P. Berrangé - .gitlab-ci.d/opensbi.yml 136e131bf6SDaniel P. Berrangé - .gitlab-ci.d/opensbi/Dockerfile 146e131bf6SDaniel P. Berrangé - roms/opensbi/* 156e131bf6SDaniel P. Berrangé when: manual 166e131bf6SDaniel P. Berrangé 176e131bf6SDaniel P. Berrangé # In forks, if QEMU_CI=1 is set, then create manual job 186e131bf6SDaniel P. Berrangé # if the branch/tag starts with 'opensbi' 196e131bf6SDaniel P. Berrangé - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project" && $CI_COMMIT_REF_NAME =~ /^opensbi/' 206e131bf6SDaniel P. Berrangé when: manual 216e131bf6SDaniel P. Berrangé 226e131bf6SDaniel P. Berrangé # In forks, if QEMU_CI=1 is set, then create manual job 236e131bf6SDaniel P. Berrangé # if the last commit msg contains 'OpenSBI' (case insensitive) 246e131bf6SDaniel P. Berrangé - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project" && $CI_COMMIT_MESSAGE =~ /opensbi/i' 256e131bf6SDaniel P. Berrangé when: manual 266e131bf6SDaniel P. Berrangé 27*83aa1baaSPaolo Bonzini # Scheduled runs on mainline don't get pipelines except for the special Coverity job 28*83aa1baaSPaolo Bonzini - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_PIPELINE_SOURCE == "schedule"' 29*83aa1baaSPaolo Bonzini when: never 30*83aa1baaSPaolo Bonzini 3137a2b952SDaniel P. Berrangé # Run if any files affecting the build output are touched 32922febe2SThomas Huth - changes: 335117ba25SThomas Huth - .gitlab-ci.d/opensbi.yml 34922febe2SThomas Huth - .gitlab-ci.d/opensbi/Dockerfile 350a9487d8SPhilippe Mathieu-Daudé - roms/opensbi/* 36c217fd8eSPhilippe Mathieu-Daudé when: on_success 3737a2b952SDaniel P. Berrangé 3837a2b952SDaniel P. Berrangé # Run if the branch/tag starts with 'opensbi' 3937a2b952SDaniel P. Berrangé - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' 40c217fd8eSPhilippe Mathieu-Daudé when: on_success 4137a2b952SDaniel P. Berrangé 4237a2b952SDaniel P. Berrangé # Run if the last commit msg contains 'OpenSBI' (case insensitive) 4337a2b952SDaniel P. Berrangé - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i' 44c217fd8eSPhilippe Mathieu-Daudé when: on_success 450a9487d8SPhilippe Mathieu-Daudé 460a9487d8SPhilippe Mathieu-Daudédocker-opensbi: 470a9487d8SPhilippe Mathieu-Daudé extends: .opensbi_job_rules 480a9487d8SPhilippe Mathieu-Daudé stage: containers 49ab725227SDaniel P. Berrangé image: docker:latest 50922febe2SThomas Huth services: 51ab725227SDaniel P. Berrangé - docker:dind 52922febe2SThomas Huth variables: 53922febe2SThomas Huth GIT_DEPTH: 3 54922febe2SThomas Huth IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build 55922febe2SThomas Huth before_script: 56922febe2SThomas Huth - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY 57b105ce60SCamilla Conte - until docker info; do sleep 1; done 58922febe2SThomas Huth script: 59922febe2SThomas Huth - docker pull $IMAGE_TAG || true 60922febe2SThomas Huth - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA 61922febe2SThomas Huth --tag $IMAGE_TAG .gitlab-ci.d/opensbi 62922febe2SThomas Huth - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA 63922febe2SThomas Huth - docker push $IMAGE_TAG 64922febe2SThomas Huth 65922febe2SThomas Huthbuild-opensbi: 660a9487d8SPhilippe Mathieu-Daudé extends: .opensbi_job_rules 67d0caa0a8SDaniel P. Berrangé stage: build 6891e9c47eSPhilippe Mathieu-Daudé needs: ['docker-opensbi'] 69922febe2SThomas Huth artifacts: 70cef63308SDaniel P. Berrangé when: on_success 71922febe2SThomas Huth paths: # 'artifacts.zip' will contains the following files: 72a52ea3e7SBin Meng - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin 73a52ea3e7SBin Meng - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin 74a52ea3e7SBin Meng - opensbi32-generic-stdout.log 75a52ea3e7SBin Meng - opensbi32-generic-stderr.log 76a52ea3e7SBin Meng - opensbi64-generic-stdout.log 77a52ea3e7SBin Meng - opensbi64-generic-stderr.log 78922febe2SThomas Huth image: $CI_REGISTRY_IMAGE:opensbi-cross-build 79922febe2SThomas Huth variables: 80922febe2SThomas Huth GIT_DEPTH: 3 81922febe2SThomas Huth script: # Clone the required submodules and build OpenSBI 82922febe2SThomas Huth - git submodule update --init roms/opensbi 83922febe2SThomas Huth - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1)) 84922febe2SThomas Huth - echo "=== Using ${JOBS} simultaneous jobs ===" 85922febe2SThomas Huth - make -j${JOBS} -C roms/opensbi clean 86a52ea3e7SBin Meng - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2 87922febe2SThomas Huth - make -j${JOBS} -C roms/opensbi clean 88a52ea3e7SBin Meng - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2 89