build-jobs: use parallel:matrix instead of copy-pasting job definitions

This has the additional benefit that the job is always defined, and
then we can just add the placeholder as any other job

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6693
[ci:skip-build]: already built successfully in CI
This commit is contained in:
Pablo Correa Gómez
2025-08-13 12:59:38 +02:00
parent 9ddc0e0cb0
commit 9efda70d16
2 changed files with 57 additions and 67 deletions
+25 -60
View File
@@ -17,20 +17,9 @@ workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
{% if archs|length == 0 %}
# Needed because gitlab fails if no jobs are ran:
# - https://gitlab.com/gitlab-org/gitlab/-/issues/368248
# This applies to `when: manual` is used on all jobs.
placeholder:
stage: build
script:
- 'true'
{% endif %}
.build:
# Create jobs, but don't run them unless this is
# Create jobs, but do not run them unless this is
# overriden in jobs that extend it
when: manual
stage: build
interruptible: true
before_script:
@@ -51,57 +40,28 @@ placeholder:
- keys/
timeout: 10 h
build-x86_64:
{% if ('x86_64' in archs) %}
when: always
{% endif %}
build:
extends: .build
script:
- .ci/build-x86_64.sh
build-x86:
{% if ('x86' in archs) %}
when: always
parallel:
matrix:
{% for arch in archs %}
- ARCH: {{ arch }}
TAG: {{ archtag[arch] }}
{% endfor %}
{% if archs|length == 0 %}
- ARCH: placeholder
TAG: shared
{% endif %}
extends: .build
tags:
- $TAG
script:
- .ci/build-x86.sh
build-aarch64:
{% if ('aarch64' in archs) %}
when: always
# Needed because gitlab fails if no jobs are ran:
# - https://gitlab.com/gitlab-org/gitlab/-/issues/368248
{% if archs|length == 0 %}
- 'true'
{% else %}
- .ci/build-$ARCH.sh
{% endif %}
extends: .build
tags: [arm64]
script:
- .ci/build-aarch64.sh
build-armv7:
{% if ('armv7' in archs) %}
when: always
{% endif %}
extends: .build
tags: [qemu]
script:
- .ci/build-armv7.sh
build-armhf:
{% if ('armhf' in archs) %}
when: always
{% endif %}
extends: .build
tags: [qemu]
script:
- .ci/build-armhf.sh
build-riscv64:
{% if ('riscv64' in archs) %}
when: always
{% endif %}
extends: .build
tags: [qemu]
script:
- .ci/build-riscv64.sh
# Hardware testing
@@ -139,7 +99,12 @@ prepare-{{ device.name }}:
- {{ kernel }}
{%- endfor %}
{%- endif %}
needs: ["build-{{ device.arch }}"]
needs:
- job: "build"
parallel:
matrix:
- ARCH: "{{ device.arch }}"
TAG: "{{ archtag[device.arch] }}"
variables:
DEVICE_NAME: {{ device.name }}
# NOTE: All the packages that may influence testing should have an