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

6
variables:
7
    BUNDLE: "org.gnome.Podcasts.Devel.flatpak"
8

9
flatpak:
10
    image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
11 12
    stage: "test"
    variables:
13
        MANIFEST_PATH: "org.gnome.PodcastsDevel.json"
14
        FLATPAK_MODULE: "gnome-podcasts"
15 16
        CONFIGURE_ARGS: "-Dprofile=development"
        DBUS_ID: "org.gnome.PodcastsDevel"
17

18
    script:
19
        - flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
Jordan Petridis's avatar
Jordan Petridis committed
20
        # https://gitlab.gnome.org/World/podcasts/issues/55
21
        # Force regeneration of gresources regardless of artifacts chage
22
        - flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=podcasts-gtk/resources/ podcasts-gtk/resources/resources.xml
23

24
        # Build the flatpak repo
25
        - flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app ${CONFIGURE_ARGS} _build
26
        - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
27 28

        # Run the tests
29
        - |
30 31
          xvfb-run -a -s "-screen 0 1024x768x24" \
              flatpak-builder --run \
Jordan Petridis's avatar
Jordan Petridis committed
32 33 34
              --env=APP_ID="org.gnome.PodcastsDevel" \
              --env=LOCALEDIR="./podcasts-gtk/po" \
              --env=VERSION="0.0.0" \
Jordan Petridis's avatar
Jordan Petridis committed
35 36
              --env=CARGO_HOME="target/cargo-home" \
              --env=CARGO_TARGET_DIR="target_test/" \
37
              app ${MANIFEST_PATH} \
38
              cargo test --color=always -j 1 -- --test-threads=1
39

Jordan Petridis's avatar
Jordan Petridis committed
40
        # Create a flatpak bundle
41 42
        - flatpak-builder --finish-only app ${MANIFEST_PATH}
        - flatpak build-export repo app
43
        - flatpak build-bundle repo ${BUNDLE} ${DBUS_ID}
44

45 46
    artifacts:
        paths:
47
            - $BUNDLE
48
        expire_in: 2 days
49

50
    cache:
Jordan Petridis's avatar
Jordan Petridis committed
51
        key: "flatpak"
52
        paths:
53 54
          - .flatpak-builder/downloads/
          - .flatpak-builder/git/
55
          - target/
Jordan Petridis's avatar
Jordan Petridis committed
56
          - target_test/
57

58 59 60 61 62 63 64 65
review:
    stage: review
    dependencies:
        - flatpak
    script:
        - echo "Generating flatpak deployment"
    artifacts:
        paths:
66
            - $BUNDLE
67 68 69 70 71 72
        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:
Jordan Petridis's avatar
Jordan Petridis committed
73
        - master@World/podcasts
74
        - tags
75 76 77 78 79 80 81 82 83 84

stop_review:
    stage: review
    script:
        - echo "Stopping flatpak deployment"
    when: manual
    environment:
        name: review/$CI_COMMIT_REF_NAME
        action: stop
    except:
Jordan Petridis's avatar
Jordan Petridis committed
85
        - master@World/podcasts
86
        - tags
87

88
# Configure and run rustfmt
89
# Exits and builds fails if on bad format
Jordan Petridis's avatar
Jordan Petridis committed
90
rustfmt:
91 92 93 94 95 96 97
  image: "rust:slim"
  stage: "lint"
  script:
    - rustup component add rustfmt
    - rustc -Vv && cargo -Vv
    - cargo fmt --version
    - cargo fmt --all -- --color=always --check