From 216f6abf2fc017ac2f683fca0346d139a8b18651 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 23 Feb 2021 14:41:02 -0600 Subject: [PATCH] ci: Revise conditions for packaging to avoid breaking on main branch of forks --- .gitlab-ci.yml | 73 +++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6e4de29b..02f9ef7db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 ###