From 5da5bada862473f0cc2ade138cf76dc73fff0251 Mon Sep 17 00:00:00 2001 From: ewbo4360 <ewbo4360@bht-berlin.de> Date: Tue, 19 Nov 2024 22:52:19 +0100 Subject: [PATCH] Pipeline updated to build and publish artifacts to GitLab that remain accessible for 5min to any user on the root/artifacts directory, matrix usage for multiplatforms build will be possible eventually in further versions --- .gitlab-ci.yml | 203 ++++++++++++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe9da8a..c22e3ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,97 +1,124 @@ -stages: - - build - - test - - deploy + # This pipeline... -cache: - paths: - - output/full # Cache the Meson build directory + # ... tests the code - see stage: test in .gitlab-ci.yml + # check + # ... builds an artifact - see stage: build in .gitlab-ci.yml + # check + # ... publishes the artifact(s) - see stage: publish in .gitlab-ci.yml + +# (even if the pipeline jobs are already accessible on gitlab.com with the adequate access rights) + # check + + stages: + - build + - test + - publish -# variables: - # $CI_BUILDS_DIR : /builds/ewbo4360/devops_wise24_ewbo/MPD + cache: + paths: + - output/full # Cache the Meson build directory -before_script: - # the 2 following steps make sure that the required building tool (meson) is installed on the runner - #and also that all the other external dependencies are here (this will be part of a container later) - - apt-get update # Make sure the package lists are updated - - apt-get upgrade -y - #install all necessary dependencies - - apt-get install python3-pip -y - - apt-get install meson -y - - apt-get install -y ccache - - apt-get install -y cmake - - apt-get install -y ninja-build - - apt-get install -y libfmt-dev - - apt-get install -y libgtest-dev - - apt-get install -y libpcre2-dev - - apt-get install -y libsystemd-dev libdbus-1-dev - - apt-get install -y libicu-dev - - apt-get install -y libcurl4-gnutls-dev - - apt-get install -y libpcre2-dev - - apt-get install -y libavahi-client-dev - - apt-get install -y libmad0-dev libmpg123-dev libid3tag0-dev - - apt-get install -y libflac-dev libvorbis-dev libopus-dev libogg-dev - - apt-get install -y libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev - - apt-get install -y libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev - - apt-get install -y libmpcdec-dev libwavpack-dev libwildmidi-dev - - apt-get install -y libsidplay2-dev libsidutils-dev libresid-builder-dev - - apt-get install -y libavcodec-dev libavformat-dev - - apt-get install -y libmp3lame-dev libtwolame-dev libshine-dev - - apt-get install -y libsamplerate0-dev libsoxr-dev - - apt-get install -y libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev - - apt-get install -y libzzip-dev - - apt-get install -y libyajl-dev libexpat-dev - - apt-get install -y libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev - - apt-get install -y libpulse-dev libshout3-dev - - apt-get install -y libsndio-dev - - apt-get install -y libmpdclient-dev - - apt-get install -y libnfs-dev - - apt-get install -y libupnp-dev - - apt-get install -y libsqlite3-dev - - apt-get install -y libchromaprint-dev - - apt-get install -y libgcrypt20-dev + # variables: + # $CI_BUILDS_DIR : /builds/ewbo4360/devops_wise24_ewbo/MPD - # This sets up the meson envt - - meson setup -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled --wrap-mode nofallback output/full + before_script: + # the 2 following steps make sure that the required building tool (meson) is installed on the runner + #and also that all the other external dependencies are here (this will be part of a container later) + - apt-get update # Make sure the package lists are updated + - apt-get upgrade -y + #install all necessary dependencies + - apt-get install python3-pip -y + - apt-get install meson -y + - apt-get install -y ccache + - apt-get install -y cmake + - apt-get install -y ninja-build + - apt-get install -y libfmt-dev + - apt-get install -y libgtest-dev + - apt-get install -y libpcre2-dev + - apt-get install -y libsystemd-dev libdbus-1-dev + - apt-get install -y libicu-dev + - apt-get install -y libcurl4-gnutls-dev + - apt-get install -y libpcre2-dev + - apt-get install -y libavahi-client-dev + - apt-get install -y libmad0-dev libmpg123-dev libid3tag0-dev + - apt-get install -y libflac-dev libvorbis-dev libopus-dev libogg-dev + - apt-get install -y libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev + - apt-get install -y libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev + - apt-get install -y libmpcdec-dev libwavpack-dev libwildmidi-dev + - apt-get install -y libsidplay2-dev libsidutils-dev libresid-builder-dev + - apt-get install -y libavcodec-dev libavformat-dev + - apt-get install -y libmp3lame-dev libtwolame-dev libshine-dev + - apt-get install -y libsamplerate0-dev libsoxr-dev + - apt-get install -y libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev + - apt-get install -y libzzip-dev + - apt-get install -y libyajl-dev libexpat-dev + - apt-get install -y libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev + - apt-get install -y libpulse-dev libshout3-dev + - apt-get install -y libsndio-dev + - apt-get install -y libmpdclient-dev + - apt-get install -y libnfs-dev + - apt-get install -y libupnp-dev + - apt-get install -y libsqlite3-dev + - apt-get install -y libchromaprint-dev + - apt-get install -y libgcrypt20-dev + # This sets up the meson envt + - meson setup -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled --wrap-mode nofallback output/full -build-job : - stage: build - image: ubuntu:24.04 - script: - - echo "Hello, $GITLAB_USER_LOGIN! This is a build job" - - meson compile -C output/full --verbose - - cache: - paths: - - output/full -test-job1: - stage: test - image: ubuntu:24.04 - script: - - echo "This job is for untit-tests" - - meson test -C output/full --verbose - cache: - paths: - - output/full #reuse the build cache :) + build-job : + stage: build + image: ubuntu:24.04 + script: + - echo "Hello, $GITLAB_USER_LOGIN! This is a build job" + - mkdir -p ./artifacts + - meson compile -C output/full --verbose + artifacts: + paths: + - output/full # Publish the built artifacts + cache: + paths: + - output/full #save cache for later jobs + + test-job1: + stage: test + image: ubuntu:24.04 + script: + - echo "This job is for untit-tests" + - meson test -C output/full --verbose + dependencies: + - build-job # test-job1 depends on build-job for caching artifacts + cache: + paths: + - output/full #reuse the build cache :) -test-job2: - stage: test - image: ubuntu:24.04 - script: - - echo "This job is for general tests" - # - meson compile - cache: - paths: - - output/full #reuse the build cache :) + test-job2: + stage: test + image: ubuntu:24.04 + script: + - echo "This job is for general tests" + # - meson compile + environment: production + dependencies: + - build-job # test-job2 depends on build-job for caching artifacts + cache: + paths: + - output/full #reuse the build cache :) -deploy-prod: - stage: deploy - image: ubuntu:24.04 - script: - - echo "This job deploys something from the $CI_COMMIT_BRANCH branch." - environment: production - cache: - paths: - - output/full #reuse the build cache :) \ No newline at end of file + upload: + stage: publish + image: ubuntu:24.04 + script: + - echo "This job deploys something from the $CI_COMMIT_BRANCH branch." + - echo "Publishing the artifact..." + - cp -r output/full ./artifacts # Ensure the artifacts are included for deployment + environment: production + cache: + paths: + - output/full #reuse the build cache :) + artifacts: + when: on_failure + access: all + expire_in: 300 sec + paths : + - ./artifacts # Publish the artifact(s) to GitLab -- GitLab