[fractal] ci: Use template and clean up



commit b746e593acb488b6634cff9f284f9971a56dd097
Author: Julian Sparber <julian sparber net>
Date:   Thu Jul 7 16:57:42 2022 +0000

    ci: Use template and clean up

 .gitlab-ci.yml | 117 ++++++++++++---------------------------------------------
 1 file changed, 25 insertions(+), 92 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ccf0d5cbe..a82c4df22 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,5 @@
+include: 
'https://gitlab.gnome.org/Community/Purism/citemplates/-/raw/add_arch/flatpak/flatpak_ci_initiative.yml'
+
 stages:
   - check
   - test
@@ -8,71 +10,12 @@ stages:
 variables:
   FLATPAK_MODULE: "fractal"
   RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
-  CI_IMAGE_X86_64: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:42"
-  CI_IMAGE_AARCH64: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/aarch64:gnome-42"
-
-.hack:
-  variables:
-    MANIFEST_PATH: "build-aux/org.gnome.Fractal.Hack.json"
-    APP_ID: "org.gnome.Fractal.Hack"
 
-.devel:
+.vars_nightly:
   variables:
     MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json"
     APP_ID: "org.gnome.Fractal.Devel"  
 
-.build_template:
-  script:
-    - >
-      xvfb-run -a -s "-screen 0 1024x768x24"
-      flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse flatpak_app --repo=repo 
${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
-    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
-    - mkdir logs
-    - mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/meson-log.txt logs/
-    - mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/testlog.txt logs/
-    - tar cf repo.tar repo/
-  artifacts:
-    name: 'Flatpak artifacts'
-    expose_as: 'Get Flatpak bundle here'
-    when: 'always'
-    paths:
-      - "${BUNDLE}"
-      - 'repo.tar'
-      - 'logs'
-    expire_in: 14 days
-
-.build_x86_64:
-  extends: .build_template
-  image: '${CI_IMAGE_X86_64}'
-  tags:
-    - flatpak
-
-.build_aarch64:
-  extends: .build_template
-  image: '${CI_IMAGE_AARCH64}'
-  tags:
-    - flatpak-aarch64
-
-.publish_nightly_template:
-  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/flat-manager-client'
-  stage: 'deploy'
-  timeout: '100m'
-  script:
-    - tar xf repo.tar
-    - flatpak build-update-repo --generate-static-deltas repo/
-    - BUILD_ID=$(flat-manager-client create ${FLAT_MANAGER_URL} ${FLATPAK_REPO})
-    - flat-manager-client push --commit --publish --wait ${BUILD_ID} repo/ || result=$?
-    - flat-manager-client purge ${BUILD_ID}
-    - exit $result
-  variables:
-    FLAT_MANAGER_URL: https://flat-manager.gnome.org/
-    FLATPAK_REPO: nightly
-  only:
-    refs:
-      - main
-    variables:
-      - $REPO_TOKEN
-
 # Configure and run code checks
 # Exits and fails if an error is encountered
 checks:
@@ -83,57 +26,47 @@ checks:
 
 # Lint the code
 cargo-clippy:
-  extends: .hack
-  image: '${CI_IMAGE_X86_64}'
+  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/x86_64/gnome:master'
   stage: check
+  variables:
+    MANIFEST_PATH: "build-aux/org.gnome.Fractal.Hack.json"
+    APP_ID: "org.gnome.Fractal.Hack"
   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}
 
-# Build a debug version of the flatpak
-# Except on main
-flatpak:
-  extends:
-    - .hack
-    - .build_x86_64
-  stage: test
-  variables:
-    BUNDLE: "fractal-hack.flatpak"
-  except:
-    - main
-
-# Build the nightly version of the flatpak
-# Only on main
 build-x86_64:
   extends:
-    - .devel
-    - .build_x86_64
+    - .flatpak
+    - .vars_nightly
   stage: build
   variables:
-    MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json"
-    APP_ID: "org.gnome.Fractal.Devel"
     BUNDLE: "fractal-devel-x86_64.flatpak"
-  only:
-    - main
+  rules:
+    - if: $CI_COMMIT_BRANCH != "main"
+      variables:
+         MANIFEST_PATH: "build-aux/org.gnome.Fractal.Hack.json"
+         APP_ID: "org.gnome.Fractal.Hack"
+         BUNDLE: "fractal-hack-x86_64.flatpak"
+
 build-aarch64:
   extends:
-    - .devel
-    - .build_aarch64
+    - .flatpak
+    - .vars_nightly
   stage: build
   variables:
-    MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json"
-    APP_ID: "org.gnome.Fractal.Devel"
     BUNDLE: "fractal-devel-aarch64.flatpak"
-  only:
-    - main
+  rules:
+    - if: $CI_COMMIT_BRANCH != "main"
+      when: manual
 
 # Build the docs
 # Only on main
 pages:
-  extends: .devel
-  image: '${CI_IMAGE_X86_64}'
+  extends: .vars_nightly
+  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/x86_64/gnome:master'
   stage: doc
   tags:
     - flatpak
@@ -154,10 +87,10 @@ pages:
 # Publish the nightly version
 # Only on main
 publish_nightly-x86_64:
-  extends: .publish_nightly_template
+  extends: .publish_nightly
   dependencies: ['build-x86_64']
   needs: ['build-x86_64']
 publish_nightly-aarch64:
-  extends: .publish_nightly_template
+  extends: .publish_nightly
   dependencies: ['build-aarch64']
   needs: ['build-aarch64']


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]