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