-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
93 lines (83 loc) · 2.62 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
86
87
88
89
90
91
92
93
stages:
- lint
- test
- review
variables:
BUNDLE: "shortwave-dev.flatpak"
GIT_SUBMODULE_STRATEGY: recursive
flatpak:
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
stage: "test"
variables:
MANIFEST_PATH: "de.haeckerfelix.ShortwaveDevel.json"
VENDOR_PATH: "shortwave.tar.xz"
FLATPAK_MODULE: "shortwave"
CONFIGURE_ARGS: "-Dprofile=development"
RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo"
APP_ID: "de.haeckerfelix.ShortwaveDevel"
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}
# Create vendored archive
- flatpak-builder --run app ${MANIFEST_PATH} cargo install cargo-vendor
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build dist
- mv _build/meson-dist/*.tar.xz ${VENDOR_PATH}
artifacts:
paths:
- $BUNDLE
- $VENDOR_PATH
expire_in: 2 days
cache:
key: "flatpak"
paths:
- .flatpak-builder/downloads/
- .flatpak-builder/git/
- target/
- target_test/
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/shortwave
- tags
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
except:
- master@World/shortwave
- tags
# Configure and run rustfmt
# Exits and builds fails if on bad format
rustfmt:
image: "rust:slim"
stage: "lint"
script:
# 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
- rustup component add rustfmt
- rustc -Vv && cargo -Vv
- cargo fmt --version
- cargo fmt --all -- --color=always --check