2023-05-05 08:04:06 +00:00
|
|
|
include: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/master/flatpak/flatpak_ci_initiative.yml'
|
|
|
|
|
2021-02-04 19:25:29 +00:00
|
|
|
stages:
|
|
|
|
- check
|
|
|
|
- test
|
2022-04-05 10:17:07 +00:00
|
|
|
- build
|
2022-01-19 15:28:54 +00:00
|
|
|
- doc
|
2022-03-30 14:42:23 +00:00
|
|
|
- deploy
|
2022-09-25 13:36:52 +00:00
|
|
|
- release
|
2021-02-04 19:25:29 +00:00
|
|
|
|
2022-04-05 10:17:07 +00:00
|
|
|
variables:
|
|
|
|
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
|
2023-05-05 08:04:06 +00:00
|
|
|
FLATPAK_MODULE: "fractal"
|
|
|
|
# We currently don't have any tests, remove "RUN_TESTS" to run tests
|
|
|
|
RUN_TESTS: "0"
|
|
|
|
BUNDLE: "${APP_ID}.flatpak"
|
2022-04-13 17:36:36 +00:00
|
|
|
|
2023-05-05 08:04:06 +00:00
|
|
|
.vars_nightly:
|
2022-04-13 17:36:36 +00:00
|
|
|
variables:
|
|
|
|
MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json"
|
2023-05-05 08:04:06 +00:00
|
|
|
APP_ID: "org.gnome.Fractal.Devel"
|
|
|
|
only:
|
|
|
|
- main
|
2022-07-07 16:58:40 +00:00
|
|
|
|
2023-05-05 08:04:06 +00:00
|
|
|
.vars_hack:
|
2022-07-07 16:58:40 +00:00
|
|
|
variables:
|
2023-05-05 08:04:06 +00:00
|
|
|
MANIFEST_PATH: "build-aux/org.gnome.Fractal.Hack.json"
|
|
|
|
APP_ID: "org.gnome.Fractal.Hack"
|
|
|
|
except:
|
|
|
|
- main
|
2022-07-07 16:58:40 +00:00
|
|
|
|
2022-01-14 22:20:55 +00:00
|
|
|
# Configure and run code checks
|
|
|
|
# Exits and fails if an error is encountered
|
|
|
|
checks:
|
2022-01-20 08:08:11 +00:00
|
|
|
image: "rustlang/rust:nightly-slim"
|
2022-01-14 22:20:55 +00:00
|
|
|
stage: check
|
2021-02-04 19:25:29 +00:00
|
|
|
script:
|
2022-01-14 22:20:55 +00:00
|
|
|
- scripts/checks.sh --verbose --force-install
|
2021-04-24 15:08:53 +00:00
|
|
|
|
2022-04-05 10:17:07 +00:00
|
|
|
# Lint the code
|
2022-01-14 21:50:42 +00:00
|
|
|
cargo-clippy:
|
2022-01-18 00:04:36 +00:00
|
|
|
stage: check
|
2023-05-05 08:04:06 +00:00
|
|
|
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
|
|
|
|
extends:
|
|
|
|
- .vars_hack
|
2022-01-14 21:50:42 +00:00
|
|
|
tags:
|
|
|
|
- flatpak
|
|
|
|
script:
|
|
|
|
- flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
|
|
|
|
- echo "cargo clippy -- -D warnings" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
|
|
|
|
|
2022-07-07 16:58:40 +00:00
|
|
|
# Build a debug version of the flatpak
|
|
|
|
# Except on main
|
2023-05-05 08:04:06 +00:00
|
|
|
build-hack@x86_64:
|
2022-07-07 16:58:40 +00:00
|
|
|
extends:
|
2023-05-05 08:04:06 +00:00
|
|
|
- .flatpak@x86_64
|
|
|
|
- .vars_hack
|
|
|
|
stage: build
|
|
|
|
|
|
|
|
build-hack@aarch64:
|
|
|
|
extends:
|
|
|
|
- .flatpak@aarch64
|
|
|
|
- .vars_hack
|
|
|
|
stage: build
|
2022-07-07 16:58:40 +00:00
|
|
|
|
|
|
|
# Build the nightly version of the flatpak
|
|
|
|
# Only on main
|
2023-05-05 08:04:06 +00:00
|
|
|
build@x86_64:
|
2022-04-13 17:36:36 +00:00
|
|
|
extends:
|
2023-05-05 08:04:06 +00:00
|
|
|
- .flatpak@x86_64
|
|
|
|
- .vars_nightly
|
2022-04-08 15:20:19 +00:00
|
|
|
stage: build
|
2023-05-05 08:04:06 +00:00
|
|
|
|
|
|
|
build@aarch64:
|
2022-04-13 17:36:36 +00:00
|
|
|
extends:
|
2023-05-05 08:04:06 +00:00
|
|
|
- .flatpak@aarch64
|
|
|
|
- .vars_nightly
|
2022-04-05 10:17:07 +00:00
|
|
|
stage: build
|
|
|
|
|
|
|
|
# Build the docs
|
|
|
|
# Only on main
|
2021-04-24 15:08:53 +00:00
|
|
|
pages:
|
2023-05-05 08:54:15 +00:00
|
|
|
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
|
2023-05-05 08:04:06 +00:00
|
|
|
extends: .vars_nightly
|
2022-04-05 10:17:07 +00:00
|
|
|
stage: doc
|
|
|
|
tags:
|
|
|
|
- flatpak
|
2021-04-24 15:08:53 +00:00
|
|
|
script:
|
2022-09-03 07:58:01 +00:00
|
|
|
- flatpak install --user --noninteractive org.freedesktop.Sdk.Extension.rust-nightly//22.08
|
2022-05-12 11:13:37 +00:00
|
|
|
- sed -i 's|rust-stable|rust-nightly|g' ${MANIFEST_PATH}
|
2022-01-19 15:28:54 +00:00
|
|
|
- flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
|
|
|
|
- echo "ninja src/doc" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
|
|
|
|
- mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/src/doc public
|
|
|
|
- chmod -R a=rwx public
|
2023-05-05 13:11:02 +00:00
|
|
|
dependencies: []
|
2021-04-24 15:08:53 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2022-01-19 15:28:54 +00:00
|
|
|
- 'public'
|
2022-03-29 08:56:46 +00:00
|
|
|
|
2022-04-05 10:17:07 +00:00
|
|
|
# Publish the nightly version
|
|
|
|
# Only on main
|
2023-05-05 08:04:06 +00:00
|
|
|
publish_nightly@x86_64:
|
|
|
|
extends: .publish_nightly
|
|
|
|
needs: ['build@x86_64']
|
|
|
|
|
|
|
|
publish_nightly@aarch64:
|
|
|
|
extends: .publish_nightly
|
|
|
|
needs: ['build@aarch64']
|
2022-09-25 13:36:52 +00:00
|
|
|
|
|
|
|
.vars_release:
|
|
|
|
variables:
|
|
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-tarballs/${CI_COMMIT_TAG}"
|
|
|
|
RELEASE_TARBALL: "fractal-${CI_COMMIT_TAG}.tar.xz"
|
|
|
|
RELEASE_TARBALL_SHA: "fractal-${CI_COMMIT_TAG}.tar.xz.sha256sum"
|
|
|
|
FLATPAK_MODULE: "fractal"
|
|
|
|
MANIFEST_PATH: "build-aux/org.gnome.Fractal.json"
|
|
|
|
APP_ID: "org.gnome.Fractal"
|
|
|
|
CONFIG_OPTS: "-Dprofile=default"
|
|
|
|
|
|
|
|
release-tarball:
|
|
|
|
stage: release
|
|
|
|
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
|
|
|
|
extends:
|
|
|
|
- .vars_release
|
|
|
|
tags:
|
|
|
|
- flatpak
|
|
|
|
script:
|
|
|
|
# Create flatpak manifest for release
|
|
|
|
- sed 's/org.gnome.Fractal.Devel/org.gnome.Fractal/g' build-aux/org.gnome.Fractal.Devel.json > ${MANIFEST_PATH}
|
|
|
|
- rewrite-flatpak-manifest ${MANIFEST_PATH} ${FLATPAK_MODULE} ${CONFIG_OPTS}
|
|
|
|
|
|
|
|
# Build tarball with vendored rust dependencies
|
|
|
|
- flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
|
|
|
|
# FIXME: We need --allow-dirty since the manifest is created in place
|
|
|
|
- echo "meson dist --allow-dirty" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
|
|
|
|
- mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-dist tarball
|
|
|
|
|
|
|
|
# Upload tarball
|
|
|
|
- |
|
|
|
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tarball/${RELEASE_TARBALL} "${PACKAGE_REGISTRY_URL}/${RELEASE_TARBALL}"
|
|
|
|
- |
|
|
|
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tarball/${RELEASE_TARBALL_SHA} "${PACKAGE_REGISTRY_URL}/${RELEASE_TARBALL_SHA}"
|
|
|
|
|
|
|
|
# Extract release notes from appstream
|
|
|
|
# FIXME: Appstream requires the files name to be `*.metainfo.xml`
|
|
|
|
- cp data/${APP_ID}.metainfo.xml.in.in data/${APP_ID}.metainfo.xml
|
|
|
|
- appstream-util appdata-to-news "data/${APP_ID}.metainfo.xml" |
|
|
|
|
awk '{ x[NR] = $0 } END { for ( i=5 ; i<=NR ; i++ ) { if (x[i] ~ /^$/ && x[i+1] ~ /^Version/ && x[i+2] ~ /^=/ && x[i+3] ~ /^Release/) exit; else print x[i]; }}' >
|
|
|
|
release_notes.txt
|
|
|
|
dependencies: []
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- tarball
|
|
|
|
- release_notes.txt
|
|
|
|
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/271534 The default URL needs authentication right now, which is less than optimal...
|
|
|
|
# Get the package_files ID instead and use that as download URL in the "release" step.
|
|
|
|
release:
|
|
|
|
stage: release
|
|
|
|
extends:
|
|
|
|
- .vars_release
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
script:
|
|
|
|
- apk add curl jq
|
|
|
|
- |
|
|
|
|
export PACKAGE_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages?sort=desc" | jq -c .[0].id)
|
|
|
|
- |
|
|
|
|
export RELEASE_TARBALL_DOWNLOAD_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${PACKAGE_ID}/package_files" | jq -c .[0].id)
|
|
|
|
export RELEASE_TARBALL_SHA_DOWNLOAD_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${PACKAGE_ID}/package_files" | jq -c .[1].id)
|
|
|
|
|
|
|
|
- export RELEASE_TARBALL_URL="${CI_PROJECT_URL}/-/package_files/$RELEASE_TARBALL_DOWNLOAD_ID/download"
|
|
|
|
- export RELEASE_TARBALL_SHA_URL="${CI_PROJECT_URL}/-/package_files/$RELEASE_TARBALL_SHA_DOWNLOAD_ID/download"
|
|
|
|
- cat release_notes.txt
|
|
|
|
- |
|
|
|
|
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
|
|
|
--assets-link "{\"name\":\"Tarball for ${CI_COMMIT_TAG}\",\"url\":\"${RELEASE_TARBALL_URL}\", \"filepath\": \"/tarball/${RELEASE_TARBALL}\"}" \
|
|
|
|
--assets-link "{\"name\":\"Checksum for ${CI_COMMIT_TAG}\",\"url\":\"${RELEASE_TARBALL_SHA_URL}\", \"filepath\": \"/tarball/${RELEASE_TARBALL_SHA}\"}" \
|
|
|
|
--description release_notes.txt
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
needs: ['release-tarball']
|