xref: /openbmc/qemu/.gitlab-ci.d/opensbi.yml (revision 6e131bf69b98fbe74cc02b5a910fa2dc5bb7962e)
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:
4*6e131bf6SDaniel P. Berrangé    # Forks don't get pipelines unless QEMU_CI=1 or QEMU_CI=2 is set
5*6e131bf6SDaniel P. Berrangé    - if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != "qemu-project"'
6*6e131bf6SDaniel P. Berrangé      when: never
7*6e131bf6SDaniel P. Berrangé
8*6e131bf6SDaniel P. Berrangé    # In forks, if QEMU_CI=1 is set, then create manual job
9*6e131bf6SDaniel P. Berrangé    # if any files affecting the build output are touched
10*6e131bf6SDaniel P. Berrangé    - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project"'
11*6e131bf6SDaniel P. Berrangé      changes:
12*6e131bf6SDaniel P. Berrangé        - .gitlab-ci.d/opensbi.yml
13*6e131bf6SDaniel P. Berrangé        - .gitlab-ci.d/opensbi/Dockerfile
14*6e131bf6SDaniel P. Berrangé        - roms/opensbi/*
15*6e131bf6SDaniel P. Berrangé      when: manual
16*6e131bf6SDaniel P. Berrangé
17*6e131bf6SDaniel P. Berrangé    # In forks, if QEMU_CI=1 is set, then create manual job
18*6e131bf6SDaniel P. Berrangé    # if the branch/tag starts with 'opensbi'
19*6e131bf6SDaniel P. Berrangé    - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project" && $CI_COMMIT_REF_NAME =~ /^opensbi/'
20*6e131bf6SDaniel P. Berrangé      when: manual
21*6e131bf6SDaniel P. Berrangé
22*6e131bf6SDaniel P. Berrangé    # In forks, if QEMU_CI=1 is set, then create manual job
23*6e131bf6SDaniel P. Berrangé    # if the last commit msg contains 'OpenSBI' (case insensitive)
24*6e131bf6SDaniel P. Berrangé    - if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE != "qemu-project" && $CI_COMMIT_MESSAGE =~ /opensbi/i'
25*6e131bf6SDaniel P. Berrangé      when: manual
26*6e131bf6SDaniel P. Berrangé
2737a2b952SDaniel P. Berrangé    # Run if any files affecting the build output are touched
28922febe2SThomas Huth    - changes:
295117ba25SThomas Huth        - .gitlab-ci.d/opensbi.yml
30922febe2SThomas Huth        - .gitlab-ci.d/opensbi/Dockerfile
310a9487d8SPhilippe Mathieu-Daudé        - roms/opensbi/*
32c217fd8eSPhilippe Mathieu-Daudé      when: on_success
3337a2b952SDaniel P. Berrangé
3437a2b952SDaniel P. Berrangé    # Run if the branch/tag starts with 'opensbi'
3537a2b952SDaniel P. Berrangé    - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/'
36c217fd8eSPhilippe Mathieu-Daudé      when: on_success
3737a2b952SDaniel P. Berrangé
3837a2b952SDaniel P. Berrangé    # Run if the last commit msg contains 'OpenSBI' (case insensitive)
3937a2b952SDaniel P. Berrangé    - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i'
40c217fd8eSPhilippe Mathieu-Daudé      when: on_success
410a9487d8SPhilippe Mathieu-Daudé
420a9487d8SPhilippe Mathieu-Daudédocker-opensbi:
430a9487d8SPhilippe Mathieu-Daudé  extends: .opensbi_job_rules
440a9487d8SPhilippe Mathieu-Daudé  stage: containers
45922febe2SThomas Huth  image: docker:19.03.1
46922febe2SThomas Huth  services:
47922febe2SThomas Huth    - docker:19.03.1-dind
48922febe2SThomas Huth  variables:
49922febe2SThomas Huth    GIT_DEPTH: 3
50922febe2SThomas Huth    IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
51922febe2SThomas Huth    # We don't use TLS
52922febe2SThomas Huth    DOCKER_HOST: tcp://docker:2375
53922febe2SThomas Huth    DOCKER_TLS_CERTDIR: ""
54922febe2SThomas Huth  before_script:
55922febe2SThomas Huth    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
56922febe2SThomas Huth  script:
57922febe2SThomas Huth    - docker pull $IMAGE_TAG || true
58922febe2SThomas Huth    - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
59922febe2SThomas Huth                                           --tag $IMAGE_TAG .gitlab-ci.d/opensbi
60922febe2SThomas Huth    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
61922febe2SThomas Huth    - docker push $IMAGE_TAG
62922febe2SThomas Huth
63922febe2SThomas Huthbuild-opensbi:
640a9487d8SPhilippe Mathieu-Daudé  extends: .opensbi_job_rules
65d0caa0a8SDaniel P. Berrangé  stage: build
6691e9c47eSPhilippe Mathieu-Daudé  needs: ['docker-opensbi']
67922febe2SThomas Huth  artifacts:
68922febe2SThomas Huth    paths: # 'artifacts.zip' will contains the following files:
69a52ea3e7SBin Meng      - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
70a52ea3e7SBin Meng      - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
71a52ea3e7SBin Meng      - opensbi32-generic-stdout.log
72a52ea3e7SBin Meng      - opensbi32-generic-stderr.log
73a52ea3e7SBin Meng      - opensbi64-generic-stdout.log
74a52ea3e7SBin Meng      - opensbi64-generic-stderr.log
75922febe2SThomas Huth  image: $CI_REGISTRY_IMAGE:opensbi-cross-build
76922febe2SThomas Huth  variables:
77922febe2SThomas Huth    GIT_DEPTH: 3
78922febe2SThomas Huth  script: # Clone the required submodules and build OpenSBI
79922febe2SThomas Huth    - git submodule update --init roms/opensbi
80922febe2SThomas Huth    - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1))
81922febe2SThomas Huth    - echo "=== Using ${JOBS} simultaneous jobs ==="
82922febe2SThomas Huth    - make -j${JOBS} -C roms/opensbi clean
83a52ea3e7SBin Meng    - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2
84922febe2SThomas Huth    - make -j${JOBS} -C roms/opensbi clean
85a52ea3e7SBin Meng    - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2
86