blob: 29a22930d1d661f704fd05a5403ef697042017b7 [file] [log] [blame]
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +01001# All jobs needing docker-opensbi must use the same rules it uses.
2.opensbi_job_rules:
3 rules: # Only run this job when ...
Bin Mengc6fc0fc2020-02-24 05:39:44 -08004 - changes:
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +01005 # this file is modified
Thomas Huth5117ba22020-07-01 14:56:31 +01006 - .gitlab-ci.d/opensbi.yml
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +01007 # or the Dockerfile is modified
Bin Mengc6fc0fc2020-02-24 05:39:44 -08008 - .gitlab-ci.d/opensbi/Dockerfile
Philippe Mathieu-Daudéc217fd82021-07-27 16:24:31 +02009 when: on_success
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +010010 - changes: # or roms/opensbi/ is modified (submodule updated)
11 - roms/opensbi/*
Philippe Mathieu-Daudéc217fd82021-07-27 16:24:31 +020012 when: on_success
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +010013 - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' # or the branch/tag starts with 'opensbi'
Philippe Mathieu-Daudéc217fd82021-07-27 16:24:31 +020014 when: on_success
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +010015 - if: '$CI_COMMIT_MESSAGE =~ /opensbi/i' # or last commit description contains 'OpenSBI'
Philippe Mathieu-Daudéc217fd82021-07-27 16:24:31 +020016 when: on_success
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +010017
18docker-opensbi:
19 extends: .opensbi_job_rules
20 stage: containers
Bin Mengc6fc0fc2020-02-24 05:39:44 -080021 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:
Philippe Mathieu-Daudé0a9487d2021-07-21 00:27:03 +010040 extends: .opensbi_job_rules
Daniel P. Berrangéd0caa0a2020-07-01 14:56:32 +010041 stage: build
Philippe Mathieu-Daudé91e9c472021-03-03 14:06:46 +010042 needs: ['docker-opensbi']
Bin Mengc6fc0fc2020-02-24 05:39:44 -080043 artifacts:
44 paths: # 'artifacts.zip' will contains the following files:
Bin Menga52ea3e2020-05-01 21:30:54 +080045 - pc-bios/opensbi-riscv32-generic-fw_dynamic.bin
Bin Menga52ea3e2020-05-01 21:30:54 +080046 - pc-bios/opensbi-riscv64-generic-fw_dynamic.bin
Bin Menga52ea3e2020-05-01 21:30:54 +080047 - opensbi32-generic-stdout.log
48 - opensbi32-generic-stderr.log
49 - opensbi64-generic-stdout.log
50 - opensbi64-generic-stderr.log
Bin Mengc6fc0fc2020-02-24 05:39:44 -080051 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
Bin Menga52ea3e2020-05-01 21:30:54 +080059 - make -j${JOBS} -C roms opensbi32-generic 2>&1 1>opensbi32-generic-stdout.log | tee -a opensbi32-generic-stderr.log >&2
Bin Mengc6fc0fc2020-02-24 05:39:44 -080060 - make -j${JOBS} -C roms/opensbi clean
Bin Menga52ea3e2020-05-01 21:30:54 +080061 - make -j${JOBS} -C roms opensbi64-generic 2>&1 1>opensbi64-generic-stdout.log | tee -a opensbi64-generic-stderr.log >&2