-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
124 lines (116 loc) · 4.05 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
image: dr.rechenknecht.net/bauhelfer/container/main/rust:ubuntu-jammy
stages:
- prepare
- build
- lint
- publish
variables:
# This will instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
PACKAGE_BASE_VERSION: "0.1"
prepare-rs:
stage: prepare
needs: []
script:
- export COMMIT_COUNT=`git rev-list --count HEAD`
- sed -i "s/0.0.0-dev/${PACKAGE_BASE_VERSION}.${COMMIT_COUNT}-${CI_PIPELINE_IID}/g" pam/Cargo.toml
- sed -i "s/0.0.0-dev/${PACKAGE_BASE_VERSION}.${COMMIT_COUNT}-${CI_PIPELINE_IID}/g" nss/Cargo.toml
- sed -i "s/0.0.0-dev/${PACKAGE_BASE_VERSION}.${COMMIT_COUNT}-${CI_PIPELINE_IID}/g" guest-users-lib/Cargo.toml
- sed -i "s/0.0.0-dev/${PACKAGE_BASE_VERSION}.${COMMIT_COUNT}-${CI_PIPELINE_IID}/g" sync-accountsservice/Cargo.toml
- sed -i "s/0.0.0-dev/${PACKAGE_BASE_VERSION}.${COMMIT_COUNT}-${CI_PIPELINE_IID}/g" guest-warning/Cargo.toml
- cargo install diesel_cli --no-default-features --features "sqlite"
- diesel migration run --database-url=guest_users.db --config-file guest-users-lib/diesel.toml --migration-dir guest-users-lib/migrations
artifacts:
paths:
- guest-users-lib/Cargo.toml
- nss/Cargo.toml
- pam/Cargo.toml
- sync-accountsservice/Cargo.toml
- guest-warning/Cargo.toml
- guest-users-lib/src/db/schema.rs
expire_in: 1 year
when: always
lint-rs:
stage: lint
needs:
- prepare-rs
script:
- apt-get update
- apt-get install -q -y libsqlite3-dev libclang-dev libpam-dev libnss3-dev
- rustup component add clippy
- cargo clippy -- -Dwarnings
- rustup component add rustfmt
- cargo fmt --all -- --check
build-rs:amd64:
stage: build
needs:
- prepare-rs
parallel:
matrix:
- DISTRIBUTION:
- debian-bookworm
- ubuntu-jammy
- ubuntu-noble
variables:
RUST_TARGET: "x86_64-unknown-linux-gnu"
image: dr.rechenknecht.net/bauhelfer/container/main/rust:${DISTRIBUTION}
script:
- apt-get update
- apt-get install -q -y libsqlite3-dev liblzma-dev libclang-dev libpam-dev libnss3-dev
- cargo install cargo-deb
- cargo deb --target ${RUST_TARGET} -p guest-users-pam
- cargo deb --target ${RUST_TARGET} -p guest-users-nss
- cargo deb --target ${RUST_TARGET} -p guest-users-lib
- cargo deb --target ${RUST_TARGET} -p guest-users-sync-accountsservice
- cargo deb --target ${RUST_TARGET} -p guest-users-guest-warning
- mkdir -p packages/$DISTRIBUTION/stable
- cp target/${RUST_TARGET}/debian/*.deb packages/${DISTRIBUTION}/stable
artifacts:
paths:
- packages/${DISTRIBUTION}/stable
expire_in: 1 week
when: always
build-rs:arm64:
stage: build
needs:
- prepare-rs
parallel:
matrix:
- DISTRIBUTION:
- debian-bookworm
- ubuntu-jammy
- ubuntu-noble
variables:
RUST_TARGET: "aarch64-unknown-linux-gnu"
image: dr.rechenknecht.net/bauhelfer/container/main/rust:${DISTRIBUTION}-amd64-x-arm64
script:
- apt-get update
- apt-get install -q -y libsqlite3-dev liblzma-dev libclang-dev libpam-dev libnss3-dev
- apt-get install -q -y libsqlite3-dev:arm64 liblzma-dev:arm64 libpam-dev:arm64 libnss3-dev:arm64
- cargo install cargo-deb
- cargo deb --target ${RUST_TARGET} -p guest-users-pam
- cargo deb --target ${RUST_TARGET} -p guest-users-nss
- cargo deb --target ${RUST_TARGET} -p guest-users-lib
- cargo deb --target ${RUST_TARGET} -p guest-users-sync-accountsservice
- cargo deb --target ${RUST_TARGET} -p guest-users-guest-warning
- mkdir -p packages/$DISTRIBUTION/stable
- cp target/${RUST_TARGET}/debian/*.deb packages/${DISTRIBUTION}/stable
artifacts:
paths:
- packages/${DISTRIBUTION}/stable
expire_in: 1 week
when: always
pages:
stage: publish
image: dr.rechenknecht.net/bauhelfer/container/main/aptly
needs:
- build-rs:amd64
- build-rs:arm64
script:
- mkdir -p public
- aptly-ci-new-repo guest-users packages public/packages
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH