xref: /openbmc/qemu/.gitlab-ci.d/opensbi.yml (revision 37a2b95231d6699536820c8ff0ca3f5ba8356184)
10a9487d8SPhilippe Mathieu-Daudé# All jobs needing docker-opensbi must use the same rules it uses.
20a9487d8SPhilippe Mathieu-Daudé.opensbi_job_rules:
3*37a2b952SDaniel P. Berrangé  rules:
4*37a2b952SDaniel P. Berrangé    # Run if any files affecting the build output are touched
5922febe2SThomas Huth    - changes:
65117ba25SThomas Huth        - .gitlab-ci.d/opensbi.yml
7922febe2SThomas Huth        - .gitlab-ci.d/opensbi/Dockerfile
80a9487d8SPhilippe Mathieu-Daudé        - roms/opensbi/*
9c217fd8eSPhilippe Mathieu-Daudé      when: on_success
10*37a2b952SDaniel P. Berrangé
11*37a2b952SDaniel P. Berrangé    # Run if the branch/tag starts with 'opensbi'
12*37a2b952SDaniel P. Berrangé    - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/'
13c217fd8eSPhilippe Mathieu-Daudé      when: on_success
14*37a2b952SDaniel P. Berrangé
15*37a2b952SDaniel P. Berrangé    # Run if the last commit msg contains 'OpenSBI' (case insensitive)
16*37a2b952SDaniel P. Berrangé    - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i'
17c217fd8eSPhilippe Mathieu-Daudé      when: on_success
180a9487d8SPhilippe Mathieu-Daudé
190a9487d8SPhilippe Mathieu-Daudédocker-opensbi:
200a9487d8SPhilippe Mathieu-Daudé  extends: .opensbi_job_rules
210a9487d8SPhilippe Mathieu-Daudé  stage: containers
22922febe2SThomas Huth  image: docker:19.03.1
23922febe2SThomas Huth  services:
24922febe2SThomas Huth    - docker:19.03.1-dind
25922febe2SThomas Huth  variables:
26922febe2SThomas Huth    GIT_DEPTH: 3
27922febe2SThomas Huth    IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
28922febe2SThomas Huth    # We don't use TLS
29922febe2SThomas Huth    DOCKER_HOST: tcp://docker:2375
30922febe2SThomas Huth    DOCKER_TLS_CERTDIR: ""
31922febe2SThomas Huth  before_script:
32922febe2SThomas Huth    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
33922febe2SThomas Huth  script:
34922febe2SThomas Huth    - docker pull $IMAGE_TAG || true
35922febe2SThomas Huth    - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
36922febe2SThomas Huth                                           --tag $IMAGE_TAG .gitlab-ci.d/opensbi
37922febe2SThomas Huth    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
38922febe2SThomas Huth    - docker push $IMAGE_TAG
39922febe2SThomas Huth
40922febe2SThomas Huthbuild-opensbi:
410a9487d8SPhilippe Mathieu-Daudé  extends: .opensbi_job_rules
42d0caa0a8SDaniel P. Berrangé  stage: build
4391e9c47eSPhilippe Mathieu-Daudé  needs: ['docker-opensbi']
44922febe2SThomas Huth  artifacts:
45922febe2SThomas Huth    paths: # 'artifacts.zip' will contains the following files:
46a52ea3e7SBin Meng      - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
47a52ea3e7SBin Meng      - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
48a52ea3e7SBin Meng      - opensbi32-generic-stdout.log
49a52ea3e7SBin Meng      - opensbi32-generic-stderr.log
50a52ea3e7SBin Meng      - opensbi64-generic-stdout.log
51a52ea3e7SBin Meng      - opensbi64-generic-stderr.log
52922febe2SThomas Huth  image: $CI_REGISTRY_IMAGE:opensbi-cross-build
53922febe2SThomas Huth  variables:
54922febe2SThomas Huth    GIT_DEPTH: 3
55922febe2SThomas Huth  script: # Clone the required submodules and build OpenSBI
56922febe2SThomas Huth    - git submodule update --init roms/opensbi
57922febe2SThomas Huth    - export JOBS=$(($(getconf _NPROCESSORS_ONLN) + 1))
58922febe2SThomas Huth    - echo "=== Using ${JOBS} simultaneous jobs ==="
59922febe2SThomas Huth    - make -j${JOBS} -C roms/opensbi clean
60a52ea3e7SBin Meng    - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2
61922febe2SThomas Huth    - make -j${JOBS} -C roms/opensbi clean
62a52ea3e7SBin Meng    - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2
63