.gitlab-ci.yml_disabled 2.62 KB
Newer Older
1
stages:
2
  - lint
Felix Häcker's avatar
Felix Häcker committed
3
  - test
4
  - review
5 6 7 8 9 10

variables:
    BUNDLE: "shortwave-dev.flatpak"
    GIT_SUBMODULE_STRATEGY: recursive

flatpak:
11 12
    image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
    stage: "test"
13 14
    variables:
        MANIFEST_PATH: "de.haeckerfelix.ShortwaveDevel.json"
15
        VENDOR_PATH: "shortwave.tar.xz"
16
        FLATPAK_MODULE: "shortwave"
17
        CONFIGURE_ARGS: "-Dprofile=development"
18 19
        RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo"
        APP_ID: "de.haeckerfelix.ShortwaveDevel"
20 21 22 23 24 25 26 27 28 29 30 31

    script:
        - flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
        # Build the flatpak repo
        - flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app ${CONFIGURE_ARGS} _build
        - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install

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

32
        # Create vendored archive
33
        - flatpak-builder --run app ${MANIFEST_PATH} cargo install cargo-vendor
34 35 36
        - flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build dist
        - mv _build/meson-dist/*.tar.xz ${VENDOR_PATH}

37 38 39
    artifacts:
        paths:
            - $BUNDLE
40
            - $VENDOR_PATH
41
        expire_in: 5 days
42 43 44 45 46 47 48 49

    cache:
        key: "flatpak"
        paths:
          - .flatpak-builder/downloads/
          - .flatpak-builder/git/
          - target/
          - target_test/
50 51

review:
52
    stage: review
53
    dependencies:
54 55 56 57 58 59 60 61 62 63 64 65 66 67
        - 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/shortwave
        - tags
68 69

stop_review:
70 71 72 73 74 75 76 77 78 79
    stage: review
    script:
        - echo "Stopping flatpak deployment"
    when: manual
    environment:
        name: review/$CI_COMMIT_REF_NAME
        action: stop
    except:
        - master@World/shortwave
        - tags
80

81 82 83 84 85 86
# Configure and run rustfmt
# Exits and builds fails if on bad format
rustfmt:
  image: "rust:slim"
  stage: "lint"
  script:
Felix Häcker's avatar
Felix Häcker committed
87 88 89
    # Create blank versions of our configured files
    # so rustfmt does not yell about non-existent files or completely empty files
    - echo -e "" >> src/config.rs
90 91 92 93
    - rustup component add rustfmt
    - rustc -Vv && cargo -Vv
    - cargo fmt --version
    - cargo fmt --all -- --color=always --check