Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <elezar@nvidia.com>
  • Loading branch information
elezar committed Apr 25, 2023
1 parent 61f33cb commit ea1dd5c
Showing 1 changed file with 51 additions and 80 deletions.
131 changes: 51 additions & 80 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ default:
- name: docker:dind
command: ["--experimental"]

# Build packages for all supported OS / ARCH combinations
stages:
- build-one
- build-all

variables:
# We specify the LIB_VERSION, TOOLKIT_VERSION, and TOOLKIT_TAG variable to allow packages
# to be built.
Expand All @@ -31,45 +26,51 @@ variables:
TOOLKIT_VERSION: 999.999.999
TOOLKIT_TAG: dummy+toolkit

.build-setup: &build-setup
before_script:
- apk update
- apk upgrade
- apk add coreutils build-base sed git bash make
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
# Build packages for all supported OS / ARCH combinations
stages:
- trigger
- build

# build-one jobs build packages for a single OS / ARCH combination.
#
# They are run during the first stage of the pipeline as a smoke test to ensure
# that we can successfully build packages on all of our architectures for a
# single OS. They are triggered on any change to an MR. No artifacts are
# produced as part of build-one jobs.
.build-one-setup: &build-one-setup
<<: *build-setup
stage: build-one
only:
- merge_requests
.pipeline-trigger-rules:
rules:
# We trigger the pipeline if started manually
- if: $CI_PIPELINE_SOURCE == "web"
# We trigger the pipeline on the main branch
- if: $CI_COMMIT_BRANCH == "main"
# We trigger the pipeline on the release- branches
- if: $CI_COMMIT_BRANCH =~ /^release-.*$/
# We trigger the pipeline on tags
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != ""

workflow:
rules:
# We trigger the pipeline on a merge request
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# We then add all the regular triggers
- !reference [.pipeline-trigger-rules, rules]

# The main or manual job is used to filter out distributions or architectures that are not required on
# every build.
.main-or-manual:
rules:
- !reference [.pipeline-trigger-rules, rules]
- if: $CI_PIPELINE_SOURCE == "schedule"
when: manual

# build-all jobs build packages for every OS / ARCH combination we support.
#
# They are run under two conditions:
# 1) Automatically whenever a new tag is pushed to the repo (e.g. v1.1.0)
# 2) Manually by a reviewer just before merging a MR.
#
# Unlike build-one jobs, it takes a long time to build the full suite
# OS / ARCH combinations, so this is optimized to only run once per MR
# (assuming it all passes). A full set of artifacts including the packages
# built for each OS / ARCH are produced as a result of these jobs.
.build-all-setup: &build-all-setup
<<: *build-setup
stage: build-all
timeout: 2h 30m
# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests.
trigger-pipeline:
stage: trigger
script:
- echo "starting pipeline"
rules:
- if: $CI_COMMIT_TAG
when: always
- if: $CI_MERGE_REQUEST_ID
- !reference [.main-or-manual, rules]
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: false
- when: always

.build-setup:
stage: build
variables:
ARTIFACTS_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}-artifacts-${CI_PIPELINE_ID}"
ARTIFACTS_DIR: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-artifacts-${CI_PIPELINE_ID}"
Expand All @@ -80,46 +81,16 @@ variables:
paths:
- ${ARTIFACTS_DIR}

# The full set of build-one jobs organizes to build
# ubuntu18.04 in parallel on each of our supported ARCHs.
build-one-amd64:
<<: *build-one-setup
script:
- make ubuntu18.04-amd64

build-one-ppc64le:
<<: *build-one-setup
script:
- make ubuntu18.04-ppc64le

build-one-arm64:
<<: *build-one-setup
script:
- make ubuntu18.04-arm64

# The full set of build-all jobs organized to
# have builds for each ARCH run in parallel.
build-all-amd64:
<<: *build-all-setup
script:
- make docker-amd64

build-all-x86_64:
<<: *build-all-setup
script:
- make docker-x86_64

build-all-ppc64le:
<<: *build-all-setup
script:
- make docker-ppc64le

build-all-arm64:
<<: *build-all-setup
script:
- make docker-arm64
before_script:
- apk update
- apk upgrade
- apk add coreutils build-base sed git bash make

build-all-aarch64:
<<: *build-all-setup
build:
extends:
- .build-setup
parallel:
matrix:
- PACKAGING: [deb, rpm]
script:
- make docker-aarch64
- make ${PACKAGING}

0 comments on commit ea1dd5c

Please sign in to comment.