gitlab-ci, build: Add infrastructure to distribute nightly aarch64 flatpak

This commit is contained in:
Bruno Lopes 2025-07-24 20:33:04 -03:00
parent ed1d4a37a0
commit caf460177a
No known key found for this signature in database
4 changed files with 54 additions and 35 deletions

View file

@ -374,22 +374,28 @@ gimp-debian-x64:
expire_in: 2 days
## Flatpak CI ##
.flatpak-x64:
## Flatpak CI (Fedora) ##
.flatpak:
extends: .default
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Flatpak.*/'
interruptible: true
- if: '$GIMP_CI_FLATPAK != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_FLATPAK.*/'
parallel:
matrix:
- RUNNER: [flatpak-aarch64, flatpak-x86_64]
tags:
- flatpak
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
- $RUNNER
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master
variables:
RUN_TESTS: 0
MESON_DIST: 0
before_script:
- export GIMP_PREFIX="${CI_PROJECT_DIR}/_install"
timeout: 40m
timeout: 60m
deps-flatpak-x64:
extends: .flatpak-x64
deps-flatpak:
extends: .flatpak
stage: dependencies
#https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1502
#cache:
@ -400,15 +406,15 @@ deps-flatpak-x64:
- sh build/linux/flatpak/1_build-deps-flatpakbuilder.sh
artifacts:
paths:
- .flatpak-builder.tar
- .flatpak-builder-$RUNNER.tar
- flatpak-builder.log
- babl-meson-log.tar
- gegl-meson-log.tar
expire_in: 2 hours
gimp-flatpak-x64:
extends: .flatpak-x64
needs: ["deps-flatpak-x64"]
gimp-flatpak:
extends: .flatpak
needs: ["deps-flatpak"]
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
@ -416,7 +422,8 @@ gimp-flatpak-x64:
- sh build/linux/flatpak/2_build-gimp-flatpakbuilder.sh
artifacts:
paths:
- repo.tar
- temp*.flatpak
- repo*.tar
- gimp-meson-log.tar
expire_in: 2 days
@ -800,7 +807,7 @@ dist-flatpak-weekly:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*Package:Flatpak.*/'
interruptible: true
- if: '$GIMP_CI_FLATPAK != null || "$[[ inputs.distribution_pipeline ]]" =~ /.*GIMP_CI_FLATPAK.*/'
needs: ["gimp-flatpak-x64"]
needs: ["gimp-flatpak"]
stage: distribution
script:
- sh build/linux/flatpak/3_dist-gimp-flatpakbuilder.sh

View file

@ -87,6 +87,6 @@ if [ "$GITLAB_CI" ]; then
tar cf gegl-meson-log.tar .flatpak-builder/build/gegl-1/_flatpak_build/meson-logs/meson-log.txt
printf "\e[0Ksection_end:`date +%s`:gegl_build\r\e[0K\n"
## Save built deps for 'gimp-flatpak-x64' job
tar cf .flatpak-builder.tar .flatpak-builder/
## Save built deps for 'gimp-flatpak' job
tar cf .flatpak-builder-$RUNNER.tar .flatpak-builder/
fi

View file

@ -24,7 +24,7 @@ eval "$(sed -n '/Install part/,/End of check/p' build/linux/flatpak/1_build-deps
if [ "$GITLAB_CI" ]; then
# Extract deps from previous job
tar xf .flatpak-builder.tar
tar xf .flatpak-builder-$RUNNER.tar
fi
@ -49,12 +49,19 @@ if [ "$GITLAB_CI" ]; then
fi
printf "\e[0Ksection_end:`date +%s`:gimp_build\r\e[0K\n"
# Bundle files for distribution on 3_dist-gimp-flatpakbuilder.sh
printf "\e[0Ksection_start:`date +%s`:gimp_bundle[collapsed=true]\r\e[0KCreating OSTree repo\n"
## Cleanup GIMP_PREFIX (not working) and export it to OSTree repo
## https://github.com/flatpak/flatpak-builder/issues/14
printf "\e[0Ksection_start:`date +%s`:gimp_bundle[collapsed=true]\r\e[0KCreating OSTree repo\n"
eval $FLATPAK_BUILDER $BUILDER_ARGS --finish-only --repo=repo \
"$GIMP_PREFIX" build/linux/flatpak/org.gimp.GIMP-nightly.json
if [ "$GITLAB_CI" ]; then
tar cf repo.tar repo/
tar cf repo-$(uname -m).tar repo/
fi
## Make testable .flatpak "bundle" from OSTree repo
## (it is NOT a real/full bundle, deps from GNOME runtime are not bundled)
APP_ID=$(awk -F'"' '/"app-id"/ {print $4; exit}' build/linux/flatpak/org.gimp.GIMP-nightly.json)
BRANCH=$(awk -F'"' '/"branch"/ {print $4; exit}' build/linux/flatpak/org.gimp.GIMP-nightly.json)
flatpak build-bundle repo temp_${APP_ID}-$(uname -m).flatpak --runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo ${APP_ID} ${BRANCH}
printf "\e[0Ksection_end:`date +%s`:gimp_bundle\r\e[0K\n"

View file

@ -16,44 +16,49 @@ fi
# GLOBAL INFO
APP_ID=$(awk -F'"' '/"app-id"/ {print $4; exit}' build/linux/flatpak/org.gimp.GIMP-nightly.json)
for FLATPAK in $(find . -maxdepth 1 -iname "*.flatpak"); do
FLATPAK=$(echo "$FLATPAK" | sed 's|^\./temp_||')
ARCH=$(echo "$FLATPAK" | sed 's/.*-\([^-]*\)\.flatpak/\1/')
# GIMP FILES AS REPO
# GIMP FILES AS REPO (FOR FURTHER PUBLISHING)
if [ "$GITLAB_CI" ]; then
# Extract previously exported OSTree repo/
tar xf repo.tar --warning=no-timestamp
if [ -d 'repo' ]; then
rm -fr repo
fi
mkdir repo
tar xf repo-$ARCH.tar -C repo/ --warning=no-timestamp
fi
# CONSTRUCT .FLATPAK
# Generate a Flatpak "bundle" to be tested with GNOME runtime installed
# (it is NOT a real/full bundle, deps from GNOME runtime are not bundled)
printf "\e[0Ksection_start:`date +%s`:flat_making[collapsed=true]\r\e[0KPackaging repo as ${APP_ID}.flatpak\n"
flatpak build-bundle repo ${APP_ID}.flatpak --runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo ${APP_ID} $(awk -F'"' '/"branch"/ {print $4; exit}' build/linux/flatpak/org.gimp.GIMP-nightly.json)
printf "(INFO): Suceeded. To test this build, install it from the artifact with: flatpak install --user ${APP_ID}.flatpak -y\n"
printf "\e[0Ksection_end:`date +%s`:flat_making\r\e[0K\n"
# FINISH .FLATPAK
printf "\e[0Ksection_start:`date +%s`:${FLATPAK}_making[collapsed=true]\r\e[0KFinishing ${FLATPAK}\n"
mv temp_${FLATPAK} ${FLATPAK}
printf "(INFO): Suceeded. To test this build, install it from the artifact with: flatpak install --user ${FLATPAK} -y\n"
printf "\e[0Ksection_end:`date +%s`:${FLATPAK}_making\r\e[0K\n"
# GENERATE SHASUMS FOR .FLATPAK
printf "\e[0Ksection_start:`date +%s`:flat_trust[collapsed=true]\r\e[0KChecksumming ${APP_ID}.flatpak\n"
printf "(INFO): ${APP_ID}.flatpak SHA-256: $(sha256sum ${APP_ID}.flatpak | cut -d ' ' -f 1)\n"
printf "(INFO): ${APP_ID}.flatpak SHA-512: $(sha512sum ${APP_ID}.flatpak | cut -d ' ' -f 1)\n"
printf "\e[0Ksection_end:`date +%s`:flat_trust\r\e[0K\n"
printf "\e[0Ksection_start:`date +%s`:${FLATPAK}_trust[collapsed=true]\r\e[0KChecksumming ${FLATPAK}\n"
printf "(INFO): ${FLATPAK} SHA-256: $(sha256sum ${FLATPAK} | cut -d ' ' -f 1)\n"
printf "(INFO): ${FLATPAK} SHA-512: $(sha512sum ${FLATPAK} | cut -d ' ' -f 1)\n"
printf "\e[0Ksection_end:`date +%s`:${FLATPAK}_trust\r\e[0K\n"
if [ "$GITLAB_CI" ]; then
output_dir='build/linux/flatpak/_Output'
mkdir -p $output_dir
mv ${APP_ID}* $output_dir
mv ${FLATPAK} $output_dir
fi
# PUBLISH GIMP REPO IN GNOME NIGHTLY
# We take the commands from 'flatpak_ci_initiative.yml'
if [ "$GITLAB_CI" ] && [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
printf "\e[0Ksection_start:`date +%s`:flat_publish[collapsed=true]\r\e[0KPublishing repo to GNOME nightly\n"
printf "\e[0Ksection_start:`date +%s`:${FLATPAK}_publish[collapsed=true]\r\e[0KPublishing $ARCH repo to GNOME nightly\n"
curl https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml --output flatpak_ci_initiative.yml
eval "$(sed -n -e '/flatpak build-update-repo/,/exit $result/ { s/ - //; p }' flatpak_ci_initiative.yml)"
printf "\e[0Ksection_end:`date +%s`:flat_publish\r\e[0K\n"
printf "\e[0Ksection_end:`date +%s`:${FLATPAK}_publish\r\e[0K\n"
fi
done