.gitlab-ci.yml 3.27 KB
Newer Older
1 2
stages:
  - test
3
  - review
4
  - deploy
5

6
variables:
7
    BUNDLE: "org.gnome.FractalDevel.${CI_COMMIT_SHA}.flatpak"
8 9 10
    MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
    MANIFEST_PATH: "flatpak/org.gnome.Fractal.json"
    FLATPAK_MODULE: "fractal"
11
    DBUS_ID: "org.gnome.FractalDevel"
12

Jordan Petridis's avatar
Jordan Petridis committed
13
.flatpak_cache_template: &flatpak_cache
14 15 16 17 18 19 20 21
    cache:
        key: "flatpak"
        paths:
          - .flatpak-builder/cache/
          - target/
          - target_docs/
          - target_test/

22

23
flatpak:
24 25 26
    image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
    stage: "test"
    script:
27
        - flatpak-builder --stop-at=${FLATPAK_MODULE} --force-clean app ${MANIFEST_PATH}
28
        # Force regeneration of gresources regardless of artifacts chage
29
        - flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=fractal-gtk/res/ fractal-gtk/res/resources.xml
30

31
        # Build the flatpak repo
32
        - flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app -Dprofile=development _build
33
        - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
34

35
        # Run the tests
36 37 38 39 40 41 42 43 44 45 46 47
        - |
          xvfb-run -a -s "-screen 0 1024x768x24" \
              flatpak-builder --run \
              --env=CARGO_HOME="target/cargo-home" \
              --env=CARGO_TARGET_DIR="target_test/" \
              app ${MANIFEST_PATH} \
              cargo test

        # Create a flatpak bundle
        - flatpak-builder --finish-only app ${MANIFEST_PATH}
        - flatpak build-export repo app
        - flatpak build-bundle repo ${BUNDLE} ${DBUS_ID}
48

49 50
    artifacts:
        paths:
51
            - $BUNDLE
52
        expire_in: 2 days
53
    <<: *flatpak_cache
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85

review:
    stage: review
    dependencies:
        - flatpak
    script:
        - echo "Generating flatpak deployment"
    artifacts:
        paths:
            - $BUNDLE
        expire_in: 30 days
    environment:
        name: review/$CI_COMMIT_REF_NAME
        url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
        on_stop: stop_review
    except:
        - master@World/fractal
        - tags

stop_review:
    stage: review
    script:
        - echo "Stopping flatpak deployment"
    when: manual
    environment:
        name: review/$CI_COMMIT_REF_NAME
        action: stop
    except:
        - master@World/fractal
        - tags

86

87 88
pages:
    image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
89 90
    stage: deploy
    script:
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
        - flatpak-builder --stop-at=${FLATPAK_MODULE} --force-clean app ${MANIFEST_PATH}
        # Force regeneration of gresources regardless of artifacts chage
        - flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=fractal-gtk/res/ fractal-gtk/res/resources.xml

        - |
          flatpak-builder --run \
              --env=CARGO_HOME="target/cargo-home" \
              app ${MANIFEST_PATH} \
              cargo doc --no-deps

        - |
          flatpak-builder --run \
              --env=CARGO_HOME="target/cargo-home" \
              app ${MANIFEST_PATH} \
              cargo rustdoc -p fractal-gtk -- --document-private-items
106

107 108 109 110 111
        - rm -rf public
        - mv target/doc/ public
    artifacts:
        paths:
          - public
112 113 114
    only:
        - master
    <<: *flatpak_cache