ci: Revise conditions for packaging to avoid breaking on main branch of forks

This commit is contained in:
Ryan Pavlik 2021-02-23 14:41:02 -06:00
parent 6065d47b0a
commit 216f6abf2f

View file

@ -1,13 +1,11 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors
# SPDX-FileCopyrightText: 2018-2021 Collabora, Ltd. and the Monado contributors
variables:
FDO_UPSTREAM_REPO: monado/monado
.templates_sha: &templates_sha db8eb22cd1abb036560faaebd36a38565a3ebda2
.package_only_branch: &package_only_branch master
# Variables listing packages for Debian-based distros
.monado.variables.debian-based-packages:
variables:
@ -270,11 +268,46 @@ debian:cmake:32bit:
# OpenCV and local OpenHMD doesn't play nicely with us in multi-arch.
CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=../.gitlab-ci/i386.cmake -DXRT_HAVE_OPENCV=off -DXRT_BUILD_DRIVER_OHMD=off
# Base of Android NDK builds.
# Takes the last :-delimited part of the name as the ABI to build for,
# so you don't need to do anything other than "extends" in the job
.monado.ndk:build-base:
stage: build
extends:
- .monado.variables.debian:buster-ndk
- .fdo.suffixed-image@debian # from ci-templates
variables:
ANDROID_PLATFORM: 26
script:
- mkdir build
- pushd build
# This extracts the ABI from the job name
- export ABI=$(echo $CI_JOB_NAME | cut --delimiter=":" -f 2)
# Note we are pointing CMake to the host install of Eigen3 because it's header-only
# and thus this is safe to do.
- cmake -GNinja .. -DANDROID_PLATFORM=$ANDROID_PLATFORM -DANDROID_ABI=$ABI -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/
- grep "^XRT_" CMakeCache.txt
- ninja
ndk:armeabi-v7a:
extends: .monado.ndk:build-base
ndk:arm64-v8a:
extends: .monado.ndk:build-base
# Packaging
.monado.packaging.conditions:
rules:
# Only the default branch of the "upstream" repo.
- if: '$CI_PROJECT_PATH == $FDO_UPSTREAM_REPO && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
when: on_success
# Otherwise, don't build packages.
- when: never
.monado.base-job.debuild:
extends:
- .monado.packaging.conditions
stage: package
only:
- *package_only_branch
before_script:
# Configure git - needed despite not actually committing here.
- git config --global user.email "ryan.pavlik@collabora.com"
@ -320,10 +353,9 @@ ubuntu:focal:package:
reprepro:package:
stage: reprepro
only:
- *package_only_branch
extends:
- .monado.variables.debian:buster
- .monado.packaging.conditions
- .fdo.distribution-image@debian # from ci-templates
dependencies:
- debian:buster:package
@ -363,33 +395,6 @@ reprepro:package:
- "repo/"
expire_in: 2 days
# Base of Android NDK builds.
# Takes the last :-delimited part of the name as the ABI to build for,
# so you don't need to do anything other than "extends" in the job
.monado.ndk:build-base:
stage: build
extends:
- .monado.variables.debian:buster-ndk
- .fdo.suffixed-image@debian # from ci-templates
variables:
ANDROID_PLATFORM: 26
script:
- mkdir build
- pushd build
# This extracts the ABI from the job name
- export ABI=$(echo $CI_JOB_NAME | cut --delimiter=":" -f 2)
# Note we are pointing CMake to the host install of Eigen3 because it's header-only
# and thus this is safe to do.
- cmake -GNinja .. -DANDROID_PLATFORM=$ANDROID_PLATFORM -DANDROID_ABI=$ABI -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/
- grep "^XRT_" CMakeCache.txt
- ninja
ndk:armeabi-v7a:
extends: .monado.ndk:build-base
ndk:arm64-v8a:
extends: .monado.ndk:build-base
###
# Pages
###