OpenMiInk/third_party/kde-ci-utilities/gitlab-templates/snap-snapcraft-lxd.yml
Hellings b8c8ff98e2 Hi
2026-10-16 09:05:56 -04:00

103 lines
4 KiB
YAML

include:
- /gitlab-templates/blocks/snap-base.yml
- /gitlab-templates/blocks/workflow.yml
snap_snapcraft_lxd:
extends: .snap_base
stage: deploy
inherit:
default: true
script:
# Make the artifacts dir
- mkdir -p $CI_PROJECT_DIR/kde-ci-packages/
# clean, just to be sure
- snapcraft clean
# Force usage of LXD for building Snaps
- echo building $KDE_SNAP_MODULE_NAME with LXD...
- snapcraft pack --use-lxd --verbose 2>&1 | tee $CI_PROJECT_DIR/kde-ci-packages/task.log
# run appium testing if applicable
- |
if [ -f "appium-test" ]; then
export KDE_APPIUM_VM_NAME="APPIUM-TEST-${CI_JOB_ID}"
echo "Run test"
git clone https://invent.kde.org/sdk/selenium-webdriver-at-spi.git
selenium-webdriver-at-spi/snaptests/snap-test-in-vm.sh create
selenium-webdriver-at-spi/snaptests/snap-test-in-vm.sh run-file appium-test
fi
# copy the snap to the artifacts dir
- cp -vf ./*.snap $CI_PROJECT_DIR/kde-ci-packages/
# keep track of which branch was built
- echo $KDE_SNAP_BRANCH >> $CI_PROJECT_DIR/kde-ci-packages/deploy.env
allow_failure: true
interruptible: true
# snap_snapcraft_lxd_arm64:
# extends: .snap_base_arm64
# stage: deploy
# inherit:
# default: true
# script:
# # Make the artifacts dir
# - mkdir -p $CI_PROJECT_DIR/kde-ci-packages/arm64/
# # clean, just to be sure
# - snapcraft clean
# # Force usage of LXD for building Snaps
# - echo building $KDE_SNAP_MODULE_NAME with LXD...
# - snapcraft pack --use-lxd --verbose 2>&1 | tee $CI_PROJECT_DIR/kde-ci-packages/arm64/task.log
# # run appium testing if applicable
# - |
# if [ -f "appium-test" ]; then
# export KDE_APPIUM_VM_NAME="APPIUM-TEST-${CI_JOB_ID}"
# echo "Run test"
# git clone https://invent.kde.org/sdk/selenium-webdriver-at-spi.git
# selenium-webdriver-at-spi/snaptests/snap-test-in-vm.sh create
# selenium-webdriver-at-spi/snaptests/snap-test-in-vm.sh run-file appium-test
# fi
# # copy the snap to the artifacts dir
# - cp -vf ./*.snap $CI_PROJECT_DIR/kde-ci-packages/arm64/
# # keep track of which branch was built
# - echo $KDE_SNAP_BRANCH >> $CI_PROJECT_DIR/kde-ci-packages/arm64/deploy.env
# allow_failure: true
# interruptible: true
snap_snapcraft_lxd_publish:
extends: .snap_publish
stage: publish
needs: [snap_snapcraft_lxd]
script:
# export to ENV_VAR's and compare if our branches are the same
- export KDE_SNAP_BRANCH=$(cat $CI_PROJECT_DIR/kde-ci-packages/deploy.env)
# - export KDE_SNAP_BRANCH_ARM64=$(cat $CI_PROJECT_DIR/kde-ci-packages/arm64/deploy.env)
# - |
# if [ "$KDE_SNAP_BRANCH" != "$KDE_SNAP_BRANCH_ARM64" ]; then
# exit 1
# fi
# set the channel for the snap dependent on which branch we are building
- |
# master = edge
if [ "$KDE_SNAP_BRANCH" == "master" ]; then
export KDE_SNAP_CHANNEL="edge"
# work.core24 = beta
elif [ "$KDE_SNAP_BRANCH" == "work.core24" ]; then
export KDE_SNAP_CHANNEL="beta"
# work.core26 = beta
elif [ "$KDE_SNAP_BRANCH" == "work.core26" ]; then
export KDE_SNAP_CHANNEL="beta"
# release.candidate = candidate
elif [ "$KDE_SNAP_BRANCH" == "release.candidate" ]; then
export KDE_SNAP_CHANNEL="candidate"
# release.stable = stable
elif [ "$KDE_SNAP_BRANCH" == "release.stable" ]; then
export KDE_SNAP_CHANNEL="stable"
else
# don't publish anything else either
export KDE_SNAP_CHANNEL="no_publish"
echo "we only publish recognised branches to the snap store"
fi
# publish if we are on a recognised branch
if [ "$KDE_SNAP_CHANNEL" != "no_publish" ]; then
echo "KDE_SNAP_BRANCH is $KDE_SNAP_BRANCH thus KDE_SNAP_CHANNEL is publishing to $KDE_SNAP_CHANNEL"
snapcraft push --release=$KDE_SNAP_CHANNEL $CI_PROJECT_DIR/kde-ci-packages/*.snap --verbose 2>&1 | tee publish.log
fi
allow_failure: true
interruptible: true