|
| 1 | +# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +default: |
| 16 | + image: docker |
| 17 | + services: |
| 18 | + - name: docker:dind |
| 19 | + command: ["--experimental"] |
| 20 | + |
| 21 | +variables: |
| 22 | + # We specify the LIB_VERSION, TOOLKIT_VERSION, and TOOLKIT_TAG variable to allow packages |
| 23 | + # to be built. |
| 24 | + LIB_VERSION: 999.999.999 |
| 25 | + LIB_TAG: dummy+lib |
| 26 | + TOOLKIT_VERSION: 999.999.999 |
| 27 | + TOOLKIT_TAG: dummy+toolkit |
| 28 | + |
| 29 | +# Build packages for all supported OS / ARCH combinations |
| 30 | +stages: |
| 31 | + - trigger |
| 32 | + - build |
| 33 | + |
| 34 | +.pipeline-trigger-rules: |
| 35 | + rules: |
| 36 | + # We trigger the pipeline if started manually |
| 37 | + - if: $CI_PIPELINE_SOURCE == "web" |
| 38 | + # We trigger the pipeline on the main branch |
| 39 | + - if: $CI_COMMIT_BRANCH == "main" |
| 40 | + # We trigger the pipeline on the release- branches |
| 41 | + - if: $CI_COMMIT_BRANCH =~ /^release-.*$/ |
| 42 | + # We trigger the pipeline on tags |
| 43 | + - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != "" |
| 44 | + |
| 45 | +workflow: |
| 46 | + rules: |
| 47 | + # We trigger the pipeline on a merge request |
| 48 | + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' |
| 49 | + # We then add all the regular triggers |
| 50 | + - !reference [.pipeline-trigger-rules, rules] |
| 51 | + |
| 52 | +# The main or manual job is used to filter out distributions or architectures that are not required on |
| 53 | +# every build. |
| 54 | +.main-or-manual: |
| 55 | + rules: |
| 56 | + - !reference [.pipeline-trigger-rules, rules] |
| 57 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 58 | + when: manual |
| 59 | + |
| 60 | +# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests. |
| 61 | +trigger-pipeline: |
| 62 | + stage: trigger |
| 63 | + script: |
| 64 | + - echo "starting pipeline" |
| 65 | + rules: |
| 66 | + - !reference [.main-or-manual, rules] |
| 67 | + - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 68 | + when: manual |
| 69 | + allow_failure: false |
| 70 | + - when: always |
| 71 | + |
| 72 | +.build-setup: |
| 73 | + stage: build |
| 74 | + variables: |
| 75 | + ARTIFACTS_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}-artifacts-${CI_PIPELINE_ID}" |
| 76 | + ARTIFACTS_DIR: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-artifacts-${CI_PIPELINE_ID}" |
| 77 | + DIST_DIR: "${CI_PROJECT_DIR}/${ARTIFACTS_DIR}" |
| 78 | + |
| 79 | + artifacts: |
| 80 | + name: ${ARTIFACTS_NAME} |
| 81 | + paths: |
| 82 | + - ${ARTIFACTS_DIR} |
| 83 | + |
| 84 | + before_script: |
| 85 | + - apk update |
| 86 | + - apk upgrade |
| 87 | + - apk add coreutils build-base sed git bash make |
| 88 | + |
| 89 | +build: |
| 90 | + extends: |
| 91 | + - .build-setup |
| 92 | + parallel: |
| 93 | + matrix: |
| 94 | + - PACKAGING: [deb, rpm] |
| 95 | + script: |
| 96 | + - make ${PACKAGING} |
0 commit comments